Debian Codegraph @

texmf-dist/doc/latex/glossaries/samples/sample-font-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-font-abbr
8 \documentclass{article}
9
10 \usepackage{glossaries}
11
12 \makeglossaries
13
14 \glsaddstoragekey{font}{}{\entryfont}
15
16 \newacronymstyle{long-font-short}
17 {%
18 \GlsUseAcrEntryDispStyle{long-short}%
19 }
20 {%
21 \GlsUseAcrStyleDefs{long-short}%
22 \renewcommand*{\genacrfullformat}[2]{%
23 \glsentrylong{##1}##2\space
24 ({\entryfont{##1}\glsentryshort{##1}})%
25 }%
26 \renewcommand*{\Genacrfullformat}[2]{%
27 \Glsentrylong{##1}##2\space
28 ({\entryfont{##1}\glsentryshort{##1}})%
29 }%
30 \renewcommand*{\genplacrfullformat}[2]{%
31 \glsentrylongpl{##1}##2\space
32 ({\entryfont{##1}\glsentryshortpl{##1}})%
33 }%
34 \renewcommand*{\Genplacrfullformat}[2]{%
35 \Glsentrylongpl{##1}##2\space
36 ({\entryfont{##1}\glsentryshortpl{##1}})%
37 }%
38 \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}%
39 \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}%
40 }
41
42 \setacronymstyle{long-font-short}
43
44 \newcommand*{\newitabbr}[1][]{\newacronym[font=\em,#1]}
45 \newcommand*{\newupabbr}{\newacronym}
46
47 \newitabbr{eg}{e.g.}{exempli gratia}
48 \newitabbr{ie}{i.e.}{id est}
49
50 \newupabbr{bsc}{BSc}{Bachelor of Science}
51 \newupabbr{ba}{BA}{Bachelor of Arts}
52 \newupabbr{agm}{AGM}{annual general meeting}
53
54 \begin{document}
55
56 First use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}.
57
58 Next use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}.
59
60 Short: \acrshort{eg} \acrshort{ie} \acrshort{bsc} \acrshort{ba}
61 \acrshort{agm}.
62
63 Full: \acrfull{eg} \acrfull{ie} \acrfull{bsc} \acrfull{ba}
64 \acrfull{agm}.
65
66 \printglossaries
67 \end{document}