summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries/samples/sample-font-abbr.tex
blob: 43b744f8f1b3ca8d1a9d9fbda77f26503daf9e3d (plain)
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
% This file is public domain.
% If you want to use arara you need the following directives:
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage{glossaries}

\makeglossaries

\glsaddstoragekey{font}{}{\entryfont}

\newacronymstyle{long-font-short}
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glsentrylong{##1}##2\space
   ({\entryfont{##1}\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \Glsentrylong{##1}##2\space
   ({\entryfont{##1}\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{##1}##2\space
   ({\entryfont{##1}\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \Glsentrylongpl{##1}##2\space
   ({\entryfont{##1}\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}%
  \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}%
}

\setacronymstyle{long-font-short}

\newcommand*{\newitabbr}[1][]{\newacronym[font=\em,#1]}
\newcommand*{\newupabbr}[1][]{\newacronym[#1]}

\newitabbr{eg}{e.g.}{exempli gratia}
\newitabbr{ie}{i.e.}{id est}

\newupabbr{bsc}{BSc}{Bachelor of Science}
\newupabbr{ba}{BA}{Bachelor of Arts}
\newupabbr{agm}{AGM}{annual general meeting}

\begin{document}

First use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}.

Next use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}.

Short: \acrshort{eg} \acrshort{ie} \acrshort{bsc} \acrshort{ba}
\acrshort{agm}.

Full: \acrfull{eg} \acrfull{ie} \acrfull{bsc} \acrfull{ba}
\acrfull{agm}.

\printglossaries
\end{document}