How to replace multiple references by an en-dash in a citation using BibTeX?

I’m trying to \cite a couple of authors at the same time and citations are in consecutive order.
What I get is something like this:

[21,22,23,24,25]

Instead I want it to look like this:

[21-25]

Is this possible in TeXmacs? I am using Vancouver style.

It is possible in Mogan, thanks to @jingkaimori and hammerfunctor

  1. https://github.com/XmacsLabs/mogan/pull/1234
  2. https://github.com/XmacsLabs/mogan/pull/1369
1 Like

I will try it, thank you @darcy
Do you maybe know how to easily remove space in citations?

Citations are rendered like this [1, 2] but correct way is without space after commas, like this [1,2].

There is no easy way now. Because cite-sort is not a plugin. Let me pluginize the cite related code, and then you just need to customize the cite-sort plugin.

it is indeed easy, if you know about how to browse the source code of the style.

This is the impl in TeXmacs/Mogan:

<assign|cite-sep|<macro|, >>

Just remove the space above:

<assign|cite-sep|<macro|,>>

And put this assign to the preamble.

How to put this assign to preamble:

  1. Document -> Part -> Show preamble
  2. Copy this code snippet, and click Edit->Paste from->TeXmacs

And for GNU TeXmacs, I’ve separate the cite-sort package into a separate plugin:

You can install it and then import the cite-sort package as Help->Plugins->Cite indicates.

Your assistance is truly astounding and swift! Initially, my intention was merely to inquire about how to incorporate it into the preamble. However, you preemptively updated your response with those specifics. I will proceed to test it immediately.

So we can remove commas in Mogan and in TeXmacs now and multiple references can be separated with an en-dash only in Mogan. There is no way to do that in TeXmacs?

This is the answer for you to complete it in TeXmacs. You have to know about TEXMACS_HOME_PATH, and install the cite style package plugin to TEXMACS_HOME_PATH/plugins.

Thank you! I initially thought it was intended to address the issue with commas. Now, I understand.

Just make two style plugins today:

And I will add Style plugin as a category to https://mogan.app/guide/plugins.html

Hope that the new plugin system designed and implemented in Mogan v1.2.6 can grow the community of GNU TeXmacs and Mogan!