1

I'm using the acronyms in the glossaries package such that I can do this:

\newacronym{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}
\gls{MIRDD}

\gls{MIRDD}

This stores the acronym and then prints

Mid-Infrared Diagnostic Diagram (MIRDD)
MIRDD

However, it would be nice if I could do this:

\newacronym[\citep{Person2018}]{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}\gls{MIRDD}

\gls{MIRDD}

\gls{MIRDD}

and maybe

\glscite{MIRDD}

so that it prints:

Mid-Infrared Diagnostic Diagram (MIRDD; Person et al. 2018)
MIRDD

and maybe

MIRDD (Person et al. 2018)

using the usual natbib stuff.

Is this possible??

I've looked through the docs and whilst there is support for prefixes there appears to be no support for suffixes or anything like this.

  • You can store the citation label in one of the user fields. See for example Citations in Glossary Sample. For suffixes, there's the post-description hook, which is enhanced by the glossaries-extra package, or the long-short-user abbreviation style, for example, Abbreviations (With Translations) Sample which is designed for translations but could be adapted to use \cite. It would help to have a proper MWE to work with. – Nicola Talbot Nov 23 '18 at 15:56
  • So how would one use glossaries-extra to add a suffix to the first instance. Indeed, how do you redefine the first instance at all? – Lucidnonsense Nov 23 '18 at 16:36
  • I think with abbreviations you'd be better off using the long-short-user style rather than adding a suffix, as then you can include the citation within the parentheses that show the short form. – Nicola Talbot Nov 23 '18 at 16:38
  • I'm getting ! Package glossaries-extra Error: Undefined abbreviation style long-short-user` – Lucidnonsense Nov 23 '18 at 16:48
  • Sounds like you have an old version of glossaries-extra. The long-short-user style was added to 1.04 (2016-05-02). – Nicola Talbot Nov 23 '18 at 17:00
1

The simplest method is with glossaries-extra:

\documentclass{article}

\usepackage{natbib}
\usepackage[postdot]{glossaries-extra}

\makeglossaries

\setabbreviationstyle[acronym]{long-short-user}

\renewcommand*{\glsxtruserparen}[2]{% requires glossaries-extra v1.04+
  \glsxtrfullsep{#2}%
  \glsxtrparen
   {#1\ifglshasfield{\glsxtruserfield}{#2}{;
     \expandafter\citet\expandafter{\glscurrentfieldvalue}}{}}%
}

\glsdefpostdesc{acronym}{% requires glossaries-extra v1.31+
 \ifglshasfield{\glsxtruserfield}{\glscurrententrylabel}%
 {~\expandafter\citep\expandafter{\glscurrentfieldvalue}}%
 {}%
}

\newacronym[user1={article-minimal}]{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}

\begin{document}
First use: \gls{MIRDD}. Next use: \gls{MIRDD}.

\printglossary
\bibliographystyle{plainnat}
\bibliography{xampl}
\end{document}

The base glossaries package is implicitly loaded, but it needs to be at least version 4.23 which provides \glscurrentfieldvalue for use within the true part of \ifglshasfield. This example produces:

image of document with citation included in parenthesis after the short form on first use

The user1 field may contain a comma-separated list of citation labels.

This example won't work well with hyperref as you'll end up with nested hyperlinks on first use. The simplest workaround is to disable the hyperlinks on first use:

\documentclass{article}

\usepackage{natbib}
\usepackage[colorlinks]{hyperref}
\usepackage[postdot]{glossaries-extra}

\makeglossaries

\setabbreviationstyle[acronym]{long-short-user}
\glssetcategoryattribute{acronym}{nohyperfirst}{true}

\renewcommand*{\glsxtruserparen}[2]{% requires glossaries-extra v1.04+
  \glsxtrfullsep{#2}%
  \glsxtrparen
   {#1\ifglshasfield{\glsxtruserfield}{#2}{;
     \expandafter\citet\expandafter{\glscurrentfieldvalue}}{}}%
}

\glsdefpostdesc{acronym}{% requires glossaries-extra v1.31+
 \ifglshasfield{\glsxtruserfield}{\glscurrententrylabel}%
 {~\expandafter\citep\expandafter{\glscurrentfieldvalue}}%
 {}%
}

\newacronym[user1={article-minimal}]{MIRDD}{MIRDD}{Mid-Infrared Diagnostic Diagram}

\begin{document}
First use: \gls{MIRDD}. Next use: \gls{MIRDD}.

\printglossary
\bibliographystyle{plainnat}
\bibliography{xampl}
\end{document}

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.