5

I have an issue where my TOC declares my document's glossary on page xiv when the actual list of abbreviations starts on page xiii and ends on page xiv.

The relevant part of the TOC is as follows:

\tableofcontents

    % Print glossary.              
    \glsaddall       
    \printglossary[type=acronym,title={List of Abbreviations}]        
    \addcontentsline{toc}{chapter}{List of Abbreviations}
    % \printglossaries%[title={List of abbreviations}]

    % Print algorithms.
    \clearpage
    \phantomsection
    \addcontentsline{toc}{chapter}{List of Algorithms}
    \listofalgorithms
    \setcounter{chapter}{0}

    % Print figures.
    \clearpage
    \phantomsection
    \addcontentsline{toc}{chapter}{List of Figures}
    \listoffigures

    % Print tables.
    \clearpage
    \phantomsection
    \addcontentsline{toc}{chapter}{List of Tables}
    \listoftables

    % Page headers and other elements in 'fancy' style.
    \input{Formatting}

    \clearpage

    % CONTENTS. ---------------------------------------------------------------------------------------

    \pagenumbering{arabic} % Force page numbering in Arabic to exclude the List of Tables.

And every other link in the TOC goes to the correct page.

Does anyone have any idea as to why this is? Or can I manually set the page number for the glossary?

I am unable to supply an MWE in this case although I can say that the above works correctly in a dummy document but I can't see why it fails in the main document.

6
  • \clearpage\phantomsection?
    – cfr
    Commented Jan 6, 2015 at 3:09
  • But where exactly?
    – Mr Morgan
    Commented Jan 6, 2015 at 3:10
  • 1
    It's the same pattern: clear the page; insert the phantom; add to ToC; print the list. It doesn't matter which list it is!
    – cfr
    Commented Jan 6, 2015 at 3:11
  • 1
    If double-sided, use \cleardoublepage.
    – cfr
    Commented Jan 6, 2015 at 3:12
  • Do you want to present this as a solution. I think everything is alright now given a rearranging of the relevant code?
    – Mr Morgan
    Commented Jan 6, 2015 at 3:20

2 Answers 2

2

You just need to follow the same pattern as you do for the other lists:

\clearpage% \cleardoublepage for two-sided
\phantomsection
\addcontentsline...
\commandwhichprintslist...

So:

\glsaddall       
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Abbreviations}
\printglossary[type=acronym,title={List of Abbreviations}]        
1
  • @MrMorgan You're welcome. Though you seemed to have the answer already... ;).
    – cfr
    Commented Jan 6, 2015 at 3:30
4

The right way to have a glossary generated by the glossaries package in the ToC, is not to add a line like

\addcontentsline{toc}{chapter}{List of Abbreviations}

but simply to add the option toc to the glossaries package at loading time, e.g.

\usepackage[toc,........]{glossaries}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .