biblatex icon indicating copy to clipboard operation
biblatex copied to clipboard

biblatex’s hyperref option is ignored

Open 1-user1 opened this issue 5 months ago • 2 comments

When using \usepackage[hyperref=false]{biblatex} clickable links are generated.

\begin{filecontents*}[overwrite]{references.bib}
@book{key,
  author = {Abc},
  title = {my title},
  date = {2025},
  publisher = {here}
}
\end{filecontents*}

\documentclass{article}

%\usepackage[style=apa, hyperref=false]{biblatex}
\usepackage[hyperref=false]{biblatex}
\addbibresource{references.bib}

\usepackage[colorlinks=true]{hyperref}

\begin{document}

\url{example.com}

\cite{key}

\end{document}

1-user1 avatar Sep 14 '25 09:09 1-user1

Thank you very much for reporting this.

I haven't yet had time to look into this in more detail, but I think this has to do with the fix for https://github.com/plk/biblatex/issues/1366 (https://github.com/plk/biblatex/commit/cdd65b01c6ec47ae96b507b48a62b62d4c558b58). We'll probably need to be a little more careful. But we need to see how to do that in order to keep the tagging code happy.

moewew avatar Sep 14 '25 20:09 moewew

I think that is not very difficult. If the tagging code is loaded the tagging and the hyperref code are in a hook, each with its own label. If you do not want the hyperref code you can simply void that label.

So something like the following should work. I can also adapt the default definition in hyperref so that it always uses the hook. Then you do not need to test for DocumentMetadata.

%\DocumentMetadata{tagging=on}
\documentclass{article}

%\usepackage[style=apa, hyperref=false]{biblatex}
\usepackage[hyperref=false]{biblatex}
\makeatletter
\IfDocumentMetadataTF
 {
  \AddToHook{cmd/hyper@natlinkstart/before}[biblatex]{}
  \AddToHook{cmd/hyper@natlinkend/after}[biblatex]{}
  \DeclareHookRule{cmd/hyper@natlinkstart/before}{biblatex}{voids}{hyperref}
  \DeclareHookRule{cmd/hyper@natlinkend/after}{biblatex}{voids}{hyperref}
 }
 {\AddToHook{package/hyperref/after}{\def\hyper@natlinkstart#1{}\def\hyper@natlinkend{}}} 

\addbibresource{references.bib}

\usepackage[colorlinks=true]{hyperref}

\begin{document}

\url{example.com}

\cite{key}

\end{document}

u-fischer avatar Dec 09 '25 22:12 u-fischer