[Tex/LaTex] Override page number in TOC because link goes to wrong page

linkspage-numberingtable of contents

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.

Best Answer

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}]        
Related Question