5

Biblatex, with the sortcite option, will sort multiple citations (see Sorting of multiple citations with biblatex). I want most of my multiple citations to be sorted, but occasionally I wish to deliberately put them in the wrong order. Is there a way to achieve this?

That is, I want a macro called something like \unsrtcite, so that the TeX below will produce the following

First: [1,2] Second: [1,2] Third: [2,1]

(Obviously I could use \cite{second} \cite{first}, rather than \cite{second,first} when I want them not to be sorted but that's not quite what I want).


main.tex

% main.tex
\documentclass[]{article}

\usepackage[sortcites]{biblatex} 

\bibliography{references}
\begin{document}


First: \cite{first,second} 
Second: \cite{second,first}
Third: \unsrtcite{second,first} 

\end{document}

references.bib

% references.bib
@misc{first,
  title={Reference A},
  author={Alice},
  year={1980}
}

@misc{second,
  title={Reference B},
  author={Bob},
  year={2000}
}
Alan Munn
  • 218,180
Kweku A
  • 83

1 Answers1

4

You can use the \cites command for this, which doesn't sort.

\documentclass[]{article}
\begin{filecontents}{\jobname.bib}
@misc{first,
  title={Reference A},
  author={Alice},
  year={1980}
}

@misc{second,
  title={Reference B},
  author={Bob},
  year={2000}
}
\end{filecontents}
\usepackage[sortcites]{biblatex} 

\addbibresource{\jobname.bib}
\begin{document}


First: \cite{first,second} 
Second: \cite{second,first}
Third: \cites{second}{first} 

\end{document}

output of code

Alan Munn
  • 218,180
  • 1
    Who knew that the 'feature' that \cites doesn't sort citations would come in handy at some point? (https://github.com/plk/biblatex/issues/214, https://github.com/plk/biblatex/issues/817, https://tex.stackexchange.com/q/65809/35864) – moewe Jan 29 '20 at 17:10
  • @moewe I take it from reading the issues on the biblatex repo, that this is unlikely to change in the near future (if it is, I should probably add a disclaimer to the answer)? – Alan Munn Jan 29 '20 at 19:08
  • There are no plans at the moment to change that, but if someone comes along with an idea for the implementation I won't send them away. I don't think an explicit warning in the answer would make sense at the moment. – moewe Jan 29 '20 at 21:52
  • Brilliant - thanks! I saw someone mention \cites and wondered if it would work but couldn't find it in the biblatex documentation. I guess there's not a straightforwad way to format like \cites{second,first} instead of \cites{second}{first}? – Kweku A Jan 30 '20 at 08:21
  • 1
    @KwekuA No, the whole point of the multicite commands is that they take each cite key as a separate argument so that they can be treated separately with their own pre- and post-notes, so you can't put them all in one comma separated list like the regular cite commands. – Alan Munn Jan 30 '20 at 12:10
  • But without the "sort" option activated in biblatex, \cite{second,first} does what I want it to sometimes do, which suggests the functionality is there? But maybe there's not a straightforward way to access it. Thanks for your help anyway! – Kweku A Feb 02 '20 at 08:18
  • 1
    @KwekuA Yes and no. Sorting with the default syntax is a global option, so you can either have it or not. If you don't turn it on, then of course the citations will appear in the order you enter them. But you can't turn off the global option on an individual case without using the alternative syntax. – Alan Munn Feb 02 '20 at 13:47