5

I'm using the following general outline in book class:

\mainmatter
    \include{introduction}

    \part{...}
        \include{chapter1}
        ...

    \part{...}
        ...
        \include{conclusions}

\addcontentsline{toc}{part}{\appendixtocname}
\appendixpage
\appendix
    \include{...}

\backmatter
    % Glossary
    \cleardoublepage
    \addcontentsline{toc}{chapter}{Nomenclature}
    \markboth{Nomenclature}{Nomenclature}
    \makenomenclature
    \input{nomenclature}
    \printnomenclature[4.5cm]

    % Bibliography / References
    \cleardoublepage
    \addcontentsline{toc}{chapter}{References}
    \bibliographystyle{amsalpha}
    \renewcommand{\bibname}{References}
    \bibliography{thesis}

But a lot of things comes wrong in the final PDF, among them:

  1. Appendices appear as childs of last section in the last chapter.
  2. Clicking on Nomenclature and References bookmarks sends to the wrong page.
  3. Despite these problems, the page numbers in TOC are right.

Help?

lockstep
  • 250,273

3 Answers3

8

I guess you're using hyperref. If you would modify your question and extend your code to show a compilable minimal example, it would make helping easier.

Sectioning commands cause hyperref to create bookmarks. However, if you use starred sectioning commands like nomencl and \bibliography implicitely do (\chapter* or section*), and create the bookmarks by \addcontentsline, you have to set an anchor for hyperref. The needed command is \phantomsection. The anchor must fall onto the correct page, so use it after \cleardoublepage like this:

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{amsalpha}
\renewcommand{\bibname}{References}
\bibliography{thesis}

Do it similar each time you call \addcontentsline followed by a non-numbered chapter or section.

For the nesting issue, to put the bookmarks to the root level, frabjous provided the correct solution in his answer.

Stefan Kottwitz
  • 231,401
8

Another thing to try is the \bookmarksetup{startatroot} command from the bookmark package to make the next entry go back to the root rather than act as a child of the previous one. The package has some other options that might interest you. I agree that \phantomsection is the answer to the links going to the wrong page.

frabjous
  • 41,473
  • Is there a way to accept two answers? :-) Yours solved my problem of "nesting". Stefan's solved my problem of wrong link. – Hugo Sereno Ferreira Sep 04 '10 at 21:46
  • 1
    @Hugo: perhaps post two separate questions next time ;-) if you have got two problems which might be different even if they were related. Btw. I will edit my answer to point to frabjous answer so that his solution to the nesting issue could be found easily. – Stefan Kottwitz Sep 05 '10 at 07:34
1

Something must have gone wrong in the class you are using. Under the appendix definition you should have this:

\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@Alph\c@chapter}
  \renewcommand{\chaptertitlename}{\appendixstring}

The code resets the chapter and section and subsection counters to represent an Appendix. What class are you using?

yannisl
  • 117,160