# Displaying in-text citations in a compressed way (e.g. [1-3]) instead of the default one [1]-[3] using cite package inside IEEEtran/journal mode

I have been trying to display the in-text citations in the following format:

[1-3], or [1, 6-8]

which looks like it is the default one inside the cite package, but what I get is:

[1]-[3]

Specifically, I'm using the IEEEtran template (bare_jrnl to be more precise) and the bibliography is built in the following way:

\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,mybib}


The cite package is obviously loaded. I have looked the documentation of both IEEEtran and cite, but I have not been able to find a solution.

-

## migrated from stackoverflow.comOct 18 '12 at 1:32

This question came from our site for professional and enthusiast programmers.

That's actually how IEEE defines it's citation style. Also use \usepackage[noadjust]{cite} to remove the trailing space from the citation numbers. In fact in the accepted proof version, they will further make it like [1],[2] and [3] if less than three citations are compressed. They will also do terrible things to your article but they are not relevant here. –  percusse Oct 18 '12 at 1:47
Thank you very much for the details. I guess I have not much choice than leave it like than. Have a nice day! –  Ales Oct 18 '12 at 12:50

First the citation issue. Citing from the ieeetran manual

Citations are made with the \cite command as usual. IEEEtran will produce citation numbers that are individually bracketed in IEEE style. (“1, [5]” as opposed to the more common “[1, 5]” form.) The base IEEEtran does not sort or produce compressed “ranges” when there are three or more adjacent citation numbers. However, IEEEtran pre-defines some format control macros to facilitate easy use with Donald Arseneau’s cite package [13]. So, all an author has to do is to call cite package:

   \usepackage{cite}


and the adjacent citation numbers will automatically be sorted and compressed (ranged) IEEE style. (Of course, multiple adjacent citations should always all be declared within a single \cite, comma separated, for this to work.) Invoke cite.sty’s noadjust option to prevent an unwanted leading space from occurring should a citation ever need to be enclosed in parenthesis.

.......

Note that, if needed (e.g., next to a non-punctuation/nonspace character), cite.sty’s \cite command will automatically add a leading space. i.e., “(\cite{mshell01})” will become like “( 1)”. If this behavior is not desired, use the cite package’s noadjust option (cite.sty V3.8 and later) which will turn off the added spaces:

    \usepackage[noadjust]{cite}


However, one should keep in mind that IEEE has an unexplainable what-you-submit-is-NOT-what-you-get type of workflow. I can understand that they might have reasons for that but still, sometimes the changes are too dramatic. Citation style is also affected from that in particular they are probably modified manually by a copy editor. Most often, the missing Oxford commas are added. Moreover, the compressed and uncompressed citations are separated from each other as groups. Some examples from published articles

Long story short, it seems that IEEE does not fully automate their citation style which is context dependent, therefore, for the users simply following the manual is sufficient. A copy editor will fix your article hence there is no need on the user side to tweak the underlying citation mechanism. You don't even need to balance the last page as they will manually insert line breaks to the bibliography items and adjust the spacing accordingly. I think this is also unfair to the author of ieeetran class as I'm sure he can come up with fully automated mechanism had IEEE decided on something concrete as a standard.

\begin{rant}


As it happened to me with siunitx usage, they actually don't like extra bits, for example don't even think of leaving your TikZ code in, they will be replaced with bitmap images. They also tend to remove TeX modifications (in my case changed all the per-mode=frac typeset units into hard coded N/m and I'm not even going into the things that they do to your vector images).

Moreover, they don't allow you to receive the modified TeX file but you annotate the corrected proof PDF result. Hence, you only send your rough idea about the article and they create it for you. That's cutting edge technology right there. It might happen that some people just want to see their hard work in a mildly pleasing format.

The counter argument for this is the idiot academician who can't manage to write a proper minimal LaTeX code but somehow manage to prove things using sophisticated math arguments. Scientific publication is part of the job description of the academician. They are responsible to write proper articles as much as they are responsible for the contribution of their results. The whole IEEE community can not resort back to its weakest link just because some person refuses to read the manual (probably with an all-time classic I don't have time for that nonsense argument invoked; Firm steps towards the fourth Nobel prize ladies and gentlemen step aside!).

So IEEE can send the article back to the author and ask for a better code. Somehow the article payments and extra page charges are fully automated to the smallest detail and the procedure just stops until we pay... a short dramatic silence.... So same care can go into the content too. I'm not asking much; just the 175\$ extra page charge for my online article which is probably enriched with BeCu compounds such that the paper size is invariant under all adverse climate changes and remains in its optimal readability conditions for at least 400 hundred more years.

\end{rant}

-
Thank you very much, that has been incredibly helpful! –  Ales Jun 11 '13 at 10:59
@percusse That felt like a love letter :) –  Mario S. E. Oct 14 '13 at 10:08

If you use Natbib, with the sort&compress option, this feature is 'Easy Peasy Japaneasie'.

This is the preamble command that I use, and it does EXACTLY what you have specified.

\usepackage[numbers,sort&compress,square]{natbib}


Forget \cite{blabla}, its hopeless, use \citep{blabla} or \citet{blabla} or any of the other options as per the following link(s):

http://merkel.zoneo.net/Latex/natbib.php

http://texblog.org/2008/03/17/natbib-multiple-reference-citation/

As you will see, there are a number of items including various alternate commands, things like \citeyear or \citeauthor which allows you to really structure your wording exactly how you like.

Cheers.

-
It seems clear from the question that natbib is not usable, since the required bibliography style is IEEEtran. –  egreg Jan 8 '13 at 7:50