Debian Codegraph @

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

raw
1 % This file is public domain.
2 %
3 % This is a sample document illustrating how to use the
4 % glossaries package with xindy. To create the document:
5 %
6 % latex samplexdy
7 % makeglossaries samplexdy
8 % latex samplexdy
9 %
10 % If you don't have Perl installed, then use one of the
11 % following instead of makeglossaries:
12 %
13 % If you want to have a separate "Mc" letter group do:
14 %
15 % xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo
16 %
17 % Otherwise do:
18 %
19 % xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo
20 %
21 % If you want to use arara, you need the following directives:
22 % arara: pdflatex: { synctex: on }
23 % arara: makeglossaries
24 % arara: pdflatex: { synctex: on }
25 %
26 %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#samplexdy3
27 \documentclass{article}
28
29 \usepackage[utf8]{inputenc}
30 \usepackage[T1]{fontenc}
31 \usepackage{fmtcount}
32
33 \usepackage[colorlinks,plainpages]{hyperref}
34 \usepackage[xindy,esclocations,style=altlistgroup]{glossaries}
35
36 % Define a new command to do bold italic:
37
38 \newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}}
39
40 % Need to add this to the list of attributes in order
41 % to use it with xindy:
42 % (This command will have no effect if \noist is used)
43
44 \GlsAddXdyAttribute{hyperbfit}
45
46 % Redefine the page numbers so that they appear as a word:
47
48 \renewcommand*{\thepage}{\texorpdfstring{\customfmt{page}}{\arabic{page}}}
49
50 \newcommand{\customfmt}[1]{\customfmtnum{\arabic{#1}}}
51 \newrobustcmd{\customfmtnum}[1]{\Numberstringnum{#1}}
52
53 % Need to add this to the list of location styles.
54 % \customfmt{page} gets expanded to
55 % \custommfmtnum {<n>} (where <n> is the page number)
56 % so need to define the location in that format:
57 % (This command will have no effect if \noist is used)
58
59 \GlsAddXdyLocation{customfmt}{:sep "\string\customfmtnum\space\glsopenbrace"
60 "arabic-numbers" :sep "\glsclosebrace"}
61
62 % (Need to redefine \glsXpageXhyperbfit and
63 % \glsXpageXglsnumberformat after \makeglossaries to get the
64 % hyperlinks working correctly.)
65
66 % To have Mc as a separate group uncomment the following three
67 % lines:
68
69 %\setStyleFile{samplexdy-mc} % note no extension
70 %\noist
71 %\GlsSetXdyLanguage{}
72
73 % The above three lines specify to use samplexdy-mc.xdy (supplied
74 % with this file) and don't overwrite it. The language is
75 % unset using \GlsSetXdyLanguage{} as all the language
76 % dependent information is contained in samplexdy-mc.xdy
77 % Note that using \noist means that commands like
78 % \GlsAddXdyAttribute and \GlsAddXdyLocation will no longer have
79 % an effect.
80
81 % Write the style file (if \noist isn't used)
82 % and activate glossary entries
83
84 \makeglossaries
85
86 % Each page location will be specified in the form:
87 %
88 % "\glsXpageXglsnumberformat{}{\customfmtnum "\marg{n}"}"
89 % or
90 % "\glsXpageXhyperbfit{}{\customfmtnum "\marg{n}"}"
91 %
92 % Redefine to allow hyperlinks:
93
94 \renewcommand{\glsXpageXglsnumberformat}[2]{%
95 \linkpagenumber#2%
96 }
97
98 \renewcommand{\glsXpageXhyperbfit}[2]{%
99 \textbf{\em\linkpagenumber#2}%
100 }
101
102 % The arguments of \linkpagenumber will be
103 % #1 -> \customfmtnum
104 % #2 -> n
105 % This means that the page number (n) can be used to
106 % form the hyperlink target.
107 \newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}}
108
109 % Define glossary entries
110 % \glshyperlink is used instead of \gls to prevent the glossary
111 % page numbers also appear in the locations, however I need
112 % to ensure that the referenced entries are added to the
113 % glossary via commands that use \glslink, \glsadd or \glssee
114
115 \newglossaryentry{mcadam}{name={McAdam, John Loudon},
116 first={John Loudon McAdam},text={McAdam},
117 description={Scottish engineer}}
118
119 \newglossaryentry{maclaurin}{name={Maclaurin, Colin},
120 first={Colin Maclaurin},text={Maclaurin},
121 description={Scottish mathematician best known for the
122 \gls{maclaurinseries}}}
123
124 \newglossaryentry{maclaurinseries}{name={Maclaurin series},
125 description={Series expansion},see={taylorstheorem}}
126
127 \newglossaryentry{taylorstheorem}{name={Taylor's theorem},
128 description={Theorem expressing a function $f(x)$ as the sum of
129 a polynomial and a remainder:
130 \[f(x) = f(a)+f'(a)(x-a)+f''(a)(x-a^2)/2!+\cdots+R_n\]
131 If $n\to\infty$ the expansion is a \glshyperlink{taylorseries}
132 and if $a=0$, the series is called a
133 \gls{maclaurinseries}}}
134
135 \newglossaryentry{taylorseries}{name={Taylor series},
136 description={Series expansion},see={taylorstheorem}}
137
138 \newglossaryentry{taylor}{name={Taylor, Brook},
139 first={Brook Taylor},text={Taylor},
140 description={English mathematician}}
141
142 \newglossaryentry{mcnemar}{name={McNemar, Quinn},
143 first={Quinn McNemar},text={McNemar},
144 description={Mathematician who introduced
145 \gls{mcnemarstest}. This entry has the number list
146 suppressed},nonumberlist}
147
148 \newglossaryentry{mcnemarstest}{name={McNemar's test},
149 description={A nonparametric test introduced by
150 \gls{mcnemar} in 1947}}
151
152 \newglossaryentry{mach}{name={Mach, Ernst},
153 first={Ernst Mach},text={Mach},
154 % if using samplexdy-mc.xdy, the following line is needed
155 % to prevent this entry being put in the "Mc" group
156 sort={mach, Ernst},
157 description={Czech/Austrian physicist and philosopher}}
158
159 \newglossaryentry{machnumber}{name={Mach number},
160 % if using samplexdy-mc.xdy, the following line is needed
161 % to prevent this entry being put in the "Mc" group
162 sort={mach number},
163 description={Ratio of the speed of a body in a fluid to the
164 speed of sound in that fluid named after \gls{mach}}}
165
166 \newglossaryentry{malthus}{name={Malthus, Thomas Robert},
167 first={Thomas Robert Malthus},text={Malthus},
168 description={English mathematician, sociologist and classicist}}
169
170 \newglossaryentry{ampereandre}{name={Ampère, André-Marie},
171 first={André-Marie Ampère},text={Ampère},
172 description={French mathematician and physicist}}
173
174 \newglossaryentry{ampere}{name={ampere},
175 description={SI unit of electric current named after
176 \gls{ampereandre}}}
177
178 \newglossaryentry{archimedes}{name={Archimedes of Syracuse},
179 first={Archimedes of Syracuse},text={Archimedes},
180 description={Greek mathematician}}
181
182 \newglossaryentry{archimedesprinciple}{name={Archimedes' principle},
183 description={Principle that if a body is submerged in a fluid
184 it experiences upthrust equal to the weight of the displaced
185 fluid. Named after \gls{archimedes}}}
186
187 \newglossaryentry{galton}{name={Galton, Sir Francis},
188 first={Sir Francis Galton},text={Galton},
189 description={English anthropologist}}
190
191 \newglossaryentry{gauss}{name={Gauss, Karl Friedrich},
192 first={Karl Friedrich Gauss},text={Gauss},
193 description={German mathematician}}
194
195 \newglossaryentry{gaussianint}{name={Gaussian integer},
196 description={Complex number where both real and imaginary
197 parts are integers}}
198
199 \newglossaryentry{gaussianfn}{name={Gaussian function},
200 description={A function of the form:
201 \[f(x) = a \exp\left(-\frac{(x-b)^2}{2c^2}\right)\]
202 for some constants $a$, $b$ and $c$}}
203
204 \newglossaryentry{peano}{name={Peano, Giuseppe},
205 first={Giuseppe Peano},text={Peano},
206 description={Italian mathematician}}
207
208 \newglossaryentry{peanoscurve}{name={Peano's curve},
209 description={A space-filling curve discovered by
210 \gls{peano}}}
211
212 \newglossaryentry{pearson}{name={Pearson, Karl},
213 first={Karl Pearson},text={Pearson},
214 description={English mathematician}}
215
216 \newglossaryentry{pearspmcc}{name={Pearson's product moment
217 correlation coefficient},description={Product moment correlation
218 coefficient named after \gls{pearson}}}
219
220 \begin{document}
221 \title{Sample Document Using the Glossaries Package With Xindy}
222 \author{Nicola Talbot}
223 \maketitle
224
225 \section{\glsentryfirst{gauss}}
226
227 This is a section on
228 \gls[format=(]{gauss}. This section spans
229 several pages.
230
231 \rule{1pt}{0.6\textheight}
232
233 This paragraph has been shoved to the bottom of the page using a rule.
234 This paragraph spans a page break for testing purposes to ensure the
235 glossary entry in this paragraph has the correct location. Here's
236 the glossary entry: \gls{gaussianfn}.
237
238 This page talks about \glspl[format=hyperbfit]{gaussianint}. Since
239 it's the principle definition, the user-defined hyperbfit format is
240 used.
241
242 \newpage
243
244 The section on \gls[format=)]{gauss} ends here.
245
246 \section{Series Expansions}
247
248 This section is about series expansions. It mentions
249 \gls{maclaurin} and \gls{taylor}. It also discusses
250 \gls{taylorstheorem} which is related to the \gls{taylorseries}.
251 The \gls{maclaurinseries} is a special case of the
252 \gls{taylorseries}.
253
254 \section{\glsentryname{archimedesprinciple}}
255
256 This section discusses \gls{archimedesprinciple} which was
257 introduced by \gls{archimedes}.
258
259 \section{Another section}
260
261 This section covers \gls{mach} who introduced the \gls{machnumber}.
262 It also mentions \gls{ampereandre} after whom the
263 SI unit \gls{ampere} is named. It then discusses \gls{galton}
264 and \gls{malthus}. Finally it mentions \gls{mcadam}.
265
266 \newpage
267 This page discusses \gls{mcnemar} who introduced
268 \gls{mcnemarstest} and \gls{peano} who discovered \gls{peanoscurve}.
269
270 \printglossaries
271 \end{document}