“Authors Give Back” SmashWords Sale (March 20 - April 20, 2020): ebook editions of crime novel The Private Enemy and short story I've Heard the Mermaid Sing both FREE for the duration of the sale.

# Gallery: Initialisms

If you have a small screen, you may prefer to switch on the small image setting.

This example uses the glossaries-extra package, which extends the glossaries package and provides better abbreviation handling.

This example uses the long-short style for abbreviations that have been assigned to the initialisms category (the eg and si entries). The style must be set before the abbreviations that use that style are defined. For example:

\setabbreviationstyle[initialism]{short-long}

\newabbreviation[category=initialism]{eg}{eg}{for example}
\newabbreviation[category=initialism]{si}{SI}{sample initials}


General abbreviations identified with the default abbreviation category (just the html entry in this example) use the long-short-sc style. Since the default abbreviation is used here, it may be omitted from the optional arguments of \setabbreviationstyle and \newabbreviation:

\setabbreviationstyle{long-short-sc}

\newabbreviation{html}{html}{hypertext markup language}


The initialisms have full stops (periods) automatically inserted by setting the insertdots attribute for entries assigned to the initialism category:

\glssetcategoryattribute{initialism}{insertdots}{true}

If this attribute is set, it’s generally a good idea to set the discardperiod attribute, which will discard a period that follows commands like \gls:
\glssetcategoryattribute{initialism}{discardperiod}{true}


The complete document code is shown below. 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[T1]{fontenc}
\usepackage{glossaries-extra}

\makeglossaries

% set up the styles:
\setabbreviationstyle{long-short-sc}

\setabbreviationstyle[initialism]{short-long}
\glssetcategoryattribute{initialism}{insertdots}{true}

% define the entries:

\newabbreviation{html}{html}{hypertext markup language}

\newabbreviation[category=initialism]{eg}{eg}{for example}
\newabbreviation[category=initialism]{si}{SI}{sample initials}

\begin{document}
\tableofcontents

\section{Sample}
First use: \gls{eg} and \gls{si} (dots inserted) and
\gls{html} (no dots).

Next use: \gls{eg} and \gls{si} (dots) and \gls{html} (no dots).

End of sentence: \gls{eg}. (Trailing period has been discarded.)

End of sentence: \gls{si}. (Spacefactor has also been adjusted.)

\printglossaries

\end{document}


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

pdflatex sample-initialisms
makeglossaries sample-initialisms
pdflatex sample-initialisms


The glossaries-extra package automatically implements the toc option (to add the glossary to the table of contents) and the nopostdot option (to remove the terminating full stop that is placed by default after the description). The entries all have a “1” after the description. This is the page number on which the entry was referenced. In this sample document all the entries were referenced on page 1. If you don’t want these numbers you can use the nonumberlist option.