hyperref icon indicating copy to clipboard operation
hyperref copied to clipboard

error when combining hyperref, amsart and itemize within theorem

Open kberry opened this issue 9 years ago • 1 comments

(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} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

kberry avatar May 18 '16 18:05 kberry

Hm. Yes, amsart redefines newtheorem and the hyperref code fails. But I'm inclined to say that this should be reported to the amsart maintainer.

u-fischer avatar Sep 16 '19 14:09 u-fischer