3

In the following MWE, the section number is reset at the beginning of each chapter. If, in the ToC, you click S4 it goes to S1, which is wrong. Both S4 and S1 have the same page number. The same thing happens in the second chapter's minitoc. Is there a way to make sure the links only point to the corresponding section of the same chapter despite the fact the sections have the same page number?

\documentclass{book}

\usepackage{minitoc}

\usepackage{hyperref}

\begin{document}
\dominitoc

\tableofcontents

\chapter*{Test 1}
\mtcaddchapter[Test 1]
\pagenumbering{arabic}
\minitoc

\section{S0}
\clearpage

\section{S1}
\clearpage

\section{S2}


\chapter*{Test 2}
\setcounter{section}{0}
\mtcaddchapter[Test 2]
\pagenumbering{arabic}
\minitoc

\section{S3}
\clearpage

\section{S4}
\clearpage

\section{S6}

\end{document}
  • Do this and this help in any manner? A little pressed to explore a complete solution. I see that you have already implemented the first one. About the second one, I get the same warning when I run your code. So, it might worth exploring. – Masroor Nov 18 '13 at 1:56
  • Those links are for figures. In the above MWE, there are no figures. It is not clear why clicking on S3, S4 and S6 ends up on S0, S1, and S2, respectively. Irrespective of clicking in the ToC or minitoc. – Reza Nov 18 '13 at 10:00
  • @Reza Sections S3, S4 and S5 have the same number as the corresponding sections S0, S1 and S2 (because the chapter number remains 0 after unnumbered chapters). Hyperref builds the destination names from these numbers. Thus you get a warning about duplicate destination names and only the first ones are active. (The same happens with pages, because you start the numbering over at the start of the second chapter.) One solution is to load hyperref with the option hypertexnames=false. This may cause problems with other of hyperref's facilities. – Dan Nov 18 '13 at 22:26
  • @Dan It works perfectly fine now with hypertexnames=false – Reza Nov 18 '13 at 23:09
  • @Dan Make that an answer, please. – lockstep Dec 5 '13 at 20:34
3

Sections S3, S4 and S5 have the same number as the corresponding sections S0, S1 and S2 (because the chapter number remains 0 after unnumbered chapters). Hyperref builds the destination names from these numbers. Thus you get a warning about duplicate destination names and only the first ones are active. (The same happens with pages, because you start the numbering over at the start of the second chapter.) One solution is to load hyperref with the option hypertexnames=false. This may cause problems with other of hyperref's facilities.

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.