42

I think I may have found a bug in either hyperref, cleverefoder varioref but can't determine the details any further. If do not load hyperref in the following example, the result is fine.

\documentclass[ngerman]{scrartcl}

\usepackage{babel}
%\usepackage{hyperref}
\usepackage{varioref}
\usepackage{cleveref}

\begin{document}

\section{Erster Abschnitt}\label{sec}

\begin{figure}
\rule{\textwidth}{1cm}
\caption{bild}\label{bild}
\end{figure}

Siehe \vref{sec}, siehe \vref{bild}

\end{document} 

good results without hyperref

If I load hyperref the reference reference to the section cannot be expanded, I get the following error instead:

! Argument of \@fourthoffive has an extra }.
<inserted text> 
                \par 
l.19 Siehe \vref{sec}
                     , siehe \vref{bild}
? 

bad results with hyperref

Any idea from which package this error may result?

2

1 Answer 1

47

Load varioref first, then hyperref, then cleveref. See section 14.1 of the cleveref manual.

\documentclass[ngerman]{scrartcl}

\usepackage{babel}
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}

\begin{document}

\section{Erster Abschnitt}\label{sec}

\begin{figure}
\rule{\textwidth}{1cm}
\caption{bild}\label{bild}
\end{figure}

Siehe \vref{sec}, siehe \vref{bild}

\end{document}

enter image description here

1
  • 1
    Moving hyperref to after titlesec fixed the warnings I was getting "The anchor of a bookmark and its parent's must not be the same."
    – Bamboo
    Commented May 21, 2021 at 7:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .