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?

bikeclub
  • 111

1 Answers1

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