summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries/samples/sampleCustomAcr.tex
blob: bc32d1329ab40d3512ce17d66d3a1a181c41366a (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
% This file is public domain
% If you want to use arara, you need the following directives:
% arara: pdflatex: { synctex: on }
% arara: makeglossaries
% arara: pdflatex: { synctex: on }
% arara: pdflatex: { synctex: on }
\documentclass[a4paper]{report}

\usepackage[colorlinks,plainpages=false]{hyperref}
\usepackage[acronym,% create 'acronym' glossary type
% The package option "nomain" is used here to suppress the
% main glossary, since this example doesn't use it. If you
% want to use the main glossary, remove the "nomain" option.
            nomain,
            style=altlist, % use altlist style
            toc, % add the glossary to the table of contents
           ]{glossaries}

\makeglossaries

% Define a new acronym style called "altfn" that's based on the
% footnote-sc-desc style

\newacronymstyle
 {altfn}% style name
 {% Inherit display style from "footnote-sc-desc"
   \GlsUseAcrEntryDispStyle{footnote-sc-desc}%
 }%
 {% Inherit definitions from "footnote-sc-desc"
    \GlsUseAcrStyleDefs{footnote-sc-desc}%
% Modify the first use display styles so they put the long form
% followed by the description in the footnote:
%
% First use of \gls:
  \renewcommand*{\genacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshort{##1}}##2%
   \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
  }%
% First use of \Gls:
  \renewcommand*{\Genacrfullformat}[2]{%
   \firstacronymfont{\Glsentryshort{##1}}##2%
   \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
  }%
% First use of \glspl:
  \renewcommand*{\genplacrfullformat}[2]{%
   \protect\firstacronymfont{\glsentryshortpl{##1}}##2%
   \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
  }%
% First use of \Glspl:
  \renewcommand*{\Genplacrfullformat}[2]{%
   \protect\firstacronymfont{\Glsentryshortpl{##1}}##2%
   \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
  }%
% Sort according to long form:
  \renewcommand*{\acronymsort}[2]{##2}%
% Set the name (as displayed in the glossary) to long (short)
  \renewcommand*{\acronymentry}[1]{%
     \glsentrylong{##1} (\acronymfont{\glsentryshort{##1}})}%
% Since bold small caps isn't supported with this document's
% fonts, adjust \acronymfont so that it switches to medium
% small caps:
  \renewcommand{\acronymfont}[1]{\textmd{\scshape ##1}}%
 }

% Now use this new style:
\setacronymstyle{altfn}

% Change the "see" items so that they use \acronymfont:
\renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}}

\newacronym[description={Statistical pattern recognition
technique~\protect\cite{svm}}, % acronym's description
]{svm}{svm}{support vector machine}

\newacronym[description={Statistical pattern recognition technique
using the ``kernel trick''},% acronym's description
see={[see also]{svm}},
]{ksvm}{ksvm}{kernel
support vector machine}

\begin{document}
\tableofcontents

\chapter{Support Vector Machines}

The \gls{svm} is used widely in the area of pattern recognition.
% plural form with initial letter in uppercase:
\Glspl{svm} are \ldots\ (but beware, converting the initial letter to
upper case for a small caps acronym is sometimes considered
poor style).

Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full
version: \acrfull{svm}. Description: \glsentrydesc{svm}.

This is the entry in uppercase: \GLS{svm}.

\chapter{Kernel Support Vector Machines}

The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses
the so called ``kernel trick''. This is the entry's description without
a link: \glsentrydesc{ksvm}.

\glsresetall
(Reset all.)
Possessive: \gls{ksvm}['s].
Make the glossary entry number bold for this
one \gls[format=hyperbf]{svm}.

\begin{thebibliography}{1}
\bibitem{svm} \ldots
\end{thebibliography}

\printglossary

\end{document}