1

In the MWE below, the first and second references link to eq. (I.1), and the third and fourth equation references both link to eq. (2.1). While they should link to eq. (I.1), (1.1), (II.1) and (2.1), respectively.

What causes this error here?

\documentclass[10pt,a4paper,openany]{book}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}

\usepackage[colorlinks,citecolor=blue,urlcolor=blue,linkcolor=blue,pdfencoding=auto, psdextra]{hyperref}
\usepackage[nameinlink]{cleveref}

\begin{document}

\numberwithin{equation}{part}
\part{I}
\begin{equation}
\label{eq:I_1}
a = b
\end{equation}

\numberwithin{equation}{chapter}
\chapter{I}
\begin{equation}
\label{eq:chap_1}
a = part 1
\end{equation}

\numberwithin{equation}{part}
\part{II}
\begin{equation}
\label{eq:II_1}
a = chap 1
\end{equation}

\numberwithin{equation}{chapter}
\chapter{2}
\begin{equation}
\label{eq:chap_2}
a = chap 2
\end{equation}


\cref{eq:I_1}, \cref{eq:chap_1}, \cref{eq:II_1}, \cref{eq:chap_2}.

\end{document}
2

hyperref interally names the links after your \numberwithin commands as equation.\theHpart.\arabic{equation} and equation.\theHchapter.\arabic{equation}. As \theHpart is defined as \arabic{part} and \theHchapter as \arabic{chapter} this leads to duplicated destination names. So you get warnings in the log:

l.102 \begin{equation}
                      pdfTeX warning (ext4): destination with the same identifi
er (name{equation.2.1}) has been already used, duplicate ignored
<to be read again> 

One solution is e.g. to change \theHpart so that an unique destination is created:

 \renewcommand\theHpart{\Roman{part}}

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.