# “destination with the same identifier” warning with shared counters, cleveref and amsart

The following mwe

\documentclass{amsart}

\usepackage{hyperref}
\usepackage{cleveref}

\newtheorem{theorem}{Theorem}
\newtheorem{proposition}[theorem]{Proposition}

\begin{document}

\begin{proposition}
\end{proposition}

\end{document}


produces the warning

pdfTeX warning (ext4): destination with the same identifier (name{theorem.1}) has been already used, duplicate ignored


A similar issue exists on replacing \newtheorem with \declaretheorem from thmtools. The ordering of the three packages was chosen based on the answer to Disabling "destination with the same identifier" with package silence, and the cleveref manual

What is causing the warning and how do I fix it? Is it possible for this to cause misdirected links in a more non-trivial document? If not, then I'm happy to ignore the warning.

Because of Sigur's comment, I'm adding the versions of the relevant packages. I'm using an updated MikTeX install.

Document Class: amsart 2015/03/04 v2.20.2
Package: hyperref 2012/11/06 v6.83m Hypertext links for LaTeX
Package: cleveref 2013/12/28 v0.19 Intelligent cross-referencing

• On that post you cited, @egreg says: You can also check that the links are correctly formed. So I think that it is OK. – Sigur Jun 18 '15 at 8:05
• @Sigur but he says that only after the fix. And in any case, I'm not sure that the same thing applies to this case, since simple reorderings did not fix the issue. – ronno Jun 18 '15 at 8:43
• I can not reproduce your problem. Here using TeXlive 2015 on Linux does not show any problem. – Sigur Jun 18 '15 at 8:58
• The difference is in the class used: with article we can load amsthm after hyperref, with amsart the code of amsthm is already in the class and the package is not loaded. – egreg Jun 18 '15 at 8:58
• @egreg Removed amsthm to make the mwe minimal. Is there a better solution than not using amsart or ignoring the warnings? Is there a chance of misformed links? – ronno Jun 18 '15 at 9:37

The answer I gave to Disabling "destination with the same identifier" with package silence doesn't apply here, because the amsart class disables loading amsthm and provides the equivalent code, so it's not possible to apply the method of loading amsthm after hyperref.

Here's a hack that allows loading amsthm in the right position, but that defies the changes amsart makes to the standard theorem styles, so this might be rejected if you want to submit the document to the AMS.

\documentclass{amsart}

\expandafter\let\csname ver@amsthm.sty\endcsname\relax
% remove the definitions that will be redone by amsthm
\let\theoremstyle\relax
\let\newtheoremstyle\relax
\let\pushQED\relax
\let\popQED\relax
\let\qedhere\relax
\let\mathqed\relax
\let\openbox\relax
\let\proof\relax\let\endproof\relax

\usepackage{hyperref}
\usepackage{amsthm}
\usepackage{cleveref}

\newtheorem{theorem}{Theorem}
\newtheorem{proposition}[theorem]{Proposition}

\begin{document}

\begin{proposition}
\end{proposition}

\end{document}


Other hacks are necessary for getting back at least the correct spacings.

\documentclass{amsart}

\expandafter\let\csname ver@amsthm.sty\endcsname\relax
% remove the definitions that will be redone by amsthm
\let\theoremstyle\relax
\let\newtheoremstyle\relax
\let\pushQED\relax
\let\popQED\relax
\let\qedhere\relax
\let\mathqed\relax
\let\openbox\relax
\let\proof\relax\let\endproof\relax

\usepackage{hyperref}
\usepackage{amsthm}
\usepackage{cleveref}

\makeatletter
\newtheoremstyle{standard}% name
{6\p@\@plus6\p@\relax}%      Space above
{6\p@\@plus6\p@\relax}%      Space below
{\itshape}%         Body font
{}%         Indent amount (empty = no indent, \parindent = para indent)
{ }%     Space after thm head: " " = normal interword space;
%       \newline = linebreak
{}%         Thm head spec (can be left empty, meaning normal')
\makeatother

\theoremstyle{standard}
\newtheorem{theorem}{Theorem}
\newtheorem{proposition}[theorem]{Proposition}

\newcommand{\testA}{words words and other words }
\newcommand{\testB}{\testA\testA\testA\testA\testA}

\begin{document}

\testB

\begin{proposition}\label{test}
\testA
\end{proposition}

\begin{proof}
\testB
\end{proof}

\testB

\begin{proof}
\testB
\end{proof}

\testB

\cref{test}

\end{document}
`
• Am I right in understanding that ignoring this warning is safe, in the sense that the links will have the expected destinations? – ronno Jul 5 '15 at 3:48
• @ronno No, the warning means they haven't. – egreg Jul 5 '15 at 9:15
• I've noticed that the above solution causes uneven spacing around theorem environments and proof environments. – Dan Christensen Jan 19 '18 at 18:45
• @DanChristensen Yes, one should also define a theorem style with explicit spacing. But It's piling up hacks, I'm afraid. I added an example. – egreg Jan 19 '18 at 21:31
• Thanks. Any idea whether its possible to instead hack cleveref to be able to handle amsart's theorem environments without getting confused? In fact, rather than a hack, such a change could become part of cleveref... – Dan Christensen Jan 20 '18 at 1:42