This is a followup question on hyperlink inside chapter / section title in respect to the display in the TOC and bookmarks section of the resulting pdf.
\documentclass[twoside]{book}
\usepackage[pdftex,pagebackref=true]{hyperref}
\begin{document}
\tableofcontents
\chapter{documentation for link to Section 1}
\chapter{documentation for link to \mbox{\protect\hyperlink{sec1}{Section 1}}}
\chapter{documentation for link to \hyperref[sec1]{Section 1}}
\hypertarget{sec1}{}\section{Section 1 Reference}
\label{sec1}\index{ref1@{ref1}}
\hypertarget{sec2}{}\section{Section 2 Reference}
documentation for \hyperlink{sec1}{Section 1}
\end{document}
This results in the contents page:
and a Bookmark section:
In the contents page we see for chapter 2 and 3 (\protect
and \hyperref
implementation) an extra vertical red bar before the "Section 1" text, this is a an extra hyperref when clicking on "documentation for link" we jump to the relevant chapter, but wen clicking on the "Section 1" part we jump to the subsection. I think that in the the TOC part it is not good that depending on where one clicks on the line a different jump is made.
Looking at the bookmarks section we see here for the chapters 2 and 3 the texts "sec1Section" and "[sec1]Section" so with extra "sec1" and "[sec1]".
How can I get a "clean" TOC / Bookmarks part?
\chapter[documentation for link to Section 1]{<full title>}
? – barbara beeton May 31 '18 at 14:18book
class. but some document classes do things differently, and it's worth knowing that that's the case. – barbara beeton May 31 '18 at 15:56