-
Notifications
You must be signed in to change notification settings - Fork 38
Description
(reposted from https://puszcza.gnu.org.ua/bugs/index.php?193, author Kristian Debrabant )
I recently discovered the following strange behaviour when hyperref is combined with an ams class:
The following code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{amsart}
\usepackage{hyperref}
\newtheorem{example}{Example}
\begin{document}
\ \newpage
\begin{example}\label{ex}
\begin{itemize}
\item
\end{itemize}
\end{example}
\ref{ex}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(all packages in the last version of CTAN) results in a pdfTeX warning “(dest): name{example.1} has been referenced but does not exist, replaced by a fixed one”. And indeed, the hyperlink created by \cref{ex} does not point to the actual example, but to the first (empty) page.
The strange thing is that one can cure this by inserting a “\noindent” before the itemize, so
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{amsart}
\usepackage{hyperref}
\newtheorem{example}{Example}
\begin{document}
\ \newpage
\begin{example}\label{ex}
\begin{itemize}
\item
\end{itemize}
\end{example}
\ref{ex}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
works as it should.
-- comment 1:
Sorry, the second code example in the error description is the same as the first one, instead it should have been the first one with a "noindent" added, i.e.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{amsart}
\usepackage{hyperref}
\newtheorem{example}{Example}
\begin{document}
\ \newpage
\begin{example}\label{ex}\noindent
\begin{itemize}
\item
\end{itemize}
\end{example}
\ref{ex}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%