About
Shop
LaTeX
Free Software
Books
News
Contact
Blog
Recent news (2017-06-16): Blog post "Norfolk".

Gallery (glossaries): Adjusting Parenthetical Style

Image of
user parenthetical style sample
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).

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

This example adjusts the long-short-user style so that the parenthetical part is omitted and both the long and short forms are emphasized. 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.

% 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}.

\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
These commands can be run from a terminal or command prompt or you might be able to run them by clicking on a button in your text editor.

Download: PDF, document source.


Last modified: 2017-02-07.

The free resources on this site are funded by book sales, not by adverts. If you would like to help keep this site free of annoying third-party ads, please consider buying a book.

© 2016 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Site Map FAQs