This question is related to a question I asked earlier here. I wanted to cite references in order of appearance without Bibtex and the answer did exactly that. However, consider I have the following bibliography:


The code \cite{ref2} and \cite{ref3, ref4, ref5} will give [1] and [2,3,4] and what I want is [1] and [2-4] instead. How can I alter the code given in the previous answer? Note that using \usepackage{cite} will output [1] and [4-6] which is not in the order of appearance.


The implementation in Sorting bibliography in order of appearance without Bibtex naively assumed that the argument of \citation is always only a single key. That is a valid assumption for the standard implementation of \cite, but not for the implementation of cite's \cite.

The following simple extension should also deal with comma-separated lists. The only difference is the introduction of a CSV loop in \citation and the resulting move of the core of the macro to \citation@i.


\newcommand*{\lodbib@notcited}{}% catch entries that were not cited

% macro in aux file



% save bibitems


       {\@latex@warning{Empty `thebibliography' environment}}%
      \@clubpenalty \clubpenalty



\cite{ref2} and \cite{ref3, ref4, ref5}



The citations read "[1] and [2–4]"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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