summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries-extra/sample-initialisms.tex
blob: 39aa4e905fe64c464196184fe0c04c2236205c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries-extra}

\makeglossaries

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

\setabbreviationstyle[initialism]{short-long}
\glssetcategoryattribute{initialism}{insertdots}{true}
\glssetcategoryattribute{initialism}{discardperiod}{true}
\glssetcategoryattribute{initialism}{retainfirstuseperiod}{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}
\section{Examples}

Abbreviations with dots \gls{eg} and \gls{si} and abbreviation
without dots \gls{html} and the end of the sentence. 

(Next use.) Abbreviations with dots \gls{eg} and \gls{si} and abbreviation
without dots \gls{html} and the end of the sentence. 

Plural: \glspl{si} and at the end of a sentence \glspl{si}.

Reset\glsresetall. First use end of sentence:
\gls{eg}. \gls{si}. \gls{html}.

Next use end of sentence:
\gls{eg}. \gls{si}. \gls{html}.

\section{Space Factors}

Test the space factors. (More visible if we switch to a monospaced
font.)

\begin{ttfamily}
Initialisms in the middle \gls{eg} and \gls{si} of a sentence.

Initialism at the end of a sentence \gls{eg}.
Initialism at the end of a sentence \gls{si}.
Another sentence.
\end{ttfamily}

Compare with explicitly writing the text without \verb|\gls|
and judicious use of \verb*|\ | and \verb|\@|:

\begin{ttfamily}
Initialisms in the middle e.g.\ and S.I. of a sentence.

Initialism at the end of a sentence e.g.
Initialism at the end of a sentence S.I\@.
Another sentence.
\end{ttfamily}

\printglossaries

\end{document}