Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.

Gallery: Adjusting Parenthetical Style

image of sample document with bacteria referenced in text and listed in a glossary.
This example uses the glossaries-extra package, which extends the glossaries package and provides better abbreviation handling. You’ll need at least version 1.04 of glossaries-extra.sty (you’ll also need a fairly up-to-date version of glossaries.sty as well).

This example adjusts the long-short-user style so that the parenthetical part is omitted and both the long and short forms are emphasized.

\renewcommand*{\glsabbrvuserfont}[1]{\emph{#1}}
\renewcommand*{\glslonguserfont}[1]{\emph{#1}}

\renewcommand*{\glsxtruserparen}[2]{}

This means that on first use only the long form (emphasized) is displayed and on subsequent use only the short form (emphasized) is displayed. Note that this modification also affects \glsxtrfull so that it will only display the long form.

As from version 1.17, the glossaries-extra package now provides the style long-only-short-only, which only displays the long form on first use and only displays the short form on subsequent use, but shows both long and short forms with \glsxtrfull. (An example follows at the bottom of this page.)

The initial comment lines below are arara directives. You can remove them if you don’t use arara.

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage{glossaries-extra}

\makeglossaries

\setabbreviationstyle{long-short-user}

\renewcommand*{\glsabbrvuserfont}[1]{\emph{#1}}
\renewcommand*{\glslonguserfont}[1]{\emph{#1}}

\renewcommand*{\glsxtruserparen}[2]{}


\newabbreviation{cbot}{C.~botulinum}{Clostridium botulinum}
\newabbreviation{putida}{P.~putida}{Pseudomonas putida}

\begin{document}

First use: \gls{cbot}, \gls{putida}.

Next use: \gls{cbot}, \gls{putida}.

Inline full form: \glsxtrfull{cbot}, \glsxtrfull{putida}.

\printglossaries
\end{document}

If you don’t use arara, you need to run the following commands:

pdflatex sample-bacteria
makeglossaries sample-bacteria
pdflatex sample-bacteria

(See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.)

Download: PDF (42.49K), source code (610B).

example image

The alternative approach that uses the new long-only-short-only just needs to modify the style’s font commands:

\setabbreviationstyle{long-only-short-only}

\renewcommand*{\glsabbrvonlyfont}[1]{\emph{#1}}
\renewcommand*{\glslongonlyfont}[1]{\emph{#1}}

The result is almost the same as before except for the inline full form (\glsxtrfull) which shows the long form followed by the short form in parentheses. (Remember that \glsxtrfull doesn’t always replicate the format displayed by the first use of \gls.)

Download: PDF (42.83K), source code (575B).