I have the warning
destination with the same identifier (name{xtheorem.1}) has been already used, duplicate ignored \relax l.31 \begin{definition}[DefinitionInChapterTwo]
Although there are many questions about "destination with the same identifier", I could not find one according to the identifier xtheorem
.
The problem only occurs when I use \begin{definition}
in more than one chapter so I think within one chapter, the identifiers are unique but not in the whole document...
Here is my MWE:
\documentclass[twoside, openright, 12pt]{book}
\usepackage[plainpages=false,pdfpagelabels]{hyperref}
\usepackage[titles]{tocloft}
\newlistof[chapter]{theorems}{lthm}{\theoremsname}
\newcommand\addtotheorems[2]{
\refstepcounter{theorems}
\addcontentsline{lthm}{theorems}{\protect\numberline{\thetheorems}\textbf{#1:} #2}
}
\usepackage{shadethm}
\newshadetheorem{xtheorem}{Satz}[chapter]
\newshadetheorem{xdefinition}[xtheorem]{Definition}
\newenvironment{definition}[1][]{%
\addtotheorems{Definition}{#1}
\begin{xdefinition}[#1]%
}{\end{xdefinition}}
\begin{document}
\chapter{Title1}
\section{Section 1-1}
\begin{definition}[DefinitionInChapterOne]
\end{definition}
\chapter{Title2}
\section{Section 2-1}
\begin{definition}[DefinitionInChapterTwo]
\end{definition}
\end{document}
Could you please tell me where I have to make changes to get this issue working?
Update: I figured out that it has something to do with line \newshadetheorem{xtheorem}{Satz}[chapter]
This gives me (chapter number).(counter per chapter). But in my mind, this is unique!?! Isn't it?
If I change chapter
to section
, I got a theorem number like 1.1.1 what obviously means (chapter number).(section number).(counter per section)