3

Sorting citations using \cites command in biblatex with Sorting citations using \cites command in biblatex worked fine but doesn't work anymore with TexLive 2016.

Error produced with the minimal example of the above link:
! Undefined control sequence.
<argument> \cbx@sortkeys 

l.49 ...mpanion}{ctan}{markey}[10--11]{vangennep} \\

Its's not just a wrong error message by running first time biber. There is no output for the intended sorted \Cites and \cites commands.

Anybody knows how to adjust the code for new TexLive 2016?

  • In which version did it work? With TL 2015 I get the same error as with 2016. – user36296 Jun 11 '16 at 10:54
  • I guess it was with biblatex version pre-march 2016, however the proposed code should work with TeXLive 2016 or would need some changes. The problem stays the same: how can I sort multiple bib-entries with biblatex and biber and the cited comands? – Michael Jun 12 '16 at 13:30
2

I had the same problem and searched in the old and new biblatex.sty and related files. I found where the definition of

{\global\letcs{\cbx@sortkeys}
     {blx@slists@\the\c@refsection @entry@\blx@sorting}}% Biber

in Audray's solution (Sorting citations using \cites command in biblatex) came from. This does not work with the actual biblatex, because some of the arguments used here are not defined anymore. I had to replace these lines with the definition found in the actual biblatex:

{\global\letcs{\cbx@sortkeys}
    {blx@slist@centry@\the\c@refsection @\blx@refcontext@context}}% Biber

It is still not the cleanest solution using the deep internals of biblatex, but it woks for me ...

Here a MWE. It is a patch of the MWE in Audrey's brilliant answer (so the credits still belong to him):

\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 [patched to the original answer, new biblatex!]
\def\cbx@sortkeysinit{%
  \ifcsundef{blx@slist@centry@\the\c@refsection @\blx@refcontext@context}
    {}
    {\global\letcs{\cbx@sortkeys}{blx@slist@centry@\the\c@refsection @\blx@refcontext@context}}}
\def\cbx@sortkeys{}
\makeatother

\addbibresource{biblatex-examples.bib}
\newcommand{\cmd}[1]{\textbackslash\texttt{#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}
  • OK, I did some more digging, it should work perfectly if you replace the definition of \cbx@sortkeysinit by \def\cbx@sortkeysinit{% \ifcsdef{blx@slist@centry@\the\c@refsection @\blx@refcontext@context} {\global\letcs{\cbx@sortkeys}{blx@slist@centry@\the\c@refsection @\blx@refcontext@context}} {}} (mod line breaks). In version 3.5 this works for both biblatex and Biber from the first run without any errors. If you include that in your answer and write a full MWE I'd be more than happy to up-vote it. – moewe Sep 15 '16 at 12:38
  • @Michael: I must say that this was a little bit try and error, due to my medium LaTeX fu. I use this citation sorting in a different way. But I will adapt an example, and extend my answer. – Michael P Sep 15 '16 at 19:00
  • I have modified the code a tiny bit to be a bit shorter. In all my tests it still behaved as expected. But if you find a problem with it, give me a shout and change it back. – moewe Sep 16 '16 at 14:17
  • Ah, and thank you for the MWE (+1)! – moewe Sep 16 '16 at 14:19

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.