1

I am using the Legrand Orange Book as a template but for some reason, the links for my appendix are pointing to previous chapters. Here is my preamble:

\documentclass[11pt,fleqn]{book} 
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage[svgnames]{xcolor}
\definecolor{ocre}{RGB}{243,102,25} highlighting throughout the book
\definecolor{mygray}{RGB}{243,243,244}

%========================================================================================
%   Font Settings
%========================================================================================

\usepackage{avant} 
\usepackage{mathptmx} 
\usepackage{microtype} 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 

\usepackage{calc}

% Fonts
\usepackage{textcomp}

%========================================================================================
%   Bibliography
%========================================================================================

\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backend=biber]{biblatex}

\begin{document}

%========================================================================================
%   CHAPTERS
%========================================================================================

\include{Chapters/Chapter1}
\include{Chapters/Chapter2}
\include{Chapters/Chapter3}
\include{Chapters/AppendixA}
\include{Chapters/AppendixB}
\include{Chapters/AppendixC}

\end{document}

I wanted to sperate out my Appendix into different chapters so I went with the approach above. Could somebody tell me why my hyperlinks for the Appendix point to previous chapters? For example, when I click on the Appendix A link in the ToC, it takes me to chapter 1. Also, in the structure file related to this template, I have:

\usepackage{hyperref}
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=false,breaklinks=true,urlcolor= ocre,bookmarks=true,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}
  • 2
    You probably receive warnings in your .log about duplicate destinations... yes? – Werner Jun 8 '15 at 17:40
  • well, i'm pretty sure Werner's right that you have duplicate labeling going on, but it's impossible to say without a complete but minimal working example. right now, everything depends on what's actually behind those \include statements. – Sean Allred Jun 8 '15 at 18:56
  • The \appendix stuff resets the chapter number to 1 for the first appendix and the output format to A etc. This must confuse hyperref, unless hypertexnames=false option is used – user31729 Jun 8 '15 at 19:53
  • @Chritian Hupfer, your solution works. If I put the hypertexnames=false, the links point correctly now. Thanks. – Joe Jun 8 '15 at 20:01
  • 1
    @pluton: Answer added – user31729 Jan 5 '16 at 16:30
2

The MWE by the O.P. isn't compilable (some missing % characters etc., \included files we've no access to etc.)

There's neither hyperref loaded nor a \tableofcontents at all.

I can only guess, but I think that the O.P. uses \setcounter{chapter}{0} and \renewcommand{\thechapter}{\Alph{chapter}} right before the appendix chapter start instead of \appendix

This will confuse hyperref and force to redo the symbolic anchor chapter.1 (being the same for the real Chapter 1 and for Appendix A then)

One cheap solution is to provide \hypersetup{hypertexnames=false} -- this should be the last resort.

The better way is to provide a new anchor name for appendix chapters, say \renewcommand{\theHchapter}{appendixchapter.\arabic{chapter}} (the\theH...` commands provide the anchors!)

The best way is to use \appendix.

\documentclass{book}


\usepackage{hyperref}

\begin{document}
\tableofcontents

\chapter{Foo}
\setcounter{chapter}{0}
\renewcommand{\thechapter}{\Alph{chapter}}
\renewcommand{\theHchapter}{appendixchapter\arabic{chapter}}
\chapter{Foo appendix}

%\include{Chapters/Chapter1}
%\include{Chapters/Chapter2}
%\include{Chapters/Chapter3}
%\include{Chapters/AppendixA}
%\include{Chapters/AppendixB}
%\include{Chapters/AppendixC}

\end{document}

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.