# [Tex/LaTex] pdfTeX warning: destination with same identifier has been already used, duplicate ignored (weird behavior)

amsartamsthmcountersenvironmentshyperref

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
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

\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?

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.