# Page range in multiple citation with sorting

I'd like to have a citation of multiple sources, automatically sorted and to be able to specify page range of each. I use biblatex with this configuration:

\usepackage[
firstinits=true,
sortcites=true,  %řadit zdroje
backend=biber,
style=iso-numeric,
]{biblatex}
\addbibresource{literatura.bib}
\renewcommand\multicitedelim{\addsemicolon\space}%Change coma to semicolon


Citation like

\cite{a,c,b}


will give me

[a;b;c]

as I have sorting and separating by semicolon already solved. However I would need something like

[a, p. 10-12;b;c, p. 25]

\cites[p.~10-12]{a}[p.~25]{c}[]{b}


Doesn't quite do the trick as it seems unable to sort the citations.

Is there a solution to the problem or should I just work it around somehow?

• Welcome to TeX.SE. Please tell us if you use BibTeX or biblatex, whether you use a citation management package (e.g., natbib), and what kind of citation call-out style you practice. It looks like it might be some kind of authoryear style, but it would be helpful if you were a bit more explicit. – Mico Mar 15 '18 at 21:09
• @Mico Thank you for advice, I always forget to state all the important information. I'll hopefully learn to see them all at once one day :). I don't use natbib or anything. Just BibLaTex... Is it complete this way? – tingdling Mar 16 '18 at 7:08
• The multicite version can't sort their argument by default. tex.stackexchange.com/q/65809/35864 offers a work-around at the cost of additional TeX runs. – moewe Mar 16 '18 at 7:34
• Any news here? Did the linked question help you? If not, what did you try and how did it not work for you? – moewe Mar 19 '18 at 11:33
• Well for some reason this solution doesnt work for me. It outputs "Undefined control sequence. ...}{RE_RFID-frekvence}{RFjournal-frekvence}}".. I use TexLive pdfTex 1.40.18 I also tried copying the whole example in new blank document. No success there also.. – tingdling Mar 19 '18 at 14:45

## 1 Answer

The general approach from Sorting citations using \cites command in biblatex can still be used. But it needs updating again.

In Audrey's original code replace

\def\cbx@sortkeysinit{%
\ifcsundef{blx@sort@\the\c@refsection}
{\global\letcs{\cbx@sortkeys}
{blx@slists@\the\c@refsection @entry@\blx@sorting}}% Biber
{\global\letcs{\cbx@sortkeys}{blx@sort@\the\c@refsection}}}% BibTeX


with

\def\cbx@sortkeysinit{%
\ifcsundef{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}
{}
{\global\csletcs{cbx@sortkeys}{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}}}


Then everything should work as advertised again

\documentclass{article}
\usepackage[style=authortitle,sorting=ynt,sortcites]{biblatex}

\makeatletter

% original definition of \cites
\DeclareMultiCiteCommand{\cbx@cites}{\cite}{\multicitedelim}

% new definition
\DeclareMultiCiteCommand{\cites}[\cbx@cite@wrapper\cbx@cites]{\cbx@cite}{}

% first pass saves keys, prenotes, postnotes
\DeclareCiteCommand{\cbx@cite}
{\csxdef{prenote:\thefield{entrykey}}{\thefield{prenote}}}
{\listxadd\cbx@savekeys{\thefield{entrykey}}}
{}
{\csxdef{postnote:\thefield{entrykey}}{\thefield{postnote}}}

% second pass outputs sorted citation list
\newrobustcmd{\cbx@cite@wrapper}[2]{%
\def\cbx@savekeys{}%
\def\cbx@citecall{#1}%
#2\cbx@sortkeysinit\cbx@citesort\cbx@citecall}

% internal list of saved keys => sorted argument list
\def\cbx@citesort{%
\def\do##1{%
\ifinlist{##1}{\cbx@savekeys}
{\protected@xappto\cbx@citecall{%
[\csuse{prenote:##1}][\csuse{postnote:##1}]{##1}}}
{}}%
\dolistloop{\cbx@sortkeys}}

% internal list of sorted entry keys
\def\cbx@sortkeysinit{%
\ifcsundef{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}
{}
{\global\csletcs{cbx@sortkeys}{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}}}
\def\cbx@sortkeys{}

\makeatother

\addbibresource{biblatex-examples.bib}
\newcommand{\cmd}[1]{\texttt{\textbackslash #1}}
\setlength{\parindent}{0pt}
\begin{document}
\cmd{cite}: \cite{companion,ctan,vangennep,markey} \\
\cmd{cites}: \cites[e.g.][10]{companion}{ctan}{markey}[10--11]{vangennep} \\
\cmd{Cites}: \Cites{ctan}{markey}[e.g.][5--10]{companion}[10--11]{vangennep}
\printbibliography
\end{document}


• Hi, thanks for answer. It works. I just modified the second pass to print brackets around \cites % second pass outputs sorted citation list \newrobustcmd{\cbx@cite@wrapper}[2]{% [\def\cbx@savekeys{}% \def\cbx@citecall{#1}% #2\cbx@sortkeysinit\cbx@citesort\cbx@citecall ]} – tingdling Mar 21 '18 at 18:24