File: sample-initialisms.tex

package info (click to toggle)
texlive-extra 2022.20230122-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,466,588 kB
  • sloc: perl: 398,710; xml: 35,871; python: 29,125; cs: 25,850; sh: 17,610; makefile: 17,304; ansic: 15,490; java: 12,811; javascript: 9,898; lisp: 1,755; csh: 1,129; ruby: 1,072; awk: 151; tcl: 142; pascal: 138; cpp: 41; sed: 36; haskell: 5
file content (72 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (4)
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
71
72
% 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. 

Singular: \gls{si} and at the end of a sentence \gls{si}.

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}