4

I use the glossaries package to create a list of symbols. My problem is that not all symbols show up in the glossary. It follows a minimal (not) working example.

\documentclass[11pt,a4paper,twoside]{book}

\usepackage{amsmath} % assumes amsmath package installed
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{dsfont}
\usepackage[english,germanb]{babel}

\usepackage[xindy,nomain]{glossaries}


\newglossary[slg]{symbols}{sym}{sbl}{List of Symbols}
\makeglossaries

\newglossaryentry{symb:m}{%
type=symbols,
name={$m$},
text={m},
description={symb m}}

\newglossaryentry{symb:m2}{%
type=symbols,
name={$\widetilde{m}$},
text={\widetilde{m}},
description={symbol m2}}

\newglossaryentry{symb:f}{%
type=symbols,
name={$f(\cdot)$},
text={f},
description={This is a function}}

\begin{document}
    \chapter{Test}
    Here comes the first symbol: $\gls{symb:m}$; and now the second: $\gls{symb:m2}$. 

    Here is a function: $\gls{symb:f}(t)$.

    \printglossary[type=symbols, nonumberlist]

    %\glsaddall[types={symbols}]
\end{document}

In total three symbols are defined which are also referenced in the test chapter. Compiling this will only list two symbols: m and f. \widetilde{m} is missing though it should be there. Also, if one uncomments the \glsaddall the result doesn't change. If I change the name of the symbol entry for \widetilde{m}, it does work. But of course this yields a wrong symbol. It seems the glossaries package has a problem with widetilde. Is this the case and if so, is there a workaround?

  • Add a sort key. xindy ignores \widetilde and the sort becomes just m but there's already an entry with that sort key. (I think this may be a duplicate. I think I've seen a similar question.) – Nicola Talbot Feb 11 '15 at 22:01
  • @NicolaTalbot: Most likely this has been asked before. Unfortunately I wasn't able to find anything. Your answer is correct. I'd like to select it as the correct answer if you post your reply as an answer. Thank you! – guest123 Feb 12 '15 at 5:03
  • I couldn't find an exact duplicate, just a related issue where the sort key collapses to empty, so I've added an answer. – Nicola Talbot Feb 12 '15 at 8:44
3

xindy ignores commands contained in the sort field, so it treats the sort value \widetilde{m} as just m but you already have an entry with that sort value so the second entry is merged with the first. You can see this more clearly when the numberlist is displayed and the two entries are on separate pages:

\documentclass[11pt,a4paper,twoside]{book}

\usepackage[xindy,nomain]{glossaries}


\newglossary[slg]{symbols}{sym}{sbl}{List of Symbols}
\makeglossaries

\newglossaryentry{symb:m}{%
type=symbols,
name={$m$},
text={m},
description={symb m}}

\newglossaryentry{symb:m2}{%
type=symbols,
name={$\widetilde{m}$},
text={\widetilde{m}},
description={symbol m2}}

\newglossaryentry{symb:f}{%
type=symbols,
name={$f(\cdot)$},
text={f},
description={This is a function}}

\begin{document}
    \chapter{Test}
    Here comes the first symbol: $\gls{symb:m}$; 
    \newpage
    and now the second: $\gls{symb:m2}$. 

    Here is a function: $\gls{symb:f}(t)$.

    \printglossary[type=symbols]

\end{document}

The list of symbols now looks like:

image of glossary

The m entry has two pages in the page list. The first one (page 1) is the symb:m entry and the second one (page 2) is the symb:m2 entry. Since xindy does this silently, it's best to always use the sort key if you have any entries that contain commands. For example:

\newglossaryentry{symb:m2}{%
type=symbols,
name={$\widetilde{m}$},
text={\widetilde{m}},
sort=m2,
description={symbol m2}}

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.