GeneralCross-referencing in glossaries

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Almad
Posts: 3
Joined: Fri Jun 26, 2009 1:48 am

Cross-referencing in glossaries

Post by Almad »

Hi,

I'm trying to use glossaries.sty with my LaTeX. Everything works fine, except for cross-referencing entries. Even documentation example fails:

Code: Select all

\newglossaryentry{peanut}{name=peanut,
description={my definition}
}
 
\newglossaryentry{apple}{name=apple,
description={firm, round fruit. See also \gls{peanut}}}
in external file loaded with \loadglsentries{definice} fails with

Code: Select all

! Incomplete \iffalse; all text was ignored after line 7.
<inserted text>
                \fi
l.48 \loadglsentries{definice}
Any idea about cause?

I'm using glossaries 2.01 with texlive 2008 on gentoo.

Thanks,

Almad

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Cross-referencing in glossaries

Post by nlct »

Can you provide a minimal example? I can't reproduce the error.

Regards
Nicola Talbot
Almad
Posts: 3
Joined: Fri Jun 26, 2009 1:48 am

Cross-referencing in glossaries

Post by Almad »

nlct wrote:Can you provide a minimal example? I can't reproduce the error.

Regards
Nicola Talbot
Yes, I can.

Main document:

Code: Select all

almad@namtar ~/tmp/latexex $ cat example.tex
\documentclass[11pt,twoside,a4paper]{book}
\usepackage[xindy,style=altlistgroup,sanitize=none,toc]{glossaries}
\makeglossaries
\loadglsentries{definitions}


\begin{document}

Hello, \gls{apple}

\end{document}
Definitions:

Code: Select all

almad@namtar ~/tmp/latexex $ cat definitions.tex

\newglossaryentry{peanut}{name=peanut,
description={my definition}
}

\newglossaryentry{apple}{name=apple,
description={firm\, round fruit. See also \gls{peanut}}}

Command and output:

Code: Select all

almad@namtar ~/tmp/latexex $ pdflatex example
This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
 %&-line parsing enabled.
entering extended mode
(./example.tex
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, pinyin, bulgarian, russian, ukrainian, czech, slovak, ukenglish, lo
aded.
(/usr/share/texmf-dist/tex/latex/base/book.cls
Document Class: book 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/bk11.clo))
(/usr/share/texmf-site/tex/latex/glossaries/glossaries.sty
(/usr/share/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texmf-dist/tex/generic/xkeyval/keyval.tex)))
(/usr/share/texmf-site/tex/latex/glossaries/mfirstuc.sty)
(/usr/share/texmf-dist/tex/latex/xfor/xfor.sty)
(/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty)
(/usr/share/texmf-site/tex/latex/glossaries/glossary-hypernav.sty)
(/usr/share/texmf-site/tex/latex/glossaries/glossary-list.sty)
(/usr/share/texmf-site/tex/latex/glossaries/glossary-long.sty
(/usr/share/texmf-dist/tex/latex/tools/longtable.sty))
(/usr/share/texmf-site/tex/latex/glossaries/glossary-super.sty
(/usr/share/texmf-dist/tex/latex/supertabular/supertabular.sty))
(/usr/share/texmf-site/tex/latex/glossaries/glossary-tree.sty))
(./definitions.tex)
! Incomplete \iffalse; all text was ignored after line 7.
<inserted text>
                \fi
l.4 \loadglsentries{definitions}

?
Command info:

Code: Select all

almad@namtar ~/tmp/latexex $ pdflatex --version
pdfTeX 3.1415926-1.40.9-2.2 (Web2C 7.5.7)
kpathsea version 3.5.7
Copyright 2008 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea is copyright 2008 Karl Berry and Olaf Weber.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea written by Karl Berry, Olaf Weber, and others.

Compiled with libpng 1.2.35; using libpng 1.2.37
Compiled with zlib 1.2.3; using zlib 1.2.3
Compiled with xpdf version 3.02pl2
EDIT: Ah-hem, it's not working even with comma properly escaped.
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Cross-referencing in glossaries

Post by nlct »

If you use sanitize=none, you need to protect fragile commands:

Code: Select all

\newglossaryentry{apple}{name=apple,
description={firm, round fruit. See also \protect\gls{peanut}}}
EDIT: Ah-hem, it's not working even with comma properly escaped.
\, is a spacing command. If the value contains a comma, all you need to do is ensure that the value is enclosed in braces (as above).

Regards
Nicola Talbot
Almad
Posts: 3
Joined: Fri Jun 26, 2009 1:48 am

Re: Cross-referencing in glossaries

Post by Almad »

Yup, this seems to work - thanks :)
Post Reply