I am trying to display the see
cross references but not the page numbers in my document.
I understood that it's impossible with the means provided by standard, so I tried to use
\renewcommand*{\glossaryentrynumbers}[1]{XXX}
(replace XXX
with various things that I tried)
to fit my code. Unfortunately my lack of Latex knowledge is not very helpful.
What do I have to put instead of XXX
to display the cross references, but not the page numbers?
Here is an example (sorry, I thought it was clear what I meant):
file: glossary.tex
\newacronym[see={{cutg}}]{cut}{CUT}{Code Under Test}
\newglossaryentry{cutg}{name={CUT},
description={\acrfull{cut} refers to the part of the source code that is actually tested. It is a part of the entire source ode and modified before test generation. The tests are generated for the CUT, rather than the original source code. The CUT can be a function, a file or an entire component}
}
file: report.tex
\documentclass[twoside]{article}
%Glossary
\usepackage[xindy,acronym]{glossaries} % nomain, if you define glossaries in a file, and you use \include{INP-00-glossary}
\setacronymstyle{long-short}
\makeglossaries
\usepackage[xindy]{imakeidx}
\makeindex[title=List of Terms]
\loadglsentries[main]{../../glossary}
\renewcommand{\acronymfont}[1]{\textit{#1}} % make acronms italics
\renewcommand{\firstacronymfont}[1]{\textit{#1}}
\renewcommand*{\seename}{Glossary:} % What text should be used for the see-field
%\renewcommand*{\glossaryentrynumbers}[1]{\glsseelist} % turn off ugly numbers (don't use the option for usepackage, otherwise see doesn't work)
\begin{document}
\glsaddall
\printglossaries
\end{document}
When I compile, I produce this:
How can I get rid of the page numbers (highlighted through red rectangles in the image)?
I tried renewing the command that creates \glossaryentrynumbers
, since the option [nonumberlist]
apparently does the same (as far as I know, it calls
\renewcommand*{\glossaryentrynumbers}[1]{}
so my though process was that if I redefine it myself to only contain the see-list, then I should be sorted.
Best Answer
The
seeautonumberlist
package option is designed for use with thenonumberlist
option to enable the location list for entries with thesee
key, but this is only intended when the entry with thesee
key is a synonym that's not used in the document (otherwise you get the rest of the location list appearing as well for that entry).For example:
This produces:
If I add a reference to
sample2
in the document like this:Then the page number also appears for
sample2
:In this case, it's simpler to move the cross-reference into the description:
This produces:
(The
glossaries
user manual uses\gls
in the description field in a similar manner.)Another possibility is to use
\glsseeformat
which can accept a comma-separated list of labels and is the way the cross-reference is displayed in the location list when using thesee
key. If you use this command, remember that there are two mandatory arguments. The last one is provided for the benefit ofmakeindex
and, although ignored by LaTeX, must be present.This produces:
The optional argument allows you to override the "see" tag:
For abbreviations, you'll need to override the default description for styles like
long-short
. For example:Edit: Another possibility is to use the
glossaries-extra
extension package which stores the value of thesee
key (the baseglossaries
package doesn't do this). This means that the value of thesee
key can be accessed in the glossary when the number list has been suppressed. Version 1.06 ofglossaries-extra
adds a convenient to use command\glsxtrusesee{
label}
which makes it easier to access the value. This command does nothing if thesee
key is empty for label, otherwise it does\glsseeformat[
tag]{
xr list}{}
, where the tag and cross-reference list are obtained from thesee
field.The post-description hook can be modified to add this. For example:
This produces:
The
glossaries-extra
package also conveniently lets thesee
key trigger the automatic use of\glsxtraddallcrossrefs
at the end of the document. This means that the following only requires the build sequencelatex
,makeglossaries
,latex
to include all the cross-references in the document:This produces: