2

I am using bibtex, with the bibliography style ieeetr to create my references. I have read the IEEE style manual, and I know that I should leave citations in separate sets of brackets, e.g., [3], [4].

However, I know that they should be hyphenated when consecutive, in groups of 3 or more, e.g., [5]-[10] but the ieetr style doesn't seem to do this automatically. Any ideas? I have already tried using the cite package.

MWE:

\documentclass{article} 
\usepackage{cite} 
\begin{document} 
This is my text, and here are some citations \cite{article1}, \cite{article2}, \cite{article3}.
\bibliography{examplebib} 
\bibliographystyle{ieeetr} 
\end{document}

And the bib file "examplebib.bib"

@article{article1,
  author    = {Doe, John},
  title     = {Title of article},
  journal   = {journal of article},
  year      = {2017},
  volume    = {11},
  number    = {1},
  pages     = {11--13},
  publisher = {Journal Publisher},
}
@article{article2,
  author    = {Doe, John},
  title     = {Title of article},
  journal   = {journal of article},
  year      = {2017},
  volume    = {11},
  number    = {1},
  pages     = {11--13},
  publisher = {Journal Publisher},
}
@article{article3,
  author    = {Doe, John},
  title     = {Title of article},
  journal   = {journal of article},
  year      = {2017},
  volume    = {11},
  number    = {1},
  pages     = {11--13},
  publisher = {Journal Publisher},
}

marked as duplicate by percusse, Stefan Pinnow, TeXnician, Schweinebacke, user36296 Aug 11 '17 at 15:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you writing this document to be published in a journal? If so, their staff will take care of details like this. Does it have to be IEEE style? I just looked up my recent works and revtex seems to do this automatically. – engineer Apr 13 '17 at 6:47
  • No, I'm not writing for a journal. It does have to IEEE. I don't know much about revtex. Is there a revtex version for IEEE? – Aarow Apr 13 '17 at 17:59
1

An approximation to this cite style can be achieved using the natbib package:

\usepackage[numbers,sort&compress]{natbib}
\setcitestyle{square,citesep={],[}}
\bibliographystyle{IEEEtranN}

Then you can use \cite{article1,article3} to get [1],[3]. However, any consecutive range like \cite{article1,article2,article3} still gives [1-3]. This behavior is hard-coded and cannot be changed without redefining the \cite command.

Another option is the biblatex and biblatex-ieee packages (see this answer for why babel is needed):

\documentclass{article} 
\usepackage[english]{babel}
\usepackage[style=ieee,backend=bibtex]{biblatex}
\addbibresource{examplebib.bib}

\begin{document}
This is my text, and here are some citations \cite{article1,article2,article3}.
\printbibliography
\end{document}

This gives the correct formatting when you use version 1.2d of the biblatex-ieee package (from CTAN). The compression doesn't work with 1.1n, which is the version my TeXLive distribution provides.

  • Thanks. I guess I was hoping there was a way to do it without biblatex. The Natbib solution you point out changes more in my document than I wanted. – Aarow Apr 13 '17 at 17:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.