1

This question is very similar to this one. The accepted answer to that question is to pass a global parameter to the biblatex package.

What I don't see is, what needs to be done to call \printbibliography with different options? Say, one bibliography is printed with doi information and the next one without.

So, how to change package options within the document environment?

nils
  • 113

1 Answers1

1

In general you can not set biblatex's global options locally within your document. Some options can be set on a per-type or per-entry basis (starting with version 3.13 of biblatex many more options are settable at those scopes: https://github.com/plk/biblatex/pull/866, https://github.com/plk/biblatex/pull/877), but that is not the same as toggling one option inside the document. Note that some option values are passed on to the backend and thus can not be changed on the fly since they need to be fixed throughout the entire document.

The internal implementation of the options for DOI, ISBN, eprint, however, can be easily changed locally. The options are implemented via an etoolbox toggle (see standard.bbx, ll. 4-21). Calling the option doi, isbn, eprint, url or related as <option>=<value> is pretty much equivalent to setting a toggle of the name bbx:<option> to <value>.

Hence, you can try something like

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}


\begin{document}
\cite{sigfridsson}
\printbibliography[title=\refname\ with DOI]

\begingroup
\togglefalse{bbx:doi}
\printbibliography[title=\refname\ without DOI]
\endgroup

\printbibliography[title=\refname\ with DOI again]
\end{document}

Three bibliographies with the same entry: The first and third have a DOI, the second does not show it.


Note that this is a viable solution if you want to locally (regionally) disable certain features in your document. If you want to suppress the DOI for certain entries, for entries with a certain property (for example for entries of a certain type), then there are more natural ways to do that (for example with a per-type option, a sourcemap or a test).

moewe
  • 175,683