Debian Codegraph @

texmf-dist/doc/latex/gloss/gloss.tex

raw
1 % +--------------------------------------------------+
2 % | Typeset this file to get the documentation. |
3 % +--------------------------------------------------+
4 %
5 % (c) 1998 Jose Luis Diaz, 1999-2002 Jose Luis Diaz and Javier Bezos.
6 % All Rights Reserved.
7 %
8 % This file is part of the gloss distribution release 1.5.2
9 % -----------------------------------------------------------
10 %
11 % This file can be redistributed and/or modified under the terms
12 % of the LaTeX Project Public License Distributed from CTAN
13 % archives in directory macros/latex/base/lppl.txt; either
14 % version 1 of the License, or any later version.
15
16 \def\fileversion{1.5.2}
17 \def\docdate{July 26, 2002}
18
19 \documentclass{ltxguide}
20 \usepackage{hyperref}
21
22 \title{The \textsf{gloss} Package\footnote{The
23 \textsf{gloss} package is currently at version \fileversion. \copyright{}
24 1998 Jose Luis Diaz,
25 1999-2001 Jose Luis Diaz and Javier Bezos. All Rights Reserved.}}
26
27 \author{Jose Luis D\'{\i}iaz\\Javier Bezos\footnote{For bug reports, comments and
28 suggestions go to \href{http://www.texytipografia.com/contact.php}%
29 {http://www.texytipografia.com/contact.php}. New \texttt{.bst} styles
30 are also welcome. English is not my strong point, so contact me when
31 you find mistakes in the manual. Other packages by Javier Bezos:
32 \textsf{accents, tensind, esindex, titlesec, titletoc, dotlessi}.}}
33
34 \date{\docdate}
35
36 \addtolength{\topmargin}{-3pc}
37 \addtolength{\textwidth}{6pc}
38 \addtolength{\oddsidemargin}{-2pc}
39 \addtolength{\textheight}{7pc}
40
41 \raggedright
42 \parindent1em
43
44 \newcommand{\gloss}{\textsf{gloss}}
45 \newcommand{\bibTeX}{\textsc{Bib}\TeX}
46
47 \begin{document}
48
49 \maketitle
50
51 \textsf{Gloss} is a package which allows the creation of glossaries
52 using \bibTeX. With this approach, the user writes a database of terms
53 and definitions using a file format much like the bibliographic
54 databases. Then he inserts in the \LaTeX{} document a command
55 |\gloss{<key>}| for selecting which entries he wants to appear in the
56 glossary. These keys are written in an auxiliar file when \LaTeX{} is
57 run on the document. Then, running \bibTeX{} these entries are
58 extracted from the database and collected in alphabetical order in a
59 file. The next run of \LaTeX{} read this file and inserts it in the
60 appropiate point of the document, typesetting the desired glossary or
61 glossaries.
62
63 The process is much like the mechanism for including the bibliographic
64 references. This approach has several advantages:
65 \begin{enumerate}
66 \item \bibTeX{} is available in every platform where \TeX{} is.
67 \item Glossary entries can be stored in databases, and you needn't
68 rewrite the definitions.
69 \item There are a lot of tools for managing \bibTeX{} databases.
70 \item \bibTeX{} can sort the entries and group them; furthermore,
71 \bibTeX-8 can sort correctly the entries in non-English
72 languages. (In fact, this is the main raison which the package
73 was first developped for.)
74 \item \bibTeX{} is a programable tool and you can define your own
75 styles for acronyms, symbols, and so on, or changing its default
76 behaviour. \textsf{Gloss} styles are pretty simples and creating
77 new ones is not difficult.
78 \end{enumerate}
79
80 Of course, there also disavantages---for example, you cannot
81 select sorting entries word by word or letter by letter, at least
82 at present.
83
84 The gloss{} bundle includes the \textsf{gloss}.sty package, a
85 \textsf{glsplain}.bst style, a \textsf{glsbase}.bib database, and a
86 \texttt{sample.tex} file with its \texttt{sample.bib} database
87 (and, of course, the \texttt{readme} file and this manual).
88
89 \section{The data files}
90
91 If you know \bibTeX, you will find this section easy to understand.
92 A data file contains a set of records defining terms, and its
93 name must have the extension \texttt{.bib}. Every entry has the
94 following format:
95 \begin{verbatim}
96 @gd{gnu,
97 word = {gnu},
98 definition = {Extrange animal}
99 }
100 \end{verbatim}
101
102 Here
103 \begin{itemize}
104 \item |gnu| is a key identifying the record;
105 \item |word| is the word which will be used as headword and in the
106 text; and
107 \item |definition| is the definition printed in the glossary.
108 \end{itemize}
109
110 Here is the description of the available fields, and when they are used
111 \begin{description}
112 \item[word] Required. It should be given always as it would be
113 written at the middle of a sentence. The basic style
114 \textsf{glsplain} converts its first letter to uppercase for use after
115 a period. In the generated glossary, entries with the
116 same initial are grouped, preceded by a heading with that letter.
117
118 \item[definition] Required. The definition can be as long an you
119 want, but you should note that implicit paragraphs (those with a
120 blank line) are ignored and a |\par| would be necessary. The final
121 period should be omitted because it is supplied later (and sometimes it
122 will be replaced by a comma).
123
124 \item[short] Optional. A short form. It could be a symbol, an
125 acronym, etc. depending on the nature of the glossary.
126
127 \item[sort-word] Optional. If present, this field will be used to
128 sort the entries. It is useful in greek symbols and signs, for
129 example.
130
131 \item[group] Optional. This field should consist in an uppercase
132 letter and is intended for entries not beginning (or not containing)
133 letters. Entries with the same |group| are gathered in the glossary
134 under a single heading and sorted in the whole glossary using this
135 letter, with entries without |group| placed as if they had a group
136 key of |L|. Using both |sort-word| and this field allows grouping,
137 say, greek symbols, numbers, signs and the like under seperate
138 headings. More on that later.
139
140 \item[heading] Optional. It forces an entry to be listed under the
141 given heading. Useful in non-English languages when
142 letters with diacriticals are used (even with \bibTeX-8):
143 \begin{verbatim}
144 @gd{gnu,
145 word = "{\'A}nimo",
146 definition = "...",
147 heading = "A"}
148 \end{verbatim}
149 This field is uncompatible with |group|.
150
151 \end{description}
152
153 The |@gd| entry type is the only available currently in |glsplain|.
154 |@glossdef| is a synonymous.
155
156 The default |crossref| field is available, but in glossaries is mostly
157 unpractical except in a few cases (for example, in a list of symbols
158 with the same greek letter with many meanings).
159
160 \section{Basic commands}
161
162 \begin{decl}
163 |\makegloss|
164 \end{decl}
165
166 This command in the preamble tells \gloss{} to create a glossary.
167
168 \begin{decl}
169 |\gloss{<key>}|
170 \end{decl}
171
172 Similar to |\cite|. It writes a ``citation'' to the auxiliary file
173 |.gls.aux|. Sadly, this double extension is necessary because
174 \bibTeX{} requires the input file to be named with the |.aux|
175 extension. Below is explained how MS-DOS users can work around that.
176 Note that this file is not reread by the document, it just
177 provides information to \bibTeX\ of terms cited.
178
179 \begin{decl}
180 |\printgloss{<databases>}|
181 \end{decl}
182
183 Similar to |\bibliography|. It prints the glossary stored into the
184 |.gls.bbl| file generated by \bibTeX{} from |.gls.aux|.
185
186 In this basic interface the \textsf{glsplain} style is used always.
187
188 \section{The generated glossary}
189
190 The steps to generate and use the glossary are:
191 \begin{itemize}
192 \item \LaTeX{} the document (let's call it |file.tex|),
193 \item \bibTeX\ the |.gls.aux| file (i.e., |bibtex file.gls|),
194 \item \LaTeX{} the document again, and
195 \item \LaTeX{} again if there are unresolved cross references.
196 \end{itemize}
197
198 Once \LaTeX{}ed the document, and \bibTeX{}ed the |.gls.aux| file,
199 you will get the glossary in the |.gls.bbl| with the following \TeX{}
200 format:
201 \begin{itemize}
202
203 \item the whole glossary is enclosed in the |thegloss| environment,
204 which just prints the sectioning heading whith the |\glossname| title;
205
206 \item a series of |\glossheading|s (or |\glossgroup|s) commands
207 and |glossitem|s environments. Note that gloss items are not
208 commands but environments. The |glossitem*| environment means that
209 the definition of the entry ends with a period.
210
211 \end{itemize}
212
213 \section{The whole thing}
214
215 Most of the formatting is done by the package and not by \bibTeX. The
216 \textsf{glsplain} style provides two forms, sometimes three, of
217 terms: the basic form as given in |word| to be used in the text,
218 and probably as headword, the second one is |word| with the first
219 letter uppercased to be used at the beginning of a sentence; and only
220 if |short| was included, a short form.
221
222 Not surprisingly, the syntax of the \gloss{} commands is very
223 alike to that of bibliographies with some touches from that
224 of indexes.
225
226 \subsection{Package options}
227
228 \begin{decl}
229 |refpages|
230 \end{decl}
231
232 The number of the first page where the term is referred to, is
233 appended to the gloss entry.
234
235 \subsection{Multiple glossaries}
236
237 \begin{decl}
238 |\makegloss|\\
239 |\newgloss{<name>}{<suffix>}{<title>}{<style>}|
240 \end{decl}
241
242 For defining a new glossary use |\newgloss|. The |\makegloss|
243 command is just a synonymous with
244 \begin{verbatim}
245 \newgloss{default}{.gls}{\glossname}{glsplain}
246 \end{verbatim}
247 Note that the suffix does include the dot.
248
249 MS-DOS users must use |\newgloss| instead of |\makegloss|, and
250 a document name with at most seven letters. For instance:
251 \begin{verbatim}
252 \newgloss{default}{G}{\glossname}{glsplain}
253 \end{verbatim}
254 Note that, in this case, the suffix does not include the dot
255 (this way we avoid double extensions).
256
257 \begin{decl}
258 |\printgloss[<name>]{<databases>}|
259 \end{decl}
260
261 Prints the |<name>| glossary. By default, the |default| one
262 is printed.
263
264 \subsection{The \texttt{\string\gloss} command}
265
266 \begin{decl}
267 |\gloss[<options>]{<key>}|
268 \end{decl}
269
270 Possible options are:
271 \begin{itemize}
272 \item |nocite| makes the command behave in the same fashion
273 as |\nocite|. For example, with |\gloss[nocite]{*}| all entries of
274 the databases are included in the glossary.\footnote{The command
275 |\string\onlygloss| is a deprecated synonymous with
276 |\string\gloss[nocite]|.}
277
278 \item |refpage| tells \gloss{} to ignore previous references to pages.
279 Sometimes you say things like ``...at the end of the chapter, we will
280 introduce the concept of...''; when the concept is actually
281 introduced you should use this option.
282
283 \item |<name>| of the glossary file where the key is written,
284 as defined by |\newgloss|. The key will be written into that
285 glossary. If there is no |<name>| it defaults to |default|.
286 \end{itemize}
287
288 The following options control the format of the term in the text.
289
290 \begin{itemize}
291
292 \item |word| prints the term exactly as given in the |word| field.
293
294 \item |Word| prints the term as given in the |word| field, but
295 with the first letter uppercased.\footnote{%
296 The command |\string\Gloss| is a deprecated synonymous with
297 |\string\gloss[Word]|.}
298
299 \begin{verbatim}
300 ...discovered. \gloss[Word]{spectroscopy} became one of the most...
301 \end{verbatim}
302
303 \item |short| prints the short form, provided the bib file defines it
304 (if not a warning is reported).
305
306 \item |Long| prints a combination of |Word| and |short|: ``Word
307 (short)''.
308
309 \item |long| prints a combination of |word| and |short|: ``word
310 (short)''. For example, the very first time an acronym is used:
311 \begin{verbatim}
312 ...and the proposals made by the \gloss[long]{iupac} provide...
313 \end{verbatim}
314 Of course, you may want the following references to be in the short
315 form; just define
316 \begin{verbatim}
317 \newcommand{\acronym}[2][]{\gloss[short,#1]{#2}}
318 \end{verbatim}
319
320 \end{itemize} The former (|nocite| and |refpage|) are built in,
321 |<name>|s are created by |\newgloss|, and the latter are created by
322 the package with |\setglosstext|; if no option defined by
323 |\setglosstext| is included, it defaults to |word|.
324
325 \begin{decl}
326 |\setglosstext{<option-name>}{<format>}| \quad (3 parameters)\\
327 |\ifglossshort{<format>}| \qquad |\ifglossshort*{<format>}|
328 \end{decl}
329
330 |\setglosstext| sets how entries are printed in the main text by
331 |\gloss|, where |<option-name>| is the name to be used in the optional
332 argument of |\gloss|. There are five predefined formats, described
333 above, which you may redefine or complement with new defined ones. In
334 |<format>| there are three available arguments, which are defined
335 implicitly:
336 |#1| is |word|, |#2| is |word| with its initial uppercased, and |#3|
337 is the |short| field. Thus, the package does the following:
338 \begin{verbatim}
339 \setglosstext{word}{#1}
340 \setglosstext{Word}{#2}
341 \setglosstext{short}{\ifglossshort*{#3}{}}
342 \setglosstext{long}{#1\ifglossshort*{ (#3)}{}}
343 \setglosstext{Long}{#2\ifglossshort*{ (#3)}{}}
344 \end{verbatim}
345 Use is made of |\ifglossshort| which takes the first argument if the
346 short form exists, and the second one if does not exist. In the
347 latter case, that is done silently in the unstarred version, but with
348 an error in the starred one.
349
350 \subsection{Glossary layout}
351
352 \begin{decl}
353 |\glossheading{<format>}|
354 \end{decl}
355
356 Sets how the headings are formatted; it is redefined with
357 |\renewcommand|. For example:
358 \begin{verbatim}
359 \renewcommand\glossheading[1]{%
360 \stopglosslist
361 \subsection*{#1}}
362 \end{verbatim}
363
364 \begin{decl}
365 |\setglossgroup{<group>}{<heading>}|
366 \end{decl}
367
368 Sets the heading corresponding to entries grouped by \textsf{glsplain}
369 under the same |group| key (and preceded by |\glossgroup|, which in
370 turn calls |\glossheading|).
371 \begin{verbatim}
372 \setglossgroup{C}{Signs}
373 \end{verbatim}
374
375 \begin{decl}
376 |\setglosslabel{<format>}| \quad (3 parameters)
377 \end{decl}
378
379 Sets which of the three forms are printed as label in the gloss items and
380 some other optional formatting.
381
382 The package does:
383 \begin{verbatim}
384 \setglosslabel{\sffamily\bfseries#1\ifglossshort{ (#3)}{}}
385 \end{verbatim}
386
387 \begin{decl}
388 |thegloss|
389 \end{decl}
390
391 By default, the main environment just prints the gloss title.
392 You may change its definition.
393
394 \begin{decl}
395 |glosslist|\\
396 |\stopglosslist|
397 \end{decl}
398
399 You usually won't see the |glosslist| environnment. It is automatically
400 started by |glossitem| if necessary. You may stop it with the
401 |\stopglosslist|. That's so done to interact with the format
402 of the heading for each letter group. The above example of
403 |\glossheading| uses it because sectioning commands cannot be
404 used inside lists; this way, the list is stopped, the title is
405 printed, and the following |glossitem| restarts the list. If
406 you say:
407 \begin{verbatim}
408 \renewcommand{\glossheading}[1]{}
409 \end{verbatim}
410 the whole glossary is printed in a single list (with no unwanted
411 space between letter groups).
412
413 \textsf{Gloss} provides its own format for |glosslist|
414 (simply because the authors like it) with a |\glosshang| length
415 to adjust the left margin, but you may change its definition.
416
417 \begin{decl}
418 |glossitem|\\
419 |glossitem*|
420 \end{decl}
421
422 Its |\begin| consists of an |\item| and some additional stuff. Its
423 |\end| adds a period (except in the starred version) or the page
424 number. You should not modify this environment, except if you want a
425 format not based in a list environment.
426
427 Here is an example of how to modify the layout of the glossary:
428 \begin{verbatim}
429 \setglosslabel{#2}
430
431 \renewcommand{\glossheading}[1]{%
432 \stopglosslist % -- Don't forget that!
433 \vspace{1pc}%
434 {\large\centering\bfseries#1\par}}
435
436 \renewenvironment{glosslist}
437 {\begin{description}}
438 {\end{description}}
439 \end{verbatim}
440
441 \begin{decl}
442 |\glosspage|\\
443 |\xglosspage|
444 \end{decl}
445
446 This command is used to print the page at the end of the gloss entry
447 with |refpages|. If the entry ends with a period, |\xglosspage| is
448 used, which by default just maps to |\glosspage|. You may redefine them
449 with |\renewcommand|:
450
451 \begin{verbatim}
452 \renewcommand{\glosspage}[1]{. (See page~#1)}
453 \renewcommand{\xglosspage}[1]{ (See page~#1)}
454 \end{verbatim}
455
456
457 \section{Order of items}
458
459 Now we explain how \bibTeX{} sorts and groups entries. Firstly, the
460 necessary values are assigned, if necessary. The |group| field is
461 used, as stated above, for entries consisting of non alphabetical
462 terms, and differents steps are followed depending on whether
463 this field exists or not.
464
465 If |group| is not present, then
466 \begin{itemize}
467 \item |sort-word|, if omitted, is |word| lowercased with
468 non alphabetical signs removed.
469
470 \item |heading|, if omitted, is the first letter in
471 |word|.
472 \end{itemize}
473 If |group| is present, then
474 \begin{itemize}
475 \item |sort-word|, if omitted, is |word| lowercased with
476 non alphabetical signs \textit{not} removed.
477
478 \item |heading| is not used.
479 \end{itemize}
480
481 Now, entries can be sorted. First, they are ordered by |group|, and
482 then, inside each group, by |sort-word|. In fields with |group| and
483 no |sort-word| the ASCII codes are used. No further sortening is
484 done. Finally, entries are grouped: first, consecutive entries with
485 the same |group| field; then, consecutive entries whose |group| is "L"
486 and with the same |heading| field. Note that |group| sorts and
487 groups, |sort-word| just sorts, and |heading| just groups.
488
489 Now, let's answer the following simple question: When should I use
490 |heading| and |sort-word|? If the word begins with a letter with
491 diacritical mark alphabetized under the letter without diacritical
492 mark (a fairly frequent case), use heading, does not matter you are
493 using \bibTeX{} or \bibTeX 8:
494 \begin{verbatim}
495 @gd{ecole,
496 word = "{\'e}cole",
497 definition = "...",
498 heading = "E"
499 }
500 \end{verbatim}
501 (\texttt{\'ecole} and \texttt{{'e}cole} are allowed, too).
502
503 If the word begins with a letter which is placed under a heading of
504 its own, use |sort-word| in \bibTeX{} and nothing in \bibTeX8
505 (provided a correct sorting file is provided, which is not the case
506 for many languages):
507 \begin{verbatim}
508 @gd{nname,
509 word = "{\~n}ame",
510 definition = "...",
511 sort-word = "nzzame"
512 }
513 \end{verbatim}
514 in 7-bits versions. In 8-bits version, you may set |word| as
515 \texttt{\~name} and suppress the |sort-word| field.
516
517 Anyway, if you are using a 7-bits version you may want using both fields:
518 \begin{verbatim}
519 @gd{innigo,
520 word = "{\'I}\~nigo",
521 definition = "...",
522 heading = "I",
523 sort-word = "Inzzigo"
524 }
525 \end{verbatim}
526
527 Finaly, \textsf{gloss} provides inside the |thegloss| environment the
528 |\+zz+| command expanding to nothing, where |zz| is any text helping
529 in sorting entries (usualy |zz|); this way, |sort-field| is not
530 necessary in most of cases:
531 \begin{verbatim}
532 @gd{nname,
533 word = "{\~n\+zz+}ame",
534 definition = "..."
535 }
536 \end{verbatim}
537 An example in Swedish is |\+zzx+\r{a}|, in Czech
538 |{\v{c}\+zz+}|, and in Breton (8-bits) |\+n+\~n|. (Of course,
539 \bibTeX{} could translate from a readable form to one for
540 alphabetizing. That should be done in a future.) Using either
541 |sort-word| or |\+zz+| is a question of personal taste; One of us [JB]
542 uses |sort-word| while the other [JLDA] prefers
543 \bibTeX8. This syntax is not compliant with the \LaTeX\ interface
544 guidelines (use braces or brackets always) but it's short, which was
545 the main goal; this feature is mostly unsuportted, however.
546
547 \section{Complements}
548
549 \subsection{The \textsf{glsbase} database}
550
551 This database defines some useful strings which can be used
552 in other databases. Currently, it only includes a set of
553 strings named |alphasort|, |betasort|, etc. to be used
554 in the |sort-word| field to provide the right order of
555 greek symbols. (They are defined as |"01"| , |"02"|, etc.)
556
557 \subsection{The \textsf{glsshort} style}
558
559 This style is provided for acronym lists. It sorts and creates
560 headings using the |short| filed. A new |sort-short| can be used
561 to fine tune the order of entries (this field will be ignored
562 in the \textsf{glsplain} style). However, note that the
563 printed form still follows the conventions given above, and
564 you should use the |short| specifier in |\cite|, and
565 |\setglosslabel|.
566
567 \subsection{Compatibility with \textsf{hyperref}}
568
569 If the \textsf{hyperref} package is loaded, links from the
570 word to the entry will be created. You can control
571 the appearance of gloss links with the following macros:
572 |\glosslinkborder|, |\glosslinkcolor|,
573 |\glosslinkbordercolor| (which correspond to |pdfborder|,
574 |linkcolor| and |linkbordercolor|); you can change
575 them with |\renewcommand|.
576
577 \subsection{The sample file}
578
579 Once installed \gloss{} you should be able to typeset the
580 |sample.tex| file, which will enlighten the usage
581 of this package --- \LaTeX{} to write the auxiliary file, \bibTeX{}
582 to create the glossary, \LaTeX{} to define the labels, and \LaTeX{}
583 to see the final result. Disclaimer: its text is in Spanish.
584
585 \subsection{Backward uncompatibility}
586
587 Version 0.1 beta had a different syntax for the |\gloss|
588 command. The old syntax |\gloss[<word>]{<key>}| does not work
589 and |<word>\gloss[nocite]{<key>}| should be used instead. The
590 |\glossstyle| command has been removed and its functionality
591 merged into |\newgloss|.
592
593 \subsection{Language support}
594
595 The following package options provide translation of the glossary
596 heading and page abbreviation: |basque|, |catalan|, |danish|, |dutch|,
597 |french|, |german|, |italian|, |portuguese| (and |brazilian|),
598 |russian| (any encoding), |polish|, |spanish| and |swedish|.
599 Translations to other languages are welcome.
600
601 \end{document}
602