2

Is there a way to just add a reference to something without displaying the name of the glossary item? Such as:

"Foo exists in the glossary.\gls{foo}"

becoming

"Foo exists in the glossary."

instead of

"Foo exists in the glossary.foo"

2
  • 1
    Please provide an MWE (from \documentclass... to \end{document}) that shows your problem and that we can compile, otherwise how do you expect us to (wrongly) guess what you might have done? Sep 1 at 18:40
  • 1
    You say ...glossary.\gls{foo} giving "..,. glossary.foo" but you don't want the "foo". So why the \gls{foo}? Sep 1 at 18:44
1

Welcome, in the future please post a MWE (please consult this link so you know how to write one in the future), I know yours is more of a question but it really helps us help you. A possible solution is using the "first" key in \newglossaryentry, which is the text and/or symbols you wish to be included the first time you use the entry with \gls:

enter image description here

Code:

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex

\documentclass{article}

\usepackage{hyperref}
\usepackage{glossaries}

\newglossaryentry{foo}
    {%
    name={foo},
    description={description of foo that appears in glossary},
    first={Foo exists in the glossary},
    }
    
\makeglossary

\begin{document}

\section{Test}
\gls{foo}

\printglossaries

\end{document}

The arara commands are the method I use to compile documents, it means you do not have to manually run pdflatex, makeglossaries, pdflatex, have a look at it if you're interested but you can delete the arara commands if you wish. Hope this helps.

Edit: This is the template I use so I remember which glossary entries I need and which to use in documents if you have never seen all the entries before:

%\newglossaryentry{in-text \gls name}
%   {%
%   name={name that appears in glossary},
%   description={description that appears in glossary},
%   text={in-text where singular form required, if not defined uses name}
%   first={first time used with singular form, if not defined uses text},
%   plural={plural form, if not defined adds s to text value},
%   firstplural={first time plural used},
%   symbols={adds a symbol if needed},
%   sort={how to sort entry},
%   type={glossary name that this entry belongs to},
%   }
1
  • 1
    Thank you for the quick and thoughtful answer. Setting text to be empty in the glossary entry solved my problem.
    – Simon
    Sep 1 at 19:48

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.