summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex')
-rw-r--r--macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex92
1 files changed, 92 insertions, 0 deletions
diff --git a/macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex b/macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex
new file mode 100644
index 0000000000..094fcf76dd
--- /dev/null
+++ b/macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex
@@ -0,0 +1,92 @@
+ % arara: pdflatex
+ % arara: makeglossaries
+ % arara: pdflatex
+\documentclass{article}
+
+\usepackage{glossaries}
+
+\makeglossaries
+
+\glsaddstoragekey{abbrtype}{word}{\abbrtype}
+
+\setacronymstyle{long-short}
+
+\newcommand*{\newabbr}[1][]{%
+ \newacronym[abbrtype=initials,#1]}
+
+\newabbr{eg}{e.g.}{exempli gratia}
+\newabbr{ie}{i.e.}{id est}
+\newabbr{bsc}{B.Sc.}{Bachelor of Science}
+\newabbr{ba}{B.A.}{Bachelor of Arts}
+\newabbr{agm}{A.G.M.}{annual general meeting}
+
+\newacronym{laser}{laser}{light amplification by stimulated
+emission of radiation}
+
+ % See the sample-initialisms.tex example file provided with
+ % glossaries-extra.sty for a better way of doing this.
+
+\makeatletter
+\renewcommand{\glspostlinkhook}{%
+ \ifglsfieldeq{\glslabel}{abbrtype}{initials}%
+ {\new@ifnextchar.\doendsentence\doendword}
+ {}%
+}
+\makeatother
+
+\newcommand{\doendsentence}[1]{\spacefactor=10000{}}
+\newcommand{\doendword}{\spacefactor=1000{}}
+
+\begin{document}
+This is a sample document that illustrates abbreviations with
+full stops (periods) and abbreviations that are words (i.e.\
+acronyms). The examples switch to a typewriter font to make it
+easier to see the inter-word and inter-sentence spaces.
+
+The extension package glossaries-extra.sty provides a better way of
+doing this.
+
+First use: \gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} end of
+sentence.
+
+End of sentence use:
+
+\ttfamily
+
+\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}.
+Done.
+
+laser. e.g. i.e. B.Sc. B.A\@. A.G.M\@. Done.
+
+\rmfamily
+
+Mid-sentence use:
+
+\ttfamily
+
+\gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} Done.
+
+laser e.g.\ i.e.\ B.Sc.\ B.A. A.G.M. Done.
+
+\rmfamily
+
+Check other sentence terminators:
+
+\ttfamily
+
+\gls{laser}? \gls{eg}? \gls{ie}? \gls{bsc}! \gls{ba}! \gls{agm}? Done.
+
+laser? e.g.? i.e.? B.Sc.! B.A.! A.G.M.? Done.
+
+\rmfamily
+
+\glsresetall Reset. End of sentence use:
+
+\ttfamily
+
+\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}.
+Done.
+
+\rmfamily
+\printglossaries
+\end{document}