| 1 |
\documentclass{article} |
| 2 |
|
| 3 |
\usepackage{datagidx} |
| 4 |
|
| 5 |
\usepackage[colorlinks]{hyperref} |
| 6 |
|
| 7 |
% Make a glossary database labelled 'glossary' with given title. |
| 8 |
|
| 9 |
\newgidx[heading=\section]{glossary}{Glossary} |
| 10 |
|
| 11 |
% Make an acronym database labelled 'acronyms' with given title. |
| 12 |
% A different heading for the table of contents is supplied. |
| 13 |
|
| 14 |
\newgidx[heading={\section[Acronyms]}]{acronyms}{List of Acronyms} |
| 15 |
|
| 16 |
% Make a notation database labelled 'notation' with given title |
| 17 |
% Make it an unnumbered section |
| 18 |
|
| 19 |
\newgidx[heading=\section*]{notation}{Notation} |
| 20 |
|
| 21 |
% Define some terms for the glossary |
| 22 |
|
| 23 |
\DTLgidxSetDefaultDB{glossary} |
| 24 |
|
| 25 |
\newterm[description={sea mammal with flippers that eats |
| 26 |
fish}]{seal} |
| 27 |
\newterm[description={large seal}]{sea lion} |
| 28 |
|
| 29 |
\newterm{bravo} |
| 30 |
\newterm |
| 31 |
[% |
| 32 |
label=bravocry, |
| 33 |
description={cry of approval (pl.\ bravos)}, |
| 34 |
parent=bravo |
| 35 |
] |
| 36 |
{bravo} |
| 37 |
\newterm |
| 38 |
[% options |
| 39 |
label=bravokiller, |
| 40 |
description={hired ruffian or killer (pl.\ bravoes)}, |
| 41 |
plural=bravoes, |
| 42 |
parent=bravo |
| 43 |
] |
| 44 |
{bravo} |
| 45 |
|
| 46 |
\newterm |
| 47 |
[% options |
| 48 |
plural={glossaries}, |
| 49 |
]% |
| 50 |
{glossary} |
| 51 |
|
| 52 |
\newterm |
| 53 |
[% options |
| 54 |
label=glossarycol, |
| 55 |
plural={glossaries}, |
| 56 |
description={collection of glosses}, |
| 57 |
parent=glossary |
| 58 |
] |
| 59 |
{glossary} |
| 60 |
|
| 61 |
\newterm |
| 62 |
[% options |
| 63 |
label=glossarylist, |
| 64 |
plural={glossaries}, |
| 65 |
description={list of technical words}, |
| 66 |
parent=glossary |
| 67 |
] |
| 68 |
{glossary} |
| 69 |
|
| 70 |
\newterm |
| 71 |
[% options |
| 72 |
% description contains commas so it must be grouped |
| 73 |
description={a list of individual pages or page ranges |
| 74 |
(e.g.\ 1,2,4,7--9)} |
| 75 |
] |
| 76 |
{page list} |
| 77 |
|
| 78 |
\newterm |
| 79 |
[% |
| 80 |
plural={indices}, |
| 81 |
description={an alphabetical list of names or subjects with |
| 82 |
references to their location in the document (pl.\ indices or |
| 83 |
indexes)} |
| 84 |
] |
| 85 |
{index} |
| 86 |
|
| 87 |
% define some acronyms |
| 88 |
|
| 89 |
\DTLgidxSetDefaultDB{acronyms} |
| 90 |
|
| 91 |
\newacro{html}{hyper-text markup language} |
| 92 |
\newacro{css}{cascading style sheet} |
| 93 |
|
| 94 |
% override default description on this one: |
| 95 |
\newacro[description={eXtensible Markup Language}]{xml}{extensible markup language} |
| 96 |
|
| 97 |
% define some notation |
| 98 |
|
| 99 |
\DTLgidxSetDefaultDB{notation} |
| 100 |
|
| 101 |
\newterm |
| 102 |
[% |
| 103 |
symbol={\ensuremath{\mathcal{S}}}, |
| 104 |
description={a collection of distinct objects}, |
| 105 |
]% |
| 106 |
{set} |
| 107 |
|
| 108 |
\newterm |
| 109 |
[% |
| 110 |
symbol={\ensuremath{\mathcal{U}}}, |
| 111 |
description={the set containing everything} |
| 112 |
]% |
| 113 |
{universal set} |
| 114 |
|
| 115 |
\newterm |
| 116 |
[% |
| 117 |
symbol={\ensuremath{\emptyset}}, |
| 118 |
description={the set with no elements} |
| 119 |
]% |
| 120 |
{empty set} |
| 121 |
|
| 122 |
\newterm |
| 123 |
[% |
| 124 |
symbol={\ensuremath{|\mathcal{S}|}}, |
| 125 |
description={the number of elements in the set |
| 126 |
\ensuremath{\mathcal{S}}} |
| 127 |
]% |
| 128 |
{cardinality} |
| 129 |
|
| 130 |
\title{Sample Document Using the datagidx Package} |
| 131 |
\author{Nicola L. C. Talbot} |
| 132 |
|
| 133 |
\begin{document} |
| 134 |
|
| 135 |
\maketitle |
| 136 |
|
| 137 |
Here's an acronym referenced using \verb|\acr|: \acr{html}. |
| 138 |
And here |
| 139 |
it is again: \acr{html}. If you're used to the \texttt{glossaries} |
| 140 |
package, note the difference in using \verb|\gls|: \gls{html}. |
| 141 |
And again (no difference): \gls{html}. |
| 142 |
|
| 143 |
Here are some more entries: |
| 144 |
|
| 145 |
\acr{xml} and \acr{css}. |
| 146 |
Next use: |
| 147 |
\acr{xml} and \acr{css}. |
| 148 |
Full form: |
| 149 |
\gls{xml} and \gls{css}. |
| 150 |
|
| 151 |
Reset again. \glsresetall{acronyms}% |
| 152 |
Start with a capital. \Acr{html}. |
| 153 |
Next: \Acr{html}. Full: \Gls{html}. |
| 154 |
|
| 155 |
Prefer capitals? |
| 156 |
\renewcommand{\acronymfont}[1]{\MakeUppercase{#1}}% |
| 157 |
\Acr{xml}. Next: \acr{xml}. Full: \gls{xml}. |
| 158 |
|
| 159 |
Prefer small-caps? |
| 160 |
\renewcommand{\acronymfont}[1]{\textsc{#1}}% |
| 161 |
\Acr{css}. Next: \acr{css}. Full: \gls{css}. |
| 162 |
|
| 163 |
A \gls{set} (denoted \glssym{set}) is a collection of objects. |
| 164 |
The \gls{universal set} is the set of everything. |
| 165 |
The \gls{empty set} contains no elements. |
| 166 |
The \gls{cardinality} of a set (denoted \glssym{cardinality}) is the |
| 167 |
number of elements in the set. |
| 168 |
|
| 169 |
A \gls{glossarylist} is a useful |
| 170 |
addition to any technical document, |
| 171 |
although a \gls{glossarycol} can also simply be a collection of |
| 172 |
glosses, which is another thing entirely. Some documents have |
| 173 |
multiple \glspl{glossarylist}. Entries in a \gls{glossarylist} or |
| 174 |
\gls{index} have an associated \gls{page list}. |
| 175 |
|
| 176 |
A \gls{bravocry} is a cry of approval (plural \glspl{bravocry}) but |
| 177 |
a |
| 178 |
\gls{bravokiller} can also be a hired ruffian or killer (plural |
| 179 |
\glspl{bravokiller}). |
| 180 |
|
| 181 |
\newpage |
| 182 |
|
| 183 |
Resetting all acronyms.\glsresetall{acronyms} |
| 184 |
|
| 185 |
Here are the acronyms again: |
| 186 |
|
| 187 |
\Acr{html}, \acr{xml} and \acr{css}. |
| 188 |
|
| 189 |
Next use: |
| 190 |
\Acr{html}, \acr{xml} and \acr{css}. |
| 191 |
|
| 192 |
Full form: |
| 193 |
\Gls{html}, \gls{xml} and \gls{css}. |
| 194 |
|
| 195 |
\newpage |
| 196 |
|
| 197 |
Provide your own link text: \glslink{[textbf]css}{style sheet}. |
| 198 |
|
| 199 |
\newpage |
| 200 |
|
| 201 |
\printterms |
| 202 |
[ |
| 203 |
database=glossary,% 'glossary' database |
| 204 |
columns=1,% one column page layout |
| 205 |
postdesc=dot,% put a full stop after the description |
| 206 |
style=gloss,% use 'gloss' style (sub-entries numbered) |
| 207 |
namefont={\textbf},% put the name in bold |
| 208 |
namecase=firstuc,% make the first letter of the name upper case |
| 209 |
child=noname,% don't print sub item names |
| 210 |
location=hide% hide the location list |
| 211 |
] |
| 212 |
|
| 213 |
\printterms |
| 214 |
[ |
| 215 |
database=acronyms,% 'acronyms' database |
| 216 |
postdesc=dot,% put a full stop after the description |
| 217 |
columns=1,% one column page layout |
| 218 |
namefont={\textbf},% put the name (i.e. the abbreviation) in bold |
| 219 |
namecase=uc,% make the name upper case |
| 220 |
style=align,% use the 'align' style |
| 221 |
] |
| 222 |
|
| 223 |
% Change the way the description is formatted (the argument to |
| 224 |
% \DTLgidxFormatDesc will always be a control sequence so |
| 225 |
% \xmakefirstuc is needed instead of \makefirstuc) |
| 226 |
\renewcommand{\DTLgidxFormatDesc}[1]{\xmakefirstuc{#1}} |
| 227 |
|
| 228 |
\printterms |
| 229 |
[ |
| 230 |
database=notation,% 'notation' database |
| 231 |
postdesc=dot,% put a full stop after the description |
| 232 |
columns=1,% one page column layout |
| 233 |
namefont={\textbf},% make the name bold |
| 234 |
style=indexalign, |
| 235 |
namecase=firstuc,% make first letter of name a capital |
| 236 |
symboldesc={symbol desc},% put symbol to the left of description |
| 237 |
%symboldesc={desc (symbol)},% put symbol to the right of the description |
| 238 |
sort={},% don't sort |
| 239 |
% If the following widths are 0 (default) they take up their natural |
| 240 |
% amount of space. If the widths are greater than 0, those fields |
| 241 |
% are put in a box of the given width. |
| 242 |
symbolwidth={2cm},% width taken up by symbol |
| 243 |
locationwidth={1cm},% width taken up by location list |
| 244 |
] |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
\end{document} |