About
Shop
LaTeX
Free Software
Books
News
Contact
Blog
News (2017-08-02): Latest blog post The Private Enemy Giveaway.

Gallery (glossaries-extra): Abbreviation Styles

Image of
abbreviation styles sample
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.

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

There's an updated version of this document supplied with glossaries-extra version 1.17, which includes new styles not shown here.

% 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
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-08-09.

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