1

I've seen many posts about getting the citation list in order of appearance, but my issue differs slightly and I wasn't able to find it in other posts...

I'm wondering if there's a way to sort citations inline by their order of appearance in the text. Here's an example:

Main body of text with first citation \cite{source_1}. Second citation here \cite{source_2}. 
For fun here's another \cite{source_3}.
Further on I don't want to worry about correctly ordering my references and would like to 
cite them like this \cite{source_2, source_3, source_1}.

The result looks like this:

Main body of text with first citation [1]. Second citation here [2]. For fun here's another [3]. Further on I don't want to worry about correctly ordering my references and would like to cite them like this [2, 3, 1].

What I'd like to see is the group citation display the references as "[1, 2, 3]" (or ideally "[1-3]") rather than the order I listed them in the editor. \bibliographystyle{ieeetr} has gotten me 90% of the way to how I want this formatted but the last few details are eluding me.

1

Use the cite package, it does what you want:

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
  @book{a,
    author = {A},
    year = {2001},
    title = {A},
  }
  @book{b,
    author = {B},
    year = {2002},
    title = {B},
  }
  @book{c,
    author = {C},
    year = {2003},
    title = {C},
  }
\end{filecontents}

\usepackage{cite}

\begin{document}

\cite{a}
\cite{b}
\cite{c}
\cite{b,a,c}

\bibliographystyle{ieeetr}
\bibliography{\jobname}

\end{document}

It gives the expected output:

[1] [2] [3] [1-3]

It also provides options for disabling sorting or compressing (e.g. that you get [1,2,3] with options [nocompress])

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.