Debian Codegraph @

texmf-dist/doc/latex/glossaries/samples/sampleCustomAcr.tex

raw
1 % This file is public domain
2 % If you want to use arara, you need the following directives:
3 % arara: pdflatex: { synctex: on }
4 % arara: makeglossaries
5 % arara: pdflatex: { synctex: on }
6 % arara: pdflatex: { synctex: on }
7 %
8 %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sampleCustomAcr
9 \documentclass[a4paper]{report}
10
11 \usepackage[T1]{fontenc}% need support for bold smallcaps
12 \usepackage[colorlinks,plainpages=false]{hyperref}
13 \usepackage[acronym,% create 'acronym' glossary type
14 % The package option "nomain" is used here to suppress the
15 % main glossary, since this example doesn't use it. If you
16 % want to use the main glossary, remove the "nomain" option.
17 nomain,
18 style=altlist, % use altlist style
19 toc, % add the glossary to the table of contents
20 ]{glossaries}
21
22 \makeglossaries
23
24 % Define a new acronym style called "altfn" that's based on the
25 % footnote-sc-desc style
26
27 \newacronymstyle
28 {altfn}% style name
29 {% Inherit display style from "footnote-sc-desc"
30 \GlsUseAcrEntryDispStyle{footnote-sc-desc}%
31 }%
32 {% Inherit definitions from "footnote-sc-desc"
33 \GlsUseAcrStyleDefs{footnote-sc-desc}%
34 % Modify the first use display styles so they put the long form
35 % followed by the description in the footnote:
36 %
37 % First use of \gls:
38 \renewcommand*{\genacrfullformat}[2]{%
39 \protect\firstacronymfont{\glsentryshort{##1}}##2%
40 \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
41 }%
42 % First use of \Gls:
43 \renewcommand*{\Genacrfullformat}[2]{%
44 \firstacronymfont{\Glsentryshort{##1}}##2%
45 \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
46 }%
47 % First use of \glspl:
48 \renewcommand*{\genplacrfullformat}[2]{%
49 \protect\firstacronymfont{\glsentryshortpl{##1}}##2%
50 \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
51 }%
52 % First use of \Glspl:
53 \renewcommand*{\Genplacrfullformat}[2]{%
54 \protect\firstacronymfont{\Glsentryshortpl{##1}}##2%
55 \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
56 }%
57 % Sort according to long form:
58 \renewcommand*{\acronymsort}[2]{##2}%
59 % Set the name (as displayed in the glossary) to long (short)
60 \renewcommand*{\acronymentry}[1]{%
61 \glsentrylong{##1} (\acronymfont{\glsentryshort{##1}})}%
62 }
63
64 % Now use this new style:
65 \setacronymstyle{altfn}
66
67 % Change the "see" items so that they use \acronymfont:
68 \renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}}
69
70 \newacronym[description={Statistical pattern recognition
71 technique~\protect\cite{svm}}, % acronym's description
72 ]{svm}{svm}{support vector machine}
73
74 \newacronym[description={Statistical pattern recognition technique
75 using the ``kernel trick''},% acronym's description
76 see={[see also]{svm}},
77 ]{ksvm}{ksvm}{kernel
78 support vector machine}
79
80 \begin{document}
81 \tableofcontents
82
83 \chapter{Support Vector Machines}
84
85 The \gls{svm} is used widely in the area of pattern recognition.
86 % plural form with initial letter in uppercase:
87 \Glspl{svm} are \ldots\ (but beware, converting the initial letter to
88 upper case for a small caps acronym is sometimes considered
89 poor style).
90
91 Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full
92 version: \acrfull{svm}. Description: \glsentrydesc{svm}.
93
94 This is the entry in uppercase: \GLS{svm}.
95
96 \chapter{Kernel Support Vector Machines}
97
98 The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses
99 the so called ``kernel trick''. This is the entry's description without
100 a link: \glsentrydesc{ksvm}.
101
102 \glsresetall
103 (Reset all.)
104 Possessive: \gls{ksvm}['s].
105 Make the glossary entry number bold for this
106 one \gls[format=hyperbf]{svm}.
107
108 \begin{thebibliography}{1}
109 \bibitem{svm} \ldots
110 \end{thebibliography}
111
112 \printglossary
113
114 \end{document}