Strange side effect on bookmarks in hyperref

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Strange side effect on bookmarks in hyperref

Daniele Giorgio Degiorgi
In a document, if I use

 

\input{A1}

\input{A2}

\input{A3a}

\input{A3b}

\input{A4}

 

Where each Ax contains a chapter, I get the chapters numbered 1,2,3,4,5.
Trying to get the chapters numbered 1,2,3a,3b,4 I used

 

\input{A1}

\input{A2}

\let\savethechapter\thechapter

\def\thechapter{\arabic{chapter}a}

\input{A3a}

\setcounter{chapter}{2}

\def\thechapter{\arabic{chapter}b}

\input{A3b}

\let\thechapter\savethechapter

\input{A4}

 

Now almost all works as I want (chapter heading, sections and subsection
numbering and content) but in the bookmarks, starting with the 2. Section on
chapter 3a the indenting is wrong, that is each new section is added in the
bookmarks at the right of the preceding one.

I could find out that the problem comes from resetting chapter number and
solved the redefine \thechapter and \thesection with small effort, as in my
case \chapter and \section are inside other macros.

 

I just wonder if there is a safe possibility to reset chapter numbers while
using hyperref.

 

Daniel

 

 

------------------------------------------------------------------------------
_______________________________________________
Q: How can I leave the mailing list?
A: See http://docs.miktex.org/faq/support.html#leavingml
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange side effect on bookmarks in hyperref

Ulrike Fischer-2
Am Sun, 31 Jul 2016 12:00:37 +0200 schrieb Daniele Giorgio Degiorgi:

> In a document, if I use

This is not a miktex specific question, you should ask such
questions e.g. on tex.SX

> \input{A1}

Why do you make it so difficult for other to test and reproduce your
problem? The \input are completly irrelevant.

 
> I just wonder if there is a safe possibility to reset chapter numbers while
> using hyperref.

You need to change the hyperref counter representation two so that
hyperref can set unique links.

\listfiles
\documentclass{book}
\usepackage{hyperref}

\begin{document}
\chapter{A1}

\chapter{A2}

\let\savethechapter\thechapter
\let\savetheHchapter\theHchapter
\def\thechapter{\arabic{chapter}a}
\def\theHchapter{\arabic{chapter}a}
\chapter{A3a}
\section{blub}
\section{blub}

\setcounter{chapter}{2}

\def\thechapter{\arabic{chapter}b}
\def\theHchapter{\arabic{chapter}b}
\chapter{A3b}
\section{blub}
\section{blub}
\let\thechapter\savethechapter
\let\theHchapter\savetheHchapter

\chapter{A4}

\end{document}

--
Ulrike Fischer
http://www.troubleshooting-tex.de/


------------------------------------------------------------------------------
_______________________________________________
Q: How can I leave the mailing list?
A: See http://docs.miktex.org/faq/support.html#leavingml
Loading...