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?
Best Answer
It's possible to use nested theorems with
article.cls
andntheorem
, now the problem seems to come from a conflict betweenamsart
andhyperref
.ntheorem
has an option to avoid compatibility withhyperref
.The problem seems to be between
amsart
andhyperref
.