Gallery: Abbreviation Styles

image of sample abbreviations each in a different style
This example illustrates all the abbreviation styles provided by v1.04 of the glossaries-extra package. Some of these styles aren’t available for earlier versions. Make sure you have an up-to-date version of the glossaries package as well.

Note that there is a bug involved in the combined use of the postfootnote and long-em styles in glossaries-extra v1.04 which has been corrected in v1.05. The bug in the short-em-long style has also been corrected.

There’s an updated version of this document supplied with glossaries-extra version 1.17 onwards, which includes new styles not shown here (sample-abbr-styles.tex, sample-abbr-styles.pdf).

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

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

\usepackage[T1]{fontenc}
\usepackage{relsize}
\usepackage[colorlinks]{hyperref}
\usepackage[style=tree]{glossaries-extra}

\renewcommand*{\glstreenamefmt}[1]{\textrm{\bfseries #1}}

\makeglossaries

\newcommand{\teststyle}[1]{%
 \setabbreviationstyle[#1]{#1}%
 \newabbreviation[category=#1,user1={user text}]{sample-#1}{short}{long form}%
 \csdef{glsxtrpostdesc#1}{ [style: \texttt{#1}]}%
}

\newcommand{\testdescstyle}[1]{%
 \setabbreviationstyle[#1]{#1}%
 \newabbreviation[category=#1,user1={user text},description={sample description}]{sample-#1}{short}{long form}%
 \csdef{glsxtrpostdesc#1}{ [style: \texttt{#1}]}%
}

\teststyle{long-short}
\teststyle{long-short-sc}
\teststyle{long-short-sm}
\teststyle{long-short-em}
\teststyle{long-em-short-em}
\teststyle{long-short-user}

\teststyle{short-long}
\teststyle{short-sc-long}
\teststyle{short-sm-long}
\teststyle{short-em-long}
\teststyle{short-em-long-em}
\teststyle{short-long-user}

\teststyle{short-footnote}
\teststyle{short-postfootnote}
\teststyle{short-sc-footnote}
\teststyle{short-sc-postfootnote}
\teststyle{short-sm-footnote}
\teststyle{short-sm-postfootnote}
\teststyle{short-em-footnote}
\teststyle{short-em-postfootnote}

\teststyle{short-nolong}
\teststyle{short-sc-nolong}
\teststyle{short-sm-nolong}
\teststyle{short-em-nolong}

\teststyle{long-noshort}
\teststyle{long-noshort-sc}
\teststyle{long-noshort-sm}
\teststyle{long-noshort-em}
\teststyle{long-em-noshort-em}

\testdescstyle{long-short-desc}
\testdescstyle{long-short-sc-desc}
\testdescstyle{long-short-sm-desc}
\testdescstyle{long-short-em-desc}
\testdescstyle{long-em-short-em-desc}
\testdescstyle{long-short-user-desc}

\testdescstyle{short-long-desc}
\testdescstyle{short-sc-long-desc}
\testdescstyle{short-sm-long-desc}
\testdescstyle{short-em-long-desc}
\testdescstyle{short-em-long-em-desc}
\testdescstyle{short-long-user-desc}

\testdescstyle{short-nolong-desc}
\testdescstyle{short-sc-nolong-desc}
\testdescstyle{short-sm-nolong-desc}
\testdescstyle{short-em-nolong-desc}

\testdescstyle{long-noshort-desc}
\testdescstyle{long-noshort-sc-desc}
\testdescstyle{long-noshort-sm-desc}
\testdescstyle{long-noshort-em-desc}
\testdescstyle{long-em-noshort-em-desc}

\begin{document}
\tableofcontents

\chapter{First Use}
First use of \verb|\gls|.

\forglsentries{\thislabel}{\texttt{\glscategory{\thislabel}}:
\gls{\thislabel}.\glspar}

\chapter{Next Use}
Next use of \verb|\gls|.

\forglsentries{\thislabel}{\texttt{\glscategory{\thislabel}}:
\gls{\thislabel}.\glspar}

\chapter{Full Form}
Full form using \verb|\glsxtrfull| (inline full style).

\forglsentries{\thislabel}{\texttt{\glscategory{\thislabel}}:
\glsxtrfull{\thislabel}.\glspar}


\chapter{Short Form}
Short form using \verb|\glsxtrshort|.

\forglsentries{\thislabel}{\texttt{\glscategory{\thislabel}}:
\glsxtrshort{\thislabel}.\glspar
}

\chapter{Long Form}
Long form using \verb|\glsxtrlong|.

\forglsentries{\thislabel}{\texttt{\glscategory{\thislabel}}:
\glsxtrlong{\thislabel}.\glspar}

\chapter{First Form}
First form using \verb|\glsfirst|.

\forglsentries{\thislabel}{\texttt{\glscategory{\thislabel}}:
\glsfirst{\thislabel}.\glspar}

\chapter{Text Form}
Text form using \verb|\glstext|.

\forglsentries{\thislabel}{\texttt{\glscategory{\thislabel}}:
\glstext{\thislabel}.\glspar}

\printglossaries
\end{document}

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

pdflatex sample-abbr-styles
makeglossaries sample-abbr-styles
pdflatex sample-abbr-styles

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

Download: PDF (257.55K), source code (3.34K).