Debian Codegraph @

texmf-dist/doc/latex/glossaries-extra/samples/sample-initialisms.tex

raw
1 % arara: pdflatex
2 % arara: makeglossaries
3 % arara: pdflatex
4 \documentclass{article}
5
6 \usepackage[T1]{fontenc}
7 \usepackage[colorlinks]{hyperref}
8 \usepackage{glossaries-extra}
9
10 \makeglossaries
11
12 % set up the styles:
13 \setabbreviationstyle{long-short-sc}
14
15 \setabbreviationstyle[initialism]{short-long}
16 \glssetcategoryattribute{initialism}{insertdots}{true}
17 \glssetcategoryattribute{initialism}{discardperiod}{true}
18 \glssetcategoryattribute{initialism}{retainfirstuseperiod}{true}
19
20 % define the entries:
21
22 \newabbreviation{html}{html}{hypertext markup language}
23
24 \newabbreviation[category=initialism]{eg}{eg}{for example}
25 \newabbreviation[category=initialism]{si}{SI}{sample initials}
26
27 \begin{document}
28 \section{Examples}
29
30 Abbreviations with dots \gls{eg} and \gls{si} and abbreviation
31 without dots \gls{html} and the end of the sentence.
32
33 (Next use.) Abbreviations with dots \gls{eg} and \gls{si} and abbreviation
34 without dots \gls{html} and the end of the sentence.
35
36 Singular: \gls{si} and at the end of a sentence \gls{si}.
37
38 Plural: \glspl{si} and at the end of a sentence \glspl{si}.
39
40 Reset\glsresetall. First use end of sentence:
41 \gls{eg}. \gls{si}. \gls{html}.
42
43 Next use end of sentence:
44 \gls{eg}. \gls{si}. \gls{html}.
45
46 \section{Space Factors}
47
48 Test the space factors. (More visible if we switch to a monospaced
49 font.)
50
51 \begin{ttfamily}
52 Initialisms in the middle \gls{eg} and \gls{si} of a sentence.
53
54 Initialism at the end of a sentence \gls{eg}.
55 Initialism at the end of a sentence \gls{si}.
56 Another sentence.
57 \end{ttfamily}
58
59 Compare with explicitly writing the text without \verb|\gls|
60 and judicious use of \verb*|\ | and \verb|\@|:
61
62 \begin{ttfamily}
63 Initialisms in the middle e.g.\ and S.I. of a sentence.
64
65 Initialism at the end of a sentence e.g.
66 Initialism at the end of a sentence S.I\@.
67 Another sentence.
68 \end{ttfamily}
69
70 \printglossaries
71
72 \end{document}