views:

39

answers:

2

I'm using the glossaries package in LaTeX. I've got \gls{foo} in my document, but I don't want the entry for "foo" to appear in the glossary. How can I keep a working (i.e. expanding) \gls{foo} in the body of my document, but exclude the entry for "foo" from the glossary?

EDIT: I want to use \gls{foo} to indicate "as used here, 'foo' has its specific meaning within this document." In a few cases, though, I've ended up with a "foo" whose definition is too obvious--or difficult--to articulate in the glossary.

So I want \gls{foo} to be expanded as usual, but I don't want the "foo" entry to appear in the glossary.

I hope this adds a little more information about what I'm trying to accomplish. It may be an abuse of glossaries, but I find it helpful to make sure I'm always using the same words and the right words while writing technical documents.

+2  A: 

I have no idea why you'd want to do this, but the following should work:

\let\oldgls\gls% store the original meaning of \gls in a new command named \oldgls
\let\gls\relax$ make \gls do nothing
Some text with \gls{foo} no links to the glossary, 
and no ``foo'' entry in the glossary.
\let\gls\oldgls% restore the original meaning of \gls
Some more text with \gls{bar} that links to the glossary,
and with a ``bar'' entry in the glossary.
godbyk
`\gls{foo}` appears, say, dozens of times all over my document. Also, sometimes "foo" was a different word, but has since become "foo" and now I don't want "foo" in the glossary, but I do still want it referred to with `\gls{foo}` (it might be changed itself at some point in the future).Therefore I'd prefer a solution that doesn't require me to adulterate every usage of `\gls{foo}`.I'm thinking there should be some way to set the entry as if it were "unused" by the time _something_ gets around to generating the glossary. I don't mind adding something like `\glsignore{foo}` at the end.
draebek
+1  A: 

If you are using the glossaries package you can create an "ignored" glossary like

\documentclass{article}

\usepackage{glossaries}
\newglossary[glignoredl]{ignored}{glignored}{glignoredin}{Ignored Glossary}
\makeglossaries

\newglossaryentry{foofoo}{name={FOOFOO},description={foofoo stuff}}
\newglossaryentry{foo}{name={FOO},type={ignored},description={no good description}}
\newglossaryentry{bar}{name={BAR},description={bar of stuff}}

\begin{document}

Here is a \gls{foo} that is also a \gls{bar}, but of course it's also a \gls{foofoo}.
Why not consider buying a \gls{foo}?

\printglossary
% \printglossary[type={ignored}]

\end{document}
Ivan Andrus
That did the trick, thanks!
draebek