7

I have been looking around the web for a few days for this problem, but I can't find a solution. I created a glossary for my thesis and when I display it I see the current page number at the end of the description. For example, I have the following result:

Computer is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format. [current page] [another page] [yet another page].

I would like to remove the [current page] from the list of page number and only that one. Is that something possible?

The same problem appens with acronyms.

Here is a small code that illustrates my probleme

\documentclass{book}
\usepackage{hyperref}
\usepackage{glossaries}
\makeglossaries

\begin{document}

%%%%% Glossaire %%%%%
\newacronym{fps}{FPS}{Frame Per Second}         % Unused but display this page
\newglossaryentry{computer}                     % Used but I don't want to see the page 1
{
  name=Computer,
  text=computer,
  description={is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format.},
  plural=computers
}

\renewcommand*{\glossaryname}{Glossaire}    % Change the default name of the glossary
\renewcommand*{\glspostdescription}{}       % Delete the trailing point if using package glossaries with nonumberlist as arguments
\glsaddall                      % Add all the terms in the glossairy (these.glo)
\printglossaries                % Print all the terms included in these.glo
\clearpage
%%%%%%%%%%%%%%%%%%%%%

%%%%% Example %%%%%%%
\chapter{Super Title}
Here I use the reference to a \gls{computer}. It's a small example that show my problem.

\end{document}

To compile I do the following

pdflatex document.tex
makeglossaries document.glo
pdflatex document.tex
pdflatex document.tex
2
  • Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Dec 16 '13 at 18:33
  • @karlkoeller I just updated the post. Thank you for giving me a chance :-)
    – K-Jtan
    Dec 16 '13 at 19:47
10

The problem is that \glsaddall adds all entries in the glossary together with their current location to the "number list".

So, you should use \glsaddallunused instead of \glsaddall. The former skips any entries that have already been used and also will ignore the current location in the number list.

Just remember to put this command after all of your used entries, otherwise glossaries doesn't knows which entries have been used.

So, I suggest you to put this command just before \end{document}, as in the following MWE:

\documentclass{book}
\usepackage{hyperref}
\usepackage{glossaries}
\makeglossaries

\begin{document}

%%%%% Glossaire %%%%%
\newacronym{fps}{FPS}{Frame Per Second}         % Unused but display this page
\newglossaryentry{computer}                     % Used but I don't want to see the page 1
{
  name=Computer,
  text=computer,
  description={is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format.},
  plural=computers
}

\renewcommand*{\glossaryname}{Glossaire}    % Change the default name of the glossary
\renewcommand*{\glspostdescription}{}       % Delete the trailing point if using package glossaries with nonumberlist as arguments
\printglossaries                % Print all the terms included in these.glo
\clearpage
%%%%%%%%%%%%%%%%%%%%%

%%%%% Example %%%%%%%
\chapter{Super Title}
Here I use the reference to a \gls{computer}. It's a small example that show my problem.

\glsaddallunused                % Add all the unused terms in the glossairy (these.glo)
\end{document} 

Output:

enter image description here

6
  • I tried your solution and I does not add the unused entries. I did found the documentation on (tex.ac.uk/CTAN/macros/latex2e/contrib/glossaries/…) which suggest the same thing. When I compile, I get this error : ! Undefined control sequence. and the message says The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), type I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. Any idea why ?
    – K-Jtan
    Dec 16 '13 at 21:26
  • 3
    @K-Jtan You probably have an out-to-date glossaries package. The command \glsaddallunused has been introduced in v3.08a. Check your .log file for the version. If yours is earlier please update yout TeX distribution. Dec 17 '13 at 5:30
  • I will look into that. Thank you for your help. I marked the solution as usefull. I just saw that my glossary.sty has the version 3.07, so I will look into that problem.
    – K-Jtan
    Dec 17 '13 at 14:43
  • @K-Jtan Thank you. Be sure that after updating glossaries to its latest version, it will work. :-) Dec 17 '13 at 14:45
  • 1
    @cosmicraga I'm afraid all the customizations you have in your document won't work with glossaries v4.06. I'd try to find a way to reinstall previous version or you'll have to rewrite all customized code from scratch... Mar 26 '14 at 6:17
0

If someone gets the same problem than me and you glossary.sty is out of date, here is how I fixed it.

NOTE this is a temporary solution. You should update your package.

I found the last version of the glossary.sty online and copied the command \glsaddallunused into my project class. You will need to replace \newrobustcmd by \newcommand.

\newcommand*{\glsaddallunused}[1][\@glo@types]{%
 \forallglsentries[#1]{\@glo@entry}%
 {%
    \ifglsused{\@glo@entry}{}{\glsadd[format=@gobble]{\@glo@entry}}%
 }%
}

I don't know if there is better way to do this, but it works for me.

2
  • 1
    It's better to update the package otherwise you'll end up with a "command already defined" error when your TeX distribution next gets updated. Dec 17 '13 at 17:13
  • @NicolaTalbot yes I was aware of that problem, but it's a good thing to mention for other people. I only suggested a temporary solution if you need to produce a document fast. The solution from Karl Koeller is the right one, everyone should follow that solution.
    – K-Jtan
    Dec 17 '13 at 18:41

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.