Debian Codegraph @

texmf-dist/doc/latex/glossaries/samples/sample-dot-abbr.tex

raw
1 % This file is public domain.
2 % If you want to use arara you need the following directives:
3 % arara: pdflatex
4 % arara: makeglossaries
5 % arara: pdflatex
6 %
7 %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sample-dot-abbr
8 \documentclass{article}
9
10 \usepackage{glossaries}
11
12 \makeglossaries
13
14 \glsaddstoragekey{abbrtype}{word}{\abbrtype}
15
16 \setacronymstyle{long-short}
17
18 \newcommand*{\newabbr}[1][]{%
19 \newacronym[abbrtype=initials,#1]}
20
21 \newabbr{eg}{e.g.}{exempli gratia}
22 \newabbr{ie}{i.e.}{id est}
23 \newabbr{bsc}{B.Sc.}{Bachelor of Science}
24 \newabbr{ba}{B.A.}{Bachelor of Arts}
25 \newabbr{agm}{A.G.M.}{annual general meeting}
26
27 \newacronym{laser}{laser}{light amplification by stimulated
28 emission of radiation}
29
30 % See the sample-initialisms.tex example file provided with
31 % glossaries-extra.sty for a better way of doing this.
32
33 \makeatletter
34 \renewcommand{\glspostlinkhook}{%
35 \ifglsfieldeq{\glslabel}{abbrtype}{initials}%
36 {\new@ifnextchar.\doendsentence\doendword}
37 {}%
38 }
39 \makeatother
40
41 \newcommand{\doendsentence}[1]{\spacefactor=10000{}}
42 \newcommand{\doendword}{\spacefactor=1000{}}
43
44 \begin{document}
45 This is a sample document that illustrates abbreviations with
46 full stops (periods) and abbreviations that are words (i.e.\
47 acronyms). The examples switch to a typewriter font to make it
48 easier to see the inter-word and inter-sentence spaces.
49
50 The extension package glossaries-extra.sty provides a better way of
51 doing this.
52
53 First use: \gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} end of
54 sentence.
55
56 End of sentence use:
57
58 \ttfamily
59
60 \gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}.
61 Done.
62
63 laser. e.g. i.e. B.Sc. B.A\@. A.G.M\@. Done.
64
65 \rmfamily
66
67 Mid-sentence use:
68
69 \ttfamily
70
71 \gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} Done.
72
73 laser e.g.\ i.e.\ B.Sc.\ B.A. A.G.M. Done.
74
75 \rmfamily
76
77 Check other sentence terminators:
78
79 \ttfamily
80
81 \gls{laser}? \gls{eg}? \gls{ie}? \gls{bsc}! \gls{ba}! \gls{agm}? Done.
82
83 laser? e.g.? i.e.? B.Sc.! B.A.! A.G.M.? Done.
84
85 \rmfamily
86
87 \glsresetall Reset. End of sentence use:
88
89 \ttfamily
90
91 \gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}.
92 Done.
93
94 \rmfamily
95 \printglossaries
96 \end{document}