1

When I try this example code from this other question I get a Latex error.

\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareBibliographyCategory{mine}
\addtocategory{mine}{companion,sigfridsson}
\nocite{companion,sigfridsson}

\newcommand{\nameuse}[1]{%
  \def\do##1{%
    \settoggle{blx@use##1}{#1}
  }%
  \dolistcsloop{blx@biber@datamodel@names}}

\newcommand{\nameusesave}{%
  \def\do##1{%
    \providetoggle{blx@save@use##1}%
    \iftoggle{blx@use##1}{\toggletrue{blx@save@use##1}}{\togglefalse{blx@save@use##1}}%
  }%
  \dolistcsloop{blx@biber@datamodel@names}}

\newcommand{\nameuserestore}{%
  \def\do##1{%
    \iftoggle{blx@save@use##1}{\toggletrue{blx@use##1}}{\togglefalse{blx@use##1}}%
  }%
  \dolistcsloop{blx@biber@datamodel@names}}

\begin{document}
\nameusesave
\nameuse{false}
\printbibliography[category=mine]
\nameuserestore

\printbibliography[category=mine]
\end{document}

Error:

! Missing \endcsname inserted.
<to be read again> 
                   \blx@biber@datamodel@names 
l.30 \nameusesave

I assume the reason is that I am using a newer version of Biblatex/Biber/something else. Am using Pdftex, Biber version 2.7 and (I believe) Biblatex version 3.7.

Would be grateful if somebody could explain the problem and/or post new code.

Addition: any working solution to the problem would be fine, of course. It doesn't have to be the same as this previous answer.

1

A while ago when BibTeX was declared a legacy backend, the biblatex core was rewritten and most mentions of Biber were removed from command names. The datamodel names are now stored in \blx@datamodel@names and not in \blx@biber@datamodel@names. So we need to change all three \dolistcsloop{blx@biber@datamodel@names} to

\dolistcsloop{blx@datamodel@names}

I have updated my answer to Putting the title first in the bibliography to use the new names.

In full

\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareBibliographyCategory{mine}
\addtocategory{mine}{companion,sigfridsson}
\nocite{companion,sigfridsson}

\newcommand{\nameuse}[1]{%
  \def\do##1{\settoggle{blx@use##1}{#1}}%
  \dolistcsloop{blx@datamodel@names}}

\newcommand{\nameusesave}{%
  \def\do##1{%
    \providetoggle{blx@save@use##1}%
    \iftoggle{blx@use##1}{\toggletrue{blx@save@use##1}}{\togglefalse{blx@save@use##1}}%
  }%
  \dolistcsloop{blx@datamodel@names}}

\newcommand{\nameuserestore}{%
  \def\do##1{%
    \iftoggle{blx@save@use##1}{\toggletrue{blx@use##1}}{\togglefalse{blx@use##1}}%
  }%
  \dolistcsloop{blx@datamodel@names}}

\begin{document}
\nameusesave
\nameuse{false}
\printbibliography[category=mine]
\nameuserestore

\printbibliography[category=mine]
\end{document}

enter image description here

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.