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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
|
\documentclass{article}
\usepackage{datagidx}
\usepackage[colorlinks]{hyperref}
% Make a glossary database labelled 'glossary' with given title.
\newgidx[heading=\section]{glossary}{Glossary}
% Make an acronym database labelled 'acronyms' with given title.
% A different heading for the table of contents is supplied.
\newgidx[heading={\section[Acronyms]}]{acronyms}{List of Acronyms}
% Make a notation database labelled 'notation' with given title
% Make it an unnumbered section
\newgidx[heading=\section*]{notation}{Notation}
% Define some terms for the glossary
\DTLgidxSetDefaultDB{glossary}
\newterm[description={sea mammal with flippers that eats
fish}]{seal}
\newterm[description={large seal}]{sea lion}
\newterm{bravo}
\newterm
[%
label=bravocry,
description={cry of approval (pl.\ bravos)},
parent=bravo
]
{bravo}
\newterm
[% options
label=bravokiller,
description={hired ruffian or killer (pl.\ bravoes)},
plural=bravoes,
parent=bravo
]
{bravo}
\newterm
[% options
plural={glossaries},
]%
{glossary}
\newterm
[% options
label=glossarycol,
plural={glossaries},
description={collection of glosses},
parent=glossary
]
{glossary}
\newterm
[% options
label=glossarylist,
plural={glossaries},
description={list of technical words},
parent=glossary
]
{glossary}
\newterm
[% options
% description contains commas so it must be grouped
description={a list of individual pages or page ranges
(e.g.\ 1,2,4,7--9)}
]
{page list}
\newterm
[%
plural={indices},
description={an alphabetical list of names or subjects with
references to their location in the document (pl.\ indices or
indexes)}
]
{index}
% define some acronyms
\DTLgidxSetDefaultDB{acronyms}
\newacro{html}{hyper-text markup language}
\newacro{css}{cascading style sheet}
% override default description on this one:
\newacro[description={eXtensible Markup Language}]{xml}{extensible markup language}
% define some notation
\DTLgidxSetDefaultDB{notation}
\newterm
[%
symbol={\ensuremath{\mathcal{S}}},
description={a collection of distinct objects},
]%
{set}
\newterm
[%
symbol={\ensuremath{\mathcal{U}}},
description={the set containing everything}
]%
{universal set}
\newterm
[%
symbol={\ensuremath{\emptyset}},
description={the set with no elements}
]%
{empty set}
\newterm
[%
symbol={\ensuremath{|\mathcal{S}|}},
description={the number of elements in the set
\ensuremath{\mathcal{S}}}
]%
{cardinality}
\title{Sample Document Using the datagidx Package}
\author{Nicola L. C. Talbot}
\begin{document}
\maketitle
Here's an acronym referenced using \verb|\acr|: \acr{html}.
And here
it is again: \acr{html}. If you're used to the \texttt{glossaries}
package, note the difference in using \verb|\gls|: \gls{html}.
And again (no difference): \gls{html}.
Here are some more entries:
\acr{xml} and \acr{css}.
Next use:
\acr{xml} and \acr{css}.
Full form:
\gls{xml} and \gls{css}.
Reset again. \glsresetall{acronyms}%
Start with a capital. \Acr{html}.
Next: \Acr{html}. Full: \Gls{html}.
Prefer capitals?
\renewcommand{\acronymfont}[1]{\MakeTextUppercase{#1}}%
\Acr{xml}. Next: \acr{xml}. Full: \gls{xml}.
Prefer small-caps?
\renewcommand{\acronymfont}[1]{\textsc{#1}}%
\Acr{css}. Next: \acr{css}. Full: \gls{css}.
A \gls{set} (denoted \glssym{set}) is a collection of objects.
The \gls{universal set} is the set of everything.
The \gls{empty set} contains no elements.
The \gls{cardinality} of a set (denoted \glssym{cardinality}) is the
number of elements in the set.
A \gls{glossarylist} is a useful
addition to any technical document,
although a \gls{glossarycol} can also simply be a collection of
glosses, which is another thing entirely. Some documents have
multiple \glspl{glossarylist}. Entries in a \gls{glossarylist} or
\gls{index} have an associated \gls{page list}.
A \gls{bravocry} is a cry of approval (plural \glspl{bravocry}) but
a
\gls{bravokiller} can also be a hired ruffian or killer (plural
\glspl{bravokiller}).
\newpage
Resetting all acronyms.\glsresetall{acronyms}
Here are the acronyms again:
\Acr{html}, \acr{xml} and \acr{css}.
Next use:
\Acr{html}, \acr{xml} and \acr{css}.
Full form:
\Gls{html}, \gls{xml} and \gls{css}.
\newpage
Provide your own link text: \glslink{[textbf]css}{style sheet}.
\newpage
\printterms
[
database=glossary,% 'glossary' database
columns=1,% one column page layout
postdesc=dot,% put a full stop after the description
style=gloss,% use 'gloss' style (sub-entries numbered)
namefont={\textbf},% put the name in bold
namecase=firstuc,% make the first letter of the name upper case
child=noname,% don't print sub item names
location=hide% hide the location list
]
\printterms
[
database=acronyms,% 'acronyms' database
postdesc=dot,% put a full stop after the description
columns=1,% one column page layout
namefont={\textbf},% put the name (i.e. the abbreviation) in bold
namecase=uc,% make the name upper case
style=align,% use the 'align' style
]
% Change the way the description is formatted (the argument to
% \DTLgidxFormatDesc will always be a control sequence so
% \xmakefirstuc is needed instead of \makefirstuc)
\renewcommand{\DTLgidxFormatDesc}[1]{\xmakefirstuc{#1}}
\printterms
[
database=notation,% 'notation' database
postdesc=dot,% put a full stop after the description
columns=1,% one page column layout
namefont={\textbf},% make the name bold
style=indexalign,
namecase=firstuc,% make first letter of name a capital
symboldesc={symbol desc},% put symbol to the left of description
%symboldesc={desc (symbol)},% put symbol to the right of the description
sort={},% don't sort
% If the following widths are 0 (default) they take up their natural
% amount of space. If the widths are greater than 0, those fields
% are put in a box of the given width.
symbolwidth={2cm},% width taken up by symbol
locationwidth={1cm},% width taken up by location list
]
\end{document}
|