1

I would like to know if any of the fields that are manually configured during the creation of glossary entries can be accessed manually/deliberately in a macro or newcommand - possibly of the form:

\newcommand{\expectedFirst}[1]{???}

where ??? would be a defintion that would use the gls label, #1, to grab a predefined field such as short, name, label, long, description, firstplural, etc. I would create a new command for each field I wanted to pull, or possibly use

\newcommand{\expectedField}[2]{???}

where #1 would be the label string, and #2 represents the field I want to extract or make accessible.

I poked through the .dtx glossaries file but didn't find any macro definitions that looked like a variable creation that I could duplicate externally. What did look interesting and potentially useful was the presence of a tracking boolean to track whether the term had been called yet or not. This boolean would be another variable I would be interested in comparing with in my custom macros.

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}

\setlength\parindent{0pt}


%=========================================================================================================================================
% PACKAGES REQUIRED FOR GLOSSARIES
%=========================================================================================================================================

% Glossaries must be loaded before amsmath as per details in the following forum answer
% http://tex.stackexchange.com/questions/85696/what-causes-this-strange-interaction-between--and-amsmath
\usepackage[nogroupskip,toc,acronym]{glossaries} % must come after href   
\usepackage{scrwfile}%http://www.dickimaw-books.com/cgi-bin/faq.cgi?action=view&categorylabel=glossaries#glsnewwriteexceeded

\makeglossaries

\newglossaryentry{ICPMS}{ type={acronym}, sort={inductively coupled plasma mass spectrometry},  name={ICPMS}, short={ICPMS}, long={inductively coupled plasma mass spectrometry}, first={inductively coupled plasma mass spectrometry (ICPMS)}, description={inductively coupled plasma mass spectrometry} }

\begin{document}

    \begin{itemize}
        \item \gls{ICPMS}
        \item \gls{ICPMS}
            %\item \expectedFirst{ICPMS}
    \end{itemize}


\end{document} 
4
  • Well you can certainly do it for new fields, right? Just as you can use \glspl to get the plural form, even if the plural is non-standard and specified via the entry field. See section 4.3 (currently start page 79) of the manual. firstplural etc. already have existing macros as described slightly earlier in the manual (around p. 74).
    – cfr
    Feb 20, 2015 at 4:34
  • @cfr Thankyou for your comment, but I am not trying to create new types of entries. I am trying to access entries without triggering formal use recognition to put together a system for evaluating the current state of a glossary entry by retrieving the text returned by a \gls{X} call and comparing it to a field in that same entry. I don't think a custom key would work in this context.
    – EngBIRD
    Feb 20, 2015 at 15:25
  • I'm aware of that. I was suggesting looking at how that is done. Well, for things like firstplural etc., the commands already exist. That is, they retrieve the content of a particular field or return a default defined in terms of the entry name.
    – cfr
    Feb 21, 2015 at 3:33
  • @cfr sorry I misunderstood I will look back to the code with firstplural as the specific macro definition. I will update the question with my extracted attempt adapted from this example.
    – EngBIRD
    Feb 21, 2015 at 3:52

1 Answer 1

2

Through more careful inspection of the documentation and from inspirations garnered from the comments in the original question, I have found that the glossaries package makes some fields accessible using commands formated similar to \glsentryshort{} and \glsentrylong{}. Most importantly, using these commands doesn't artificially trigger a counter that would prevent the appropriate first use evaluation.

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}

\setlength\parindent{0pt}

%=========================================================================================================================================
% PACKAGES REQUIRED FOR GLOSSARIES
%=========================================================================================================================================

% Glossaries must be loaded before amsmath as per details in the following forum answer
% http://tex.stackexchange.com/questions/85696/what-causes-this-strange-interaction-between--and-amsmath
\usepackage[nogroupskip,toc,acronym]{glossaries} % must come after href   
\usepackage{scrwfile}%http://www.dickimaw-books.com/cgi-bin/faq.cgi?action=view&categorylabel=glossaries#glsnewwriteexceeded

\makeglossaries

\newglossaryentry{ICPMS}{ type={acronym}, sort={inductively coupled plasma mass spectrometry},  name={ICPMS}, short={ICPMS}, long={inductively coupled plasma mass spectrometry}, first={inductively coupled plasma mass spectrometry (ICPMS)}, description={inductively coupled plasma mass spectrometry} }

\begin{document}

    \begin{itemize}
        \item \glsentrylong{ICPMS}
        \item \glsentryshort{ICPMS}
        \item \glsentryfull{ICPMS}
        \item \gls{ICPMS}
        \item \gls{ICPMS}
    \end{itemize}


\end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .