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}
5
  • 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
    Commented Nov 18, 2013 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
    Commented Nov 18, 2013 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
    Commented Nov 18, 2013 at 22:26
  • @Dan It works perfectly fine now with hypertexnames=false
    – Reza
    Commented Nov 18, 2013 at 23:09
  • @Dan Make that an answer, please.
    – lockstep
    Commented Dec 5, 2013 at 20:34

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .