1

I can't get the solution to work from this previous question and answer: Is it possible to mark designated entries in a bibliography with an asterisk?

Here is my example code:

\documentclass{article}

\usepackage[sorting=none, backend=biber]{biblatex} % load the package
\addbibresource{bibfilename.bib}

\begin{filecontents}{biblatex-dm.cfg}
  \DeclareBibliographyCategory{asterisk} 
\end{filecontents}

\addtocategory{asterisk}{key1, key2}
\renewbibmacro*{begentry}{\ifcategory{asterisk}{*\addspace}{}}

\begin{document}
\cite{key1}
\bibliography{bibfilename.bib}
\end{document}

And I get this error message:

enter image description here

What am I doing wrong?

  • Welcome to TeX SX! Could you post a .bib file? – Bernard Dec 30 '16 at 16:57
1

Use it this way:

\documentclass{article}

\usepackage[sorting=none]{biblatex} % load the package
\DeclareBibliographyCategory{asterisk}
\addbibresource{bibfilename.bib}

\addtocategory{asterisk}{key1, key2}
\renewbibmacro*{begentry}{\ifcategory{asterisk}{*\addspace}{}}

\begin{document}
\cite{key1}
\printbibliography
\end{document}

The datamodel config file biblatex-dm.cfg is read before biblatex defines all its macros. As an alternative use the default config file biblatex.cfg

\RequirePackage{filecontents}% allows overwriting
\begin{filecontents*}{biblatex.cfg}
\DeclareBibliographyCategory{asterisk}
\end{filecontents*}
\documentclass{article}

\usepackage[sorting=none]{biblatex} % load the package
\addbibresource{bibfilename.bib}

\addtocategory{asterisk}{key1, key2}
\renewbibmacro*{begentry}{\ifcategory{asterisk}{*\addspace}{}}

\begin{document}
\cite{key1}
\printbibliography
\end{document}

That file is read after loading biblatex

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.