I am writing happily on my thesis with latex but found a problem with glossaries package returning wrong page number reference links in the glossaries index.

Instead of referencing page 5, the glossary index points to page 3 with memoir, with book class, the difference is only one page.

After quite some tests and trials I found the minimum requirements for reproduction on my system - hope you can reproduce them, too. Please excuse the large number of chapters and sections but it seems necessary that the TOC spans more than one page for the number issue to show up.

The problem both shows up with standard book class as well as memoir class. Both need the a4paper option enabled for this problem to occur.

Here you find the MWE together with notes on the requirements. Here a link to the pdf file I created using texstudio: pdf file using memoir class and the tex file.

%\documentclass[12pt,a4paper,openany]{book} % for book class, both a4paper and openany must be given as parameters for the bug to show up
\documentclass[12pt,a4paper]{memoir} % for memoir, only a4paper is necessary; but the bug only shows up, when a title page is there with a pagebreak afterwards 
\usepackage[bookmarks, colorlinks]{hyperref}

\newglossaryentry{test}{name={Testing test},description={test description},first={Test (test)}}

\title{Test} % titepage and pagebreak are only necessary for reproducing the bug with memoir class

\tableofcontents{} % needed lots of chapter because the wrong number only shows up when the toc is longer than one page

\chapter{chapter 1}
\section{title 2 - possibly with a very very long title creating a new line indeed}
\section{title 3}
\chapter{chapter inbetween}
\section{title 5}
\section{title 6}
\section{title 8}
\chapter{chapter 2}
\section{title 10 - possibly with a very very long title creating a new line indeed}
\section{title 11}
\section{title 12 - possibly with a very very long title creating a new line indeed}
\section{title 13}
\chapter{chapter 3}
\section{title 15}
\chapter{chapter 4}
\section{title 17}
\section{title 18 - possibly with a long title creating a new line}
\chapter{chapter 5}
\chapter{chapter 6}
\section{title 21}
\section{title 22}
\section{title 23}

In TexStudio I use the following build sequence, in case that is relevant:

txs:///latex | txs:///latex | txs:///latex | txs:///makeglossary | txs:///latex | txs:///bibtex | txs:///latex | txs:///quick

Probably a bit too often running latex but as far as I understand that can only help, no?

Hope you can help me with this problem, since I love the ease of using LaTeX otherwise :)

If you need anything else, tell me please!

  • I can’t reproduce this problem with TeX Live 2012.
    – mhp
    Commented Sep 26, 2012 at 11:52
  • 1
    Welcome to TeX.SX! I get a reference to page 5 with memoir and to page 4 with book, which is expected, because you're passing the openany option to book. The glossary term falls anyway in the referenced page. What TeX distribution are you using?
    – egreg
    Commented Sep 26, 2012 at 11:54
  • Just checked the version: Was using TeX, Version 3.1415926 (TeX Live 2009/Debian) - coming with Ubuntu 12.04. So I'll try updating my distribution first and then report back if the problem persists. Thanks!
    – prunus
    Commented Sep 26, 2012 at 21:54
  • Finally managed to update Ubuntu to TeX Live 2012 - indeed the numbers there are correct, thank you! There are some other issues now with the new version of course (mostly bibliography and hyperref related... ) but this issue is solved :D Thanks a lot!
    – prunus
    Commented Sep 27, 2012 at 22:23

1 Answer 1


It is possible (but I don't see it in this MWE) to need to run

latex latex makeglossary bibtex latex latex makeglossary latex 

as after you run makeglossary and then latex the glossary will be included in the document which can change the table of contents and if you are unlucky make it take an extra page and so change the page numbers in the whole document so invalidating the glossary first generated similarly running bibtex causes the bibliography section to be added which makes the table of contents longer.

Your MWE works for me in texlive 2012 if I add \listfiles to the preamble I get the list below, you might want to check your versions

 *File List*
  memoir.cls    2011/03/06 v3.6j configurable book, report, article document cl
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
  ifetex.sty    2011/12/15 v1.2 ifetex
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
   mem12.clo    2010/10/19 v0.4b memoir class 12pt size option
mempatch.sty    2009/07/24 v6.0f Patches for memoir class v1.6180339
inputenc.sty    2008/03/30 v1.1d Input encoding file
  latin1.def    2008/03/30 v1.1d Input encoding file
hyperref.sty    2012/05/13 v6.82q Hypertext links for LaTeX
hobsub-hyperref.sty    2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/05/28 v1.13 Construct package bundles (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/05/13 v6.82q Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2006/04/12  ver 3.3  Verb mode for urls, etc.
memhfixc.sty    2010/08/17 v1.15 nameref/hyperref package fixes for memoir clas
 hpdftex.def    2012/05/13 v6.82q Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
glossaries.sty    2012/05/21 v3.02 (NLCT)
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
 xkeyval.sty    2008/08/13 v2.6a package option processing (HA)
 xkeyval.tex    2008/08/13 v2.6a key=value parser (HA)
mfirstuc.sty    2012/05/21 v1.06 (NLCT)
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
    xfor.sty    2009/02/05 v1.05 (NLCT)
  amsgen.sty    1999/11/30 v2.0
glossary-hypernav.sty    2007/07/04 v1.01 (NLCT)
glossary-list.sty    2011/03/28 v3.0 (NLCT)
glossary-long.sty    2011/03/28 v3.0 (NLCT)
longtable.sty    2004/02/01 v4.11 Multi-page Table package (DPC)
glossary-super.sty    2011/03/28 v3.0 (NLCT)
supertabular.sty    2004/02/20 v4.1e the supertabular environment
glossary-tree.sty    2011/03/28 v3.0 (NLCT)
   color.sty    2005/11/14 v1.0j Standard LaTeX Color (DPC)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
 nameref.sty    2010/04/30 v2.40 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
  • Thank you for the suggestion. I just tested the two things with the MWE: 1. using the build process you explained: latex latex makeglossary bibtex latex latex makeglossary latex did not correct the wrong pagenumber. 2. Removing the toc parameter from \usepackage[toc]{glossaries} The toc is already too long for one page without the glossary mentioned in it. Likely for that the resulting pagenumber is still wrong. Can you test my MKE if it gives the same result for you as well? It could be environment or version related, if I am unlucky ;) Thanks in any case for the answer!
    – prunus
    Commented Sep 26, 2012 at 21:51
  • just tried your MWE with texlive2012 latex latex makeglosaries latex gives a correct glossary reference to page 5 I then added \listfiles I'll put the result in an answer as too long for comment Commented Sep 26, 2012 at 22:22
  • texlive2012 with your command chain does now for me return the correct numbers as well both for memoir and book class. The hyperlinks are not clickable anymore with texlive 2012 but that is another issue I will have to look into :) Thanks a lot for your suggestions!
    – prunus
    Commented Sep 27, 2012 at 22:20
  • Solved a 10 hour search for me, thank you!
    – Gal
    Commented Feb 23, 2015 at 15:26

You must log in to answer this question.

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