pdfTeX warning: destination with same identifier has been already used, duplicate ignored (weird behavior)

Here is a minimal example:

\documentclass{amsart}

\usepackage{amsthm}
\usepackage[pdftex]{hyperref}

\newtheoremstyle{myexercise}{\baselineskip}{\baselineskip}{}{}{\bfseries}{.}{ }{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}
\newtheoremstyle{mypart}{\baselineskip}{\baselineskip}{}{}{\bfseries}{}{\newline}{\thmname{#1}\thmnumber{ #2}\thmnote{ -- #3}}

\theoremstyle{myexercise}
\newtheorem{Exo}{Exercise}
\theoremstyle{mypart}
\newtheorem{Part}{Part}[Exo]
\renewcommand*\thePart{\Roman{Part}}

\begin{document}
\begin{Exo}[A cool exercise]
\begin{Part}
\label{p:ex1:I}
Prove that $1=0$.
\end{Part}
\begin{Part}
Deduce from Part~\ref{p:ex1:I} that this exercise is wrong.
\end{Part}
\end{Exo}

\begin{Exo}
\begin{Part}
Let $a=b$. Deduce that $0=0$.
\end{Part}
\begin{Part}
Let $a=42$. For what values of $b$ do we have $a=b$?
\end{Part}
\end{Exo}
\end{document}

The warning I get is the following:

pdf TeX warning (ext4): destination with the same identifier (name{Part.1.1}) has b een already used, duplicate ignored

\AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi l.35 \end{document} pdfTeX warning (ext4): destination with the same identifier (name{Part.2.1}) has been already used, duplicate ignored

\AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi l.35 \end{document} ] (./TestHyperref.aux) )

This looks like a strange behavior to me. Or have I done anything wrong?

Besides, the error completely disappears if I use, e.g., enumerates inside the Part environment, as in

...
\begin{Part}
\begin{enumerate}
\item Prove that $1=0$.
\end{enumerate}
\end{Part}
...

Also, there's no error if I remove the hyperref package. Unfortunately, I need to use hyperref.

Any idea?

• Note that this is not an error, only a warning. Actually, as long as you have only one reference to a part, there won't be a problem. Only if you have a reference to e.g. Part I in Exercise 1 and Part I in Exercise 2, the hyperlinks that hyperref creates will point to the same target. Commented Mar 10, 2011 at 14:44
• @Michael Indeed, and the weirdest is that the warnings disappear altogether when I put an enumerate environment inside the Part (which is what I almost always do, since there are usually numbered questions in Parts). Commented Mar 10, 2011 at 14:52

try

\usepackage[hypertexnames=false]{hyperref}
• Thank you! That is the only thing that worked for me! Commented Mar 29, 2019 at 7:16
• Thank you! small change, big result Commented Aug 24, 2019 at 21:14
• This works to solve an issue with renaming equations while using hyperref as well. This is the only thing that worked. Commented Mar 28, 2021 at 22:07

It's possible to use nested theorems with article.cls and ntheorem, now the problem seems to come from a conflict between amsart and hyperref. ntheorem has an option to avoid compatibility with hyperref.

\documentclass{article}
\usepackage[pdftex]{hyperref}
\usepackage[hyperref]{ntheorem}

\newtheorem{Exo}{Exercise}
\newtheorem{Part}{Part}[Exo]
\renewcommand*\thePart{\Roman{Part}}

\begin{document}
\begin{Exo}[A cool exercise]
\begin{Part}
\label{p:ex1:I}
Prove that $1=0$.
\end{Part}
\begin{Part}
Deduce from Part~\ref{p:ex1:I} that this exercise is wrong.
\end{Part}
\end{Exo}

\begin{Exo}
\begin{Part}
Let $a=b$. Deduce that $0=0$.
\end{Part}
\begin{Part}
Let $a=42$. For what values of $b$ do we have $a=b$?
\end{Part}
\end{Exo}
\end{document}

The problem seems to be between amsartand hyperref.

• Thanks for your answer. I'm actually using (a modification of) the amsbook class. I don't quite understand why nesting several theorem environments should be a problem, since these environments are (supposedly from what I read from the LaTeX Companion) lists... Commented Mar 10, 2011 at 14:34
• @gniourf-gniourf: Yes it's possible to nested theorem environments. I try my example with amsart and I get the chaos. So I'm perplex, I don't know amsart.cls and I suppose this class defines some theorem environments. I try my example with scrartcl.cls and it's fine Commented Mar 10, 2011 at 14:51
• @gniourf-gniourf: In amsart.clsyou can find this : \renewcommand{\newtheorem} .... The class modifies newtheorem and perhaps` there is a little conflict between the class and hyperref. It's only a warning but it would be good to know why ! Commented Mar 10, 2011 at 14:59

After a lot of search, I finally found a simple solution: load hyperref before any ams package. Replacing the amsart document class by article class and pulling the hyperref package above the amsthm one solved my problem.

It does not always work, though. It can reduce the number of such warnings, and in some cases make them disappear.

For those who do want to use the amsart class that is still not a solution, though...

I had this problem (seemingly) and found that the cause was not having loaded the siunitx package. I don't know why it had that effect, but it did.