Nicola L.C. Talbot
20th July 2006
You need to make sure you have downloaded the following three files:
glossary.ins glossary.dtx READMETo extract the code from the glossary.dtx file, you will need to run the installation file through LaTeX:
latex glossary.insThis will create the following files:
glossary.sty glossary.perl makeglos.pl makeglos.batalong with several sample files. The file glossary.sty should be placed somewhere in the LaTeX path, e.g. texmf/tex/latex/glossary/ or localtexmf/tex/latex/glossary/. Remember to update the TEX database if you are installing this package for the first time. The file glossary.perl is a LaTeX2HTML style file, and should be placed in the LaTeX2HTML style file directory (usually latex2html/styles/). The file makeglos.pl is a Perl script which calls makeindex. If you are using UNIX or Linux, you will need to set the permissions so that you can execute the file:
chmod a+x makeglos.plYou should then place this file somewhere on your path. (You may also need to edit the first line of this file, if perl is located in a directory other than
/usr/bin/
1.)
If you are not using UNIX or Linux etc, you may have to explicitly
load the file into Perl, so you would need to do
perl makeglos.pl instead of just makeglos.pl.
If you are using Windows, a batch file, makeglos.bat
is provided which will run Perl on makeglos.pl.
Both makeglos.pl and makeglos.bat should
be placed somewhere specified by the PATH environment
variable. (For example, put them both in the same
directory as makeindex, which will probably
be in \texmf\miktex\bin\
).
If you don't have Perl installed on your system, you can just use makeindex, only you will have to remember all the command line switches, and you won't be able to merge entries that have the same name, but different descriptions.
Note that if you are updating the glossary package, it is a good idea to update makeglos.pl as it may also have been modified.
The standard LaTeX command \makeglossary (analogous to \makeindex)
should be placed in the document preamble. If this command
is omitted, glossary information will be ignored. Glossary
entries are generated using the command
\glossary{
key-val list}
.
This command is a slightly modified version of the standard
\glossary command, in order to separate out the
information into entry-name and entry-description.
The argument to \glossary must be a comma-separated
list of key=value pairs. The following keys are
available:
\glossary{name={singular matrix}, description={A matrix with zero determinant}}The following example sorts on the text U instead of
$\mathcal{U}$
:
\glossary{name={$\mathcal{U}$}, description={The universal set}, sort=U}Note that you should always use the sort key if the name key contains commands, this is particularly important if you are using hyperlinks, as the target is constructed from the name key if the sort key is omitted.
In the glossary, each entry is followed by a list of page numbers
that correspond to the pages where the relevant \glossary
command is placed. By default the numbers are formatted in the
current font, but the page number format for individual entries can be
changed using the format key. This should be the name of a
LaTeX formatting command without the preceding \
(as with the
|
operator in \index.) For example:
\glossary{name={$\mathbb{R}$}, description={The set of real numbers}, sort=R, format=textbf}In addition, the following formats are also available:
\newcommand{\hyperbfit}[2][\gls@number]{% \textbf{\itshape\glshyper{#1}{#2}}}As can be seen from the definition, all the \hyperxx commands have an optional argument. This argument is the name of the counter being used. You do not need to worry about this argument if you only use these commands within the \glossary command. So the previous example can simply be rewritten as:
\glossary{name={$\mathbb{R}$}, description={The set of real numbers}, sort=R, format=hyperbf}
Note: although the numbers in the glossary are referred to as ``page'' numbers in this manual, they may in fact refer to some other counter, such as the section counter, depending on whether the number key has been used.
As with the \index command, care must be taken if you
want to use the special characters: @
|
"
and
!
. These characters should be preceded by the double quote
character. For example:
\glossary{name={$"|\mathcal{S}"|$, description=The cardinality of the set \mathcal{S}}}There is no provision for sub-entries, as these are generally only applicable in an index, and not in a glossary.
As from version 2.14, there is an additional command available:
\xglossary{
gls-entry}{
text}
This is equivalent to
text\glossary{
gls-entry}
,
where text will be made a hyper link to the
relevant entry in the glossary, if hyper
links are supported.
It is very cumbersome having to use the \glossary command throughout your document, every time you use a term that you want in your glossary. This is particularly true for terms with a long description. The glossary package provides a means of storing the glossary information at the beginning of the document, and then using it whenever required. It is strongly recommended that you use this approach, rather than explicity using the \glossary command.
The following command:
\storeglosentry[ gls-type]{ label}{ gls-entry}
can be used to store glossary information, where label is
a unique label assigned to this entry. The information
can then be used later with any of the following commands:
\useglosentry[ opt]{ label}
\useGlosentry[ opt]{ label}{ text}
\gls[ opt]{ label}
\useglosentry adds the glossary entry whose label is given by
label to the appropriate glossary,
\useGlosentry adds the glossary entry, and
makes text a hyperlink to that entry (if hyperlinks are
supported). The third command, \gls, is like
\useGlosentry, but forms text from the name
given in the glossary entry.
Returning to an earlier example, instead of typing:
\glossary{name={$\mathcal{U}$}, description={The universal set}, sort=U}every time you want to add this entry to the glossary, you can instead store the information:
\storeglosentry{glos:U}{name={$\mathcal{U}$}, description={The universal set}, sort=U}Now, instead of continually copying and pasting the glossary command for this entry (which can have quite a large description field), you can use either:
\useglosentry{glos:U}which is equivalent to:
\glossary{name={$\mathcal{U}$}, description={The universal set}, sort=U}or you can use:
\useGlosentry{glos:U}{text}which is equivalent to:
\xglossary{name={$\mathcal{U}$}, description={The universal set}, sort=U}{text}or you can use:
\gls{glos:U}which is equivalent to:
\xglossary{name={$\mathcal{U}$}, description={The universal set}, sort=U}{$\mathcal{U}$}If you want to use glossary entries in an equation, it is better to use \ensuremath instead of
$
...$
.
For example:
\storeglosentry{Gamma}{name=\ensuremath{\Gamma(z)}, description=Gamma function, sort=Gamma}You can then use this entry in either text or math mode:
The \useGlosentry{Gamma}{Gamma function} is defined as \begin{equation} \gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt \end{equation}If you are using hyper links, and you want to use \useGlosentry within math mode, you must use \ensuremath:
\begin{equation} \useGlosentry{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x) \end{equation}
The optional argument to \storeglosentry (gls-type) indicates the glossary type (see later to find out how to define new glossary types). If omitted, the standard glossary is used.
The optional argument to \useglosentry, \useGlosentry and \gls (opt) allows you to add additional information to the glossary entry, for example:
\useglosentry[format=textbf]{glos:U}is equivalent to:
\glossary{name={$\mathcal{U}$}, description={The universal set}, sort=U, format=textbf}Since version 2.4, \storeglosentry is robust, and \protect should no longer be needed, however the identifying label, label, should not contain any special characters.
As from version 2.36, if you want to use all glossary entries
which have been defined using \storeglosentry, do:
\useglosentry{*}
. (Note that this option is not
available for \useGlosentry and \gls.)
Whenever a glossary entry is used, either explicity using \glossary or \xglossary or implicitly using \useglosentry, \useGlosentry and \gls, the information is saved in a file with the extension glo (unless the \makeglossary command is omitted, in which case the glossary information is simply ignored.) A makeindex style file (ist) is also created, which is customized for the document, and can be passed to makeindex.
For example, suppose your document is called mydoc.tex, the glossary will be saved in the file mydoc.glo, and the makeindex style file mydoc.ist will be created. These files can then be passed to makeindex as follows:
makeindex -s mydoc.ist -t mydoc.glg -o mydoc.gls mydoc.glowhich generates the output file mydoc.gls, with transcript written to mydoc.glg.
The Perl script makeglos.pl provided with this package allows you to use makeindex without having to remember all the command line options. The command
makeglos.pl mydocwill perform the command:
makeindex -s mydoc.ist -t mydoc.glg -o mydoc.gls mydoc.gloIn addition, makeglos.pl also takes the option -m which can be used to collate entries where the same name has multiple descriptions.
makeglos.pl has the following syntax:
makeglos.pl [-ilqrgm] [-s sty] [-o gls] [-t log] [-p num] <filename>where all switches, apart from -m are the same as those for makeindex. If there are multiple glossary types (see later) and the file extension is omitted, makeglos.pl will iterate through each glossary type (it will pick up the relevant information from the auxiliary file).
The name of the ist file can be changed by redefining the command \istfilename before \makeglossary. For example:
\renewcommand{\istfilename}{foo.ist} \makeglossaryOnly one ist file will be created per document, even if you have multiple glossaries with different styles. The only circumstance where you will need multiple ist files for a single document is when you have multiple glossaries that use different counters with different compositors, but this is rarely likely to occur.
Creation of the ist file can be suppressed by issuing the command \noist before \makeglossary. It will also be suppressed when the command \nofiles is used, or if the command \makeglossary is omitted.
It should be noted that there are a few packages that can cause problems with the creation of the ist file, for example ngerman. If you encounter problems when LaTeX is processing the \makeglossary command, or if you get errors from makeindex complaining about the style file, this is the most probable cause. See later for information on how to fix this.
Once the gls file has been created by makeindex (as described in the previous section) the glossary can then be included in the document with the command \printglossary. If chapters are defined, the glossary will start with
\chapter*{\glossaryname}If not, it will start with
\section*{\glossaryname}The format of the main body of the glossary depends on the options passed to the package.
The package options must be specified as a comma-separated list of key=value pairs. Available options are:
You can set up your own preferred defaults in a configuration
file.
The file must be called glossary.cfg and
should be placed somewhere on the TEX path. In this file you
can use the command
\glossarypackageoptions{
option-list}
where option-list is a comma-separated list of
key=value pairs, as passed to the
glossary
package. Note that this command may only be used in the
configuration file.
A new type of glossary can be defined using the command:
\newglossarytype[
log-ext]{
name}{
out-ext}{
in-ext}[
style list]
For example, suppose you want your document to have a separate
index of terms and index of notation,
you could use \makeglossary, \glossary,
\xglossary and \printglossary for the first
glossary, and define a new type of glossary called say,
notation, using
\newglossarytype[nlg]{notation}{not}{ntn}which will create the analogous commands: \makenotation, \notation, \xnotation and \printnotation which can be used for the second glossary.
As from version 2.3, \newglossarytype now has an additional optional argument style list. This should be a comma separated list of key=value pairs that can be used to specify the style of the new glossary. If omitted, the new glossary will have the same format as the main glossary. The following options are available: number, style, header, border and cols. These can take the same values as those given in the package options (described in section 6).
The command \newglossarytype should only occur in the
preamble. The new commands
\makename, \
name,
\x
name and \printname all have the
same format as their ``glossary'' counter-parts.
The glossary information will be saved to a file with the extension given by out-ext (analogous to glo), which can then be passed to makeindex either directly or via makeglos.pl, and the file to be read in (i.e. the file created by makeindex) will have the extension in-ext (analogous to gls).
The optional argument log-ext indicates the extension for the makeindex log file, if omitted the extension glg is used. This is not used by LaTeX, however makeglos.pl reads in this information from the LaTeX auxiliary file and passes it to makeindex.
For the above notation example, if your document is called, say, mydoc.tex, you will need to do the following:
latex mydoc makeglos.pl mydoc latex mydoc(You may need to do an extra
latex mydoc
to get
cross-references up-to-date.) Note that if you don't specify the
file extension when using makeglos.pl, it will
check the transcript file from the LaTeX run to determine
all the glossary types, so, for this example,
makeglos.pl mydocis equivalent to:
makeglos.pl mydoc.glo makeglos.pl mydoc.notsince makeglos.pl has read in the information for the notation glossary type from the file mydoc.log.
If you don't have Perl installed on your system, or for any other reason are unable to use makeglos.pl, you can call makeindex explicitly:
latex mydoc makeindex -s mydoc.ist -t mydoc.glg -o mydoc.gls mydoc.glo makeindex -s mydoc.ist -t mydoc.nlg -o mydoc.ntn mydoc.not latex mydoc
Note that you can use the command
\printglossary[name]
instead of \print
name.
These two commands have the same effect when using LaTeX,
however, they have a slightly different effect when
using LaTeX2HTML (see later).
If the command \
glossary-typename
is defined, (e.g. \notationname
in the above example)
this will be used as the title for the specified
glossary. If this command is not defined, \glossaryname
will be used instead.
If the command \short
glossary-typename
is defined, (e.g. \shortnotationname in the above
example) this will be used for the table of contents
entry, otherwise \
glossary-typename
will
be used instead.
For example:
\newglossarytype[nlg]{notation}{not}{ntn} \newcommand{\notationname}{Index of Notation} \newcommand{\shortnotationname}{Notation}
The glossary package provides the command:
\newacronym[ cmd-name]{ acronym}{ long}{ glossary entry}
which can be used to define acronyms. The argument long
is the full name, the argument acronym is the acronym for
long and glossary entry is the glossary information
in the form used by the \glossary command. If the
optional argument cmd-name is missing,
\newacronym will create a command called
\
acronym, otherwise it will create a command
called \
cmd-name (henceforth denoted \acr-name).
This command can then be used throughout the text. The first
instance of this command is equivalent to:
long (\xacronym{
name=long (acronym),glossary entry}{
acronym}
)
subsequent instances will be equivalent to:
\xacronym{
name=long (acronym),glossary entry}{
acronym}
The command \acr-name also has a starred
version, which will make the first letter of long
uppercase (for use at the start of a sentence).
Note that if you want to change the format of the acronym, for example, if you want the acronym to appear in small caps, you will need to not only use the optional argument, but you will also need to use the sort key, otherwise you will get an error. For example:
\newacronym[SVM]{\textsc{svm}}{Support Vector Machine}% {description=Statistical pattern recognition technique,sort=svm}
If the package option acronym is not set (default) \xacronym, is a synonym for \xglossary, and the acronyms will appear in the main glossary (remember to specify \makeglossary and \printglossary). If the package option acronym=true is specified, a new glossary type called acronym will be defined as:
\newglossarytype[alg]{acronym}{acr}{acn} \providecommand{\acronymname}{List of Acronyms}You will then need to use the commands \makeacronym and \printacronym to make the list of acronyms appear. You will also need to run the acr file through makeindex (or makeglos.pl). For example:
makeindex -s mydoc.ist -t mydoc.alg -o mydoc.acn mydoc.acralternatively:
makeglos.pl mydocNote that the package option acronym=true is only appropriate if you want both a glossary and a separate list of acronyms. If you do not write in English, you can set up your own language definition for \acronymname in the configuration file glossarycfg. For example:
\newcommand{\acronymname}{Akronyme}(If glossary.cfg does not exist, create a new file, add the appropriate definition of \acronymname, and save it to the same directory as glossary.sty.)
The name key does not need to appear in glossary
entry, as it is constructed from long and
acronym. By default this will be in the form:
long (acronym), however the format can be
overridden using the
command:
\setacronymnamefmt{format}
Within format the following commands may
be used to represent long and acronym:
\glolong and
\gloshort. For example,
suppose you just want the acronym to appear in the glossary entry,
and not its full length name, then you would need to do:
\setacronymnamefmt{\gloshort}
As from version 2.32, you can also modify the way the description
key is formatted for acronyms using:
\setacronymdescfmt{format}
Within format you may use the commands \glolong
and \gloshort (as above), and you can also use
the command \glodesc which is the description as
specified by the description key in
\newacronym. This means that if you are using
a tabular style glossary, you can have the abbreviated
form in one column and the long form in the second column
with the description. For example, the following:
\setacronymnamefmt{\gloshort} \setacronymdescfmt{\glolong: \glodesc} \newacronym{svm}{support vector machine}{description=Statistical pattern recognition technique}will generate a glossary entry of the form:
\glossary{name=svm,description=support vector machine: Statistical pattern recognition technique}Note that if you omit \glodesc from \setacronymdescfmt the description specified in \newacronym will be ignored. So
\setacronymnamefmt{\gloshort} \setacronymdescfmt{\glolong} \newacronym{svm}{support vector machine}{description=Statistical pattern recognition technique}will generate a glossary entry of the form:
\glossary{name=svm,description=support vector machine}
You will need to specify the name key explicitly if the name contains a makeindex special character. For example:
\newacronym{RNA}{Ribonukleins\"aure}{name={Ribonukleins\""aure (RNA)}}Note that this will override any formatting specified by \setacronymnamefmt.
Given an acronym named acr-name (the command name associated with the acronym as defined in \newacronym without the preceding backslash), the following commands are also available:
\useacronym[
insert]{
acr-name}
This command can be used instead of \acr-name.
\useacronym also has a starred version equivalent to
\acr-name*.
The optional argument insert allows you to insert text
after long, if this is the first occurrence of the
acronym, or after the acronym on subsequent occurrences.
\resetacronym{
acr-name}
This command will cause the next use of \acr-name
to produce the long version. To reset all acronyms
do \resetallacronyms.
\unsetacronym{
acr-name}
This command will cause all subsequent uses of
\acr-name to produce the short version.
To unset all acronyms
do \unsetallacronyms.
\ifacronymfirstuse{
acr-name}{
true text}{
false text}
This will test if the acronym has been used yet. If it has been
used, true text will be implemented, otherwise
false text will be implemented.
The long and short forms of an acronym can be produced explicitly
without a corresponding glossary entry, using the commands:
\acrln{
acr-name}
\acrsh{
acr-name}
Or, alternatively:
\acr-namelong
\acr-nameshort
The first two commands (\acrln and \acrsh)
have a starred form that makes the first letter uppercase.
The other two commands, simply contain long and
acronym.
Note that since these four commands do not generate glossary entries they will therefore not contain any hyperlinks, even if you have specified the hyper package option. They are provided for use in situations where the associated glossary command may cause problems (e.g. in a sectioning command.)
Note that, as with all LaTeX commands, spaces following
command names are ignored so if, for example, you defined
a new acronym called, say, SVM, then the command \SVM
will
ignore any spaces following it. To force a space, you
can either place an empty set of braces after the command
name (e.g. \SVM{}
) or use
\_ i.e. a backslash followed by
a space (e.g. \SVM\
). Alternatively, as from
version 2.22, if you load the xspace package
before loading the glossary package, spaces will
be put in automatically using \xspace.
If you want the acronym to appear in a particular font, for example, small caps, you can redefine the command \acronymfont. For example:
\renewcommand{\acronymfont}[1]{\textsc{#1}}The default definition of \acronymfont is:
\newcommand{\acronymfont}[1]{#1}
\newacronym{SVM}{Support Vector Machine}{description=Statistical pattern recognition technique}This will define the command \SVM. The first time this command is used will display the text: Support Vector Machine (SVM). Subsequent use will simply display: SVM. The next example uses the optional argument cmd-name since the acronym contains a non-alphabetical character:
\newacronym[KSVM]{K-SVM}{Kernel Support Vector Machine}{description=Statistical pattern recognition technique using the ``kernel trick''}This will define the command \KSVM. The first time this command is used will display the text: Kernel Support Vector Machine (K-SVM). Subsequent use will simply display: K-SVM.
To test whether or not an acronym has been used:
\ifacronymfirstuse{SVM}{a}{an} \SVM\ is \ldotsIf the acronym has not been used, the following text will be produced:
\chapter{An overview of the \protect\SVM} \resetacronym{SVM} The \SVM\ \ldotsNote the use of \protect (see note 15.) In fact, in this situation it would be better to do:
\chapter[An overview of the \SVMlong]{An overview of the \protect\SVM} \resetacronym{SVM} The \SVM\ \ldots
Now suppose you want the text: support vector machine, instead of Support Vector Machine (i.e. you don't like the uppercase letters). You can define the acronym as follows:
\newacronym{SVM}{support vector machine}{description=Statistical pattern recognition technique}however, if the command \SVM occurs at the start of the sentence, you would clearly want the first letter as an uppercase letter. This can be done using \SVM* instead of \SVM. For example:
\SVM*\ techniques are widely used \ldotsThis will then come out as: Support vector machine (SVM) techniques are widely used ...(Assuming this is the first use of either \SVM or \SVM*.)
Alternatively, \useacronym{SVM}
can be used instead of
\SVM. For example:
\useacronym*[s]{SVM} are widely used in the area of pattern recognition.If this is the first use of the acronym SVM, it will produce the following text:
Command | Default Value |
---|---|
\glossaryname | Glossary |
\shortglossaryname | \glossaryname |
\entryname | Notation |
\descriptionname | Description |
The command \shortglossaryname is used for the page headers and table of contents entry. Any text required before or after the glossary can be added by redefining the commands \glossarypreamble and \glossarypostamble. For example.
\renewcommand{\glossarypreamble}{Page numbers in italic indicate the main definition\par}By default, \glossarypreamble and \glossarypostamble do nothing.
Any text required before or after the list of page numbers are specified by the commands \glsbeforenum and \glsafternum. By default, these commands do nothing, any redefinition of these commands should come somewhere before the relevant \printglossary command. For example:
\printglossary \renewcommand{\glsbeforenum}{(} \renewcommand{\glsafternum}{)} \printnotationThis will put the page number list in brackets for the second glossary, but not the first.
Individual glossaries can have their styles changed either
by setting the style in the final optional argument
to \newglossarystyle (see
earlier)
or using the command:
\setglossarystyle[type]{style list}
For example:
\setglossarystyle[acronym]{style=long,border=true,cols=2}If type is omitted, the change is applied to the main glossary.
The command \setglossary{
key-val list}
can be used to modify some of the glossary settings. The argument
key-val list is a comma-separated list of
key=value pairs. Available keys are:
\setglossary{glsnumformat=textit}To suppress numbering altogether, you can do:
\setglossary{glsnumformat=ignore}
&
, or if
style=altlist,
in which case it is simply a space4. If the package option number=none is
specified, glodelim will have an empty value (unless
cols=3 is specified,
where, again, it will have the value &
.)
This setting corresponds to the delim_0 key in the
makeindex style file.
Note that if you want a new line between the description and the list of page numbers you will need to use \noexpand. For example:
\setglossary{glodelim={\noexpand\newline}}
--
. If the
package option number=none is chosen, the value is set
to empty.
\\
for the tabular-type styles. Note that
delimT is separate from \glsafternum.
For example, if you are using a 2 column tabular style, and you want a blank line after every entry (not just after every group) you can do the following:
\setglossary{delimT={\cr & \cr},gloskip={}}Note the use of \cr instead of
\\
and
gloskip is set to nothing otherwise there would be
a double space between groups.
\setglossary{glsnumformat=ignore}is equivalent to
\setglossary{glsnumformat=ignore,delimN={},delimR={}}
As from version 2.4, you can insert text between groups by redefining the commands \glogroupSymbols, \glogroupNumbers, \glogroupA ... \glogroupZ. For example, if you are using one of the list styles, the following will print the appropriate heading in bold, followed by a gap:
\renewcommand{\glogroupSymbols}{\textbf{Symbols}\indexspace} \renewcommand{\glogroupNumbers}{\textbf{Numbers}\indexspace} \renewcommand{\glogroupA}{\textbf{A}\indexspace} ....% similar lines omitted \renewcommand{\glosgroupZ}{\textbf{Z}\indexspace}
The start and end of the main body of the glossary is given by the commands: \beforeglossary and \afterglossary. If the style=list or style=altlist package options are chosen these commands simply begin and end the description environment, otherwise these commands begin and end the longtable or supertabular environment with argument specified by \glossaryalignment5.
The glossary package no longer conflicts with the array package. Changes can now be made to \glossaryalignment regardless of whether or not the array package has been used.
The command \gloitem indicates
what to do at the start of each glossary entry.
This command takes one argument, which will be the text specified by the name key
in the \glossary command. In the case of the
style=list option,
\gloitem{
text}
will do
\item[
text]
or if style=altlist:
\item[
text]\mbox{}\par
otherwise it will do
text &
This command corresponds to the item_0 key in the
makeindex style file.
If the glossary has a tabular style with a header row (header=true and either style=long or style=super), then the header row for cols=2 will be given by:
\bfseries\entryname & \bfseries \descriptionname\\and the header row for cols=3 will be given by:
\bfseries\entryname & \bfseries\descriptionname & \bfseries\glspageheader\\(It may also contain \hline\hline if the border key is set.)
If you want to override this, you need to define the command \glossaryheader6.
For example, if you are using a tabular style with cols=2, and you want the \descriptionname to be centred, you could do:
\newcommand{\glossaryheader}{\bfseries\entryname & \hfil\bfseries\descriptionname\\}
If you want an extra row below the header row, you can define the command\glossarysubheader For example, if you are using cols=3, and you want an extra row after the header row, you can do:
\newcommand{\glossarysubheader}{ & & \\}
The command \glosstail indicates what to do at the end of the longtable or supertabular environment.
The width of the second column for the tabular-type styles is given by the length
\descriptionwidth. This value can be changed using
the \setlength command (the default value is 0.6\linewidth
).
pdflatex sampleSec makeglos.pl sampleSec pdflatex sampleSec pdflatex sampleSecIf you don't want to use makeglos.pl, you will need to do
makeindex -s sampleSec.ist -t sampleSec.glg -o sampleSec.gls sampleSec.glo
latex sampleNtn makeglos.pl sampleNtn latex sampleNtn latex sampleNtnIf you don't want to use makeglos.pl, you will need to do
makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.ntn sampleNtn.not
latex sampleEq makeglos.pl sampleEq latex sampleEqIf you don't want to use makeglos.pl, you will need to do
makeindex -s sampleEq.ist -t sampleEq.glg -o sampleEq.gls sampleEq.glo
latex sampleEqPg makeglos.pl sampleEqPg latex sampleEqPgIf you don't want to use makeglos.pl, you will need to do
makeindex -s sampleEqPg.ist -t sampleEqPg.glg -o sampleEqPg.gls sampleEqPg.glo
pdflatex sampleAcr makeglos.pl sampleAcr pdflatex sampleAcr pdflatex sampleAcrIf you don't want to use makeglos.pl, you will need to do
makeindex -s sampleAcr.ist -t sampleAcr.glg -o sampleAcr.gls sampleAcr.glo
pdflatex sample makeglos.pl -m sample pdflatex sample pdflatex sample(Depending on the configuration of your system, you may have to do perl makeglos.pl instead of just makeglos.pl)
If you don't want to use makeglos.pl, you will need to do
makeindex -s sample.ist -t sample.glg -o sample.gls sample.glohowever, the entries with the same name but multiple descriptions will not be merged. You will also have to given them different sort keys otherwise you will get duplicate hyper targets.
latex sample4col makeglos.pl sample4col latex sample4col
A LaTeX2HTML Perl script, glossary.perl, is provided with this package for those wishing to use the glossary package with the LaTeX2HTML translator. The file glossary.perl should be extracted along with glossary.sty when you run the installation script (glossary.ins) through LaTeX.
\print
name instead of
\printglossary[
name]
, where
name is the name of the glossary type.
""
, "|
, "!
and "@
will be correctly translated, unless they
occur within a maths environment. This is because
the maths environment is translated before being
passed to \glossary. You can overcome this
by doing, e.g.:
{latexonly}
\glossary{name=$"|\mathcal{S}"|$,description=cardinality of set
$\mathcal{S}$,sort=cardinality}
{latexonly}
{htmlonly}
\glossary{name=$|\mathcal{S}|$,description=cardinality of set
$\mathcal{S}$,sort=cardinality}
{htmlonly}
Alternative, you can use \mid instead:
\glossary{name=$\mid\mathcal{S}\mid$,description=cardinality of set $\mathcal{S}$,sort=cardinality}
This is a list of common problems, for a more up-to-date FAQ, see http://theoval.cmp.uea.ac.uk/~nlct/packages/faq/.
Check the following:
9 attributes redefined, 0 ignoredIf you have a number other than 0 ignored, then there is something wrong with the ist file. Some packages can cause problems with the creation of this file, see item 16 below.
If you have defined a new glossary type, have you checked all the analogous commands to the above?
Have you used the acronym=true package option? If no, check the answers to the previous item, if yes, make sure you have used \makeacronym and \printacronym. Have you used any of the acronyms you have defined? Remember that \acrsh, \acrln, \acr-nameshort and \acr-namelong don't generate entries in the list of acronyms, where \acr-name is the name of an acronym command.
By default, if any of your acronym commands occur within a group (this includes environments which form implicit grouping) the effect will be local to that group. You can either unset the acronym outside the group, or use the global package option.
Don't use this command it's obsolete, use \storeglosentry instead.
Check the following
"
? If so, have you preceded them
with a double quote character?
Check the makeindex log file to see if there are any error messages.
LaTeX treats multiple spaces equivalent to a single space, but makeindex takes spaces into account when determining whether two entries are identical. For example:
\glossary{name=Identity matrix, description=diagonal matrix with 1's along the diagonal}and
\glossary{name=Identity matrix, description=diagonal matrix with 1's along the diagonal}will be treated as different entries by makeindex, because the first has only one space between `Identity' and `matrix' and the second has two. The easiest way to ensure consistency is to use \storeglosentry together with \useglosentry, \useGlosentry or \gls.
Suppose you've made an error in the \glossary command. For example:
\glossary{name=Java,description=A programming language,format=texbf}In this case textbf has been mis-spelt. This error will be copied to the glo file, which in turn will be copied to the gls file by makeindex. A subsequent run of LaTeX will read this error in. If you fix the error in your main document, the error will still be read in from the gls file. The best thing to do is to delete the gls file, and try again.
This may occur if you have long entry names, and you are using
either the style=long or style=super
options. The width of the description column is proportional to
the line width (in fact, it's 0.6\linewidth
)
but the first column is as wide as the widest entry name. You
can either redefine \glossaryalignment to change the
column specifications, or use one of the list-type styles.
You may need to LaTeX your document again (just as you have to do with \tableofcontents, \listoffigures etc).
The glossary package uses the keyval package to extract the information from key=value comma separated lists. You need to make sure the syntax is correct. If your value contains a comma, you will need to enclose value in curly braces. See the keyval documentation for further information7.
Check the following:
This has been fixed in version 2.01.
~
in \newacronym.
This has been fixed in version 2.1.
! Package array Error: Illegal pream-token (\glossaryalignment): `c' used.
The glossary package used to conflict with the array package. This was fixed in version 2.1. As from version 2.3, it doesn't matter whether you load the glossary package before or after the array package.
Use of \@chapter doesn't match its definitionor
! Argument of \@sect has an extra }
If you want to use an acronym command in a moving argument (such as a chapter heading) you need to \protect it first. Note that if you do put an acronym in a chapter etc heading, it will be expanded for the first time in the table of contents, not in the chapter heading. The best way to get around this is to use the optional argument, e.g.
\chapter[Introduction to Kernel Support Vector Machines]{Introduction to \protect\KSVM}You will also need to do this if you are using bookmarks in a PDF document.
Alternatively, you can do:
\resetacronym{KSVM} \chapter{Introduction to \protect\KSVM}or if you are using PDFLaTeX:
\resetacronym{KSVM} \chapter{Introduction to \texorpdfstring{\protect\KSVM}{KSVM}}
This problem is caused by the fact that ngerman redefines the effect of the double quote character, but this character is used in the creation of the ist makeindex style file. Try one of the following methods:
\usepackage{glossary} \makeglossary \usepackage{ngerman}
\usepackage{ngerman} \usepackage{glossary} \noist\makeglossary
keyword "\\glossaryentry" preamble "\\begin{theglossary}" postamble "\n\\end{theglossary}\n" group_skip "\\gloskip " item_0 "\n\\gloitem " delim_0 "\n\\glodelim " page_compositor "-" delim_n "\\delimN " delim_r "\\delimR "
unable to extract name from glossary item:
You are using an old version of makeglos.pl with a new version of the glossary package. You will need to update your version makeglos.pl.
The commands described in this section are now obsolete, but are currently still provided for backwards compatibility. Their use is deprecated.
\saveglosentry{ name}{description}
This command has now been replaced by \storeglosentry.
The command \glsprimaryfmt has now been removed.
The package option hyperacronym is now superseded by the package option hyper. This option was implemented prior to the introduction of the command \xglossary. Since the acronyms now use \xglossary, there is no difference between the hyperacronym and hyper options. This option has a boolean value:
I would like to thank all the many people who have made suggestions and pointed out bugs.
/usr/bin/
1These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.