Closed dbitouze closed 1 year ago
Yes. In order to work properly biblatex
needs to check if hyperref
is loaded. It does that in an begindocument/before
hook. Your hook code comes in after the biblatex
code. So you load hyperref
when biblatex
has already concluded that the package is not loaded and hence does not do linking.
There are at least two ways around this.
biblatex
's with hook rules.
\documentclass{article}
\RequirePackage{biblatex}
\AddToHook{begindocument/before}[loadhyperref]{ \RequirePackage{hyperref} } \DeclareHookRule{begindocument/before}{loadhyperref}{before}{biblatex}
\addbibresource{biblatex-examples.bib} \begin{document} \section{Test}\label{test}
Cf. section~\ref{test}. This is a citation: \autocite{knuth:ct:a}.
\printbibliography \end{document}
2. Use `hyperref=manual,` and execute `\BiblatexManualHyperrefOn` yourself after loading `hyperref`. See https://github.com/plk/biblatex/issues/585 for more details and discussion.
```latex
\documentclass{article}
\RequirePackage[hyperref=manual]{biblatex}
\AddToHook{begindocument/before}{
\RequirePackage{hyperref}
\BiblatexManualHyperrefOn
}
\addbibresource{biblatex-examples.bib}
\begin{document}
\section{Test}\label{test}
Cf. section~\ref{test}. This is a citation: \autocite{knuth:ct:a}.
\printbibliography
\end{document}
Thanks!
Is there any reason for the citation in the following example to not be an hyperlink (whereas it is an hyperlink if
hyperref
is loaded normally and not by means of\AddToHook{begindocument/before}
)?