5

When using starred sections in a double page layout, in order to get the table of contents refer to the correct place, it is usually advised to use the method

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Introduction}
\chapter*{Introduction}

Yet this creates a blank page if the page is not odd numbered. In my case, I want to have two starred sections side by side and correctly referenced by the TOC and hyperref. Is there an easy way to achieve this ?

Edit : Sorry for the lack of precisions. I am working with the book class, and here is an example of this problem:

\documentclass{book}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Left Side}
\chapter*{Left side}
\end{document}

The link to Left Side refers to the wrong page, clearing two pages instead does the trick but that's what I am trying to avoid.

  • What \documentclass are you using? – Werner Apr 4 '14 at 19:20
  • I just use \chapter* followed by the \phantomsection and the \addcontentsline. In memoir at least the \chapter* clears the page if necessary. – bombcar Apr 4 '14 at 19:22
  • Could you please post a complete minimum (working) example with several pages in it illustrating the problem. It would help the solvers to get fast into your problem. – Malipivo Apr 4 '14 at 19:24
  • 5
    The important point is that \phantomsection goes to the very same page, where the chapter title is set. If \chapter internally uses \cleardoublepage, then you need \cleardoublepage. Otherwise \clearpage or \newpage (if there are not pending floating objects) suffices. – Heiko Oberdiek Apr 4 '14 at 19:27
  • Oh right thank you for this comment Heiko. Now I realize how stupid this question was. The chapter environment clears two pages anyway, so the solution lies there, not within hyperref or something like that – Arnaud Apr 6 '14 at 20:33
1

Just use \clearpage rather than \cleardoublepage:

enter image description here

\documentclass[twoside]{report}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\clearpage
\phantomsection
\chapter*{Left side}
\addcontentsline{toc}{chapter}{Left Side}
\clearpage
\phantomsection
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}
\end{document}
  • This does not seem to work with the book class, the hyperlink sends to the wrong page. – Arnaud Apr 6 '14 at 17:40
  • @Arnaud: Please see the update... – Werner Apr 7 '14 at 4:48
  • this is not very satsifying either, as the hyperlink goes directly after the chapter title (i.e. the chapter title is cut out). As I was saying in a comment to the main question though, I realize that the question is off the mark now, since the cleardoublepage is present in the chapter environment anyway, so there is no reason not to use /cleardoublepage. – Arnaud Apr 7 '14 at 12:12
  • @Arnaud: When I compile the above MWE, the \phantomsection hyperlinks point to the top of the text block on the chapter page (exactly where it is supposed to be), making the title clearly visible. – Werner Apr 7 '14 at 14:12
  • This is weird, when I compile it the hyperlink goes just under the Left side (I am using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) ) – Arnaud Apr 7 '14 at 15:01

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.