Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the glossaries package, \glssee{label}{aaa,bbb,ccc,ddd} will cross-reference entries, but it doesn't include the referenced entry if it is not otherwise included in the glossary. (e.g. there will be missing links).

The package provides the \glsadd command to include a glossary entry without generating a link or other text on the page, so one could add the missing entries like so

\glsadd{entry1}\glsadd{entry2}\glsadd{entry3}
\printglossaries

But this will add the page number to the numberlist (the page before the glossary). I suppose \glsadd was primarily meant for referencing page ranges with its optional argument.

There is the nonumberlist package option, but is it really necessary to drop an entire feature just to do away with a few irrelevant page numbers?

For example, can \glsadd be redefined in a way that doesn't add the page number to the numberlist?

(It's very predictable, so if one knows that page 192 is not necessary, one could manually remove the extra \setentrycounter[]{page}\glsnumberformat{192}\delimN strings from the .gls file when adding the final polish to the document, but I wonder if that hack can be avoided.)

share|improve this question
    
If you have multiple lists nomenclature, glossaries, acronyms etc and you want to have page numbers removed for some of them, just modify the style of the list or create a new one that doesn't uses the page variable –  Martin H Apr 18 '11 at 13:24
add comment

2 Answers

up vote 5 down vote accepted

Define a new command \gslgobblenumber that will gobble its argument, and redefine \glsadd so that it will write \glsgobblenumber instead of \glsnumberformat into the .glo file.

\documentclass{article}

\usepackage{glossaries}
\makeglossaries

\makeatletter

\newcommand*{\glsgobblenumber}[1]{}
% \renewcommand*{\glsgobblenumber}[1]{#1}% uncomment for testing

\renewcommand*{\glsadd}[2][]{%
  \glsdoifexists{#2}%
  {%
%     \def\@glsnumberformat{glsnumberformat}% DELETED
    \def\@glsnumberformat{glsgobblenumber}% NEW
    \edef\@gls@counter{\csname glo@#2@counter\endcsname}%
    \setkeys{glossadd}{#1}%
    \@gls@saveentrycounter
    \@do@wrglossary{#2}%
  }%
}
\makeatother

\newglossaryentry{oesophagus}{name=\oe sophagus,
description={canal from mouth to stomach}}
\newglossaryentry{electrolyte}{name=electrolyte,
description={solution able to conduct electric current}}

\begin{document}

Some text about \gls{oesophagus}.

\glsadd{electrolyte}

\printglossaries

\end{document}
share|improve this answer
add comment

An alternative solution is to specify the nonumberlist option for the glossary entries that are only cross-referenced:

\documentclass{article}

\usepackage{glossaries}

\makeglossaries

\newglossaryentry{first}{name={First}, description={First Term}, nonumberlist}
\glsadd{first}

\newglossaryentry{second}{name={Second}, description={Second Term}, see=first}

\begin{document}

\noindent
\gls{second}

\printglossary

\end{document}

The output is:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.