2

I have got some problems with hyperref and theorems labeled by subsections: To get the theorems labeled correctly I manually reset the thm counter also at the beginning of new sections. But then I get problems with hyperref. Take for example

\documentclass[a4paper, 11pt] {article}
\usepackage{hyperref}

\newtheorem{thm}{Theorem}[subsection]
\newtheorem{prop}[thm]{Proposition}

\makeatletter
\@addtoreset{thm}{section}
\makeatother

\begin{document}
        \section{One} 
\subsection{Oneone} \label{ss11}
\begin{prop} \label{p1}         
\end{prop}

\subsection{twoone} 
\begin{prop} \label{p2}           
\end{prop}

Ref \ref{p1} and \ref{p2}.
\end{document}

This gives the warning:

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

I have already browsed the web and found some similar issue here but the answer does not apply in my case due to the \@addtoreset line.

Note that the problem does not occur if I either remove the \@addtoreset{thm}{section} or if there is just one subsection.

Thank you very much!

2

You need to make the internal counter of hyperref for thm \theHthm unique. E.g.

\documentclass[a4paper, 11pt] {article}
\usepackage{hyperref}

\newtheorem{thm}{Theorem}[subsection]
\newtheorem{prop}[thm]{Proposition}

\makeatletter
\@addtoreset{thm}{section}
\renewcommand\theHthm{\thesection.\thethm}
\makeatother

\begin{document}
        \section{One}
\subsection{Oneone} \label{ss11}
\begin{prop} \label{p1}
\end{prop}

\subsection{twoone}
\begin{prop} \label{p2}
\end{prop}

Ref \ref{p1} and \ref{p2}.
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.