summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/glossary/glossary.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/glossary/glossary.dtx')
-rw-r--r--Master/texmf-dist/source/latex/glossary/glossary.dtx980
1 files changed, 750 insertions, 230 deletions
diff --git a/Master/texmf-dist/source/latex/glossary/glossary.dtx b/Master/texmf-dist/source/latex/glossary/glossary.dtx
index bf00b2ba979..3c50320922c 100644
--- a/Master/texmf-dist/source/latex/glossary/glossary.dtx
+++ b/Master/texmf-dist/source/latex/glossary/glossary.dtx
@@ -1,20 +1,20 @@
%\iffalse
-% glossary.dtx generated using makedtx version 0.9b (c) Nicola Talbot
+% glossary.dtx generated using /nlctltpc/home/nlct/bin/makedtx version 0.9b (c) Nicola Talbot
% Command line args:
% -macrocode ".*\.p.*l"
% -macrocode ".*\.bat"
% -setambles ".*\.p.*l=>\nopreamble\nopostamble"
% -setambles ".*\.bat=>\nopreamble\nopostamble"
-% -src "(.+)\.(sty)=>\1.\2"
-% -src "(.+)\.(pl)=>\1.\2"
-% -src "(.+)\.(bat)=>\1.\2"
-% -src "(.+)\.(perl)=>\1.\2"
-% -src "(.+)\.(tex)=>\1.\2"
+% -src "(.+)\.(sty)\Z=>\1.\2"
+% -src "(.+)\.(pl)\Z=>\1.\2"
+% -src "(.+)\.(bat)\Z=>\1.\2"
+% -src "(.+)\.(perl)\Z=>\1.\2"
+% -src "(.+)\.(tex)\Z=>\1.\2"
% -doc "manual.tex"
% -author "Nicola Talbot"
% -dir "source"
% glossary
-% Created on 2005/9/27 12:20
+% Created on 2006/7/9 16:01
%\fi
%\iffalse
%<*package>
@@ -37,7 +37,7 @@
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
-% Copyright (C) 2005 Nicola Talbot, all rights reserved.
+% Copyright (C) 2006 Nicola Talbot, all rights reserved.
% \fi
% \iffalse
%<*driver>
@@ -48,7 +48,7 @@
hyperindex=false,
pdfauthor={N.L.C. Talbot},
pdftitle={glossary.sty: LaTeX2e Package to Assist Generating Glossaries},
- pdfkeywords={LaTeX,package,glossary}]{hyperref}
+ pdfkeywords={LaTeX,package,glossary,acronym}]{hyperref}
%hyperindex conflicts with doc
%(end up with |usage|hyperpage in indexentry)
@@ -94,9 +94,9 @@
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
-% \title{glossary.sty v 2.24: \LaTeXe\ Package to Assist Generating Glossaries}
+% \title{glossary.sty v 2.38: \LaTeXe\ Package to Assist Generating Glossaries}
% \author{Nicola L.C. Talbot}
-% \date{27th September 2005}
+% \date{9th July 2006}
% \maketitle
%\tableofcontents
%
@@ -162,6 +162,10 @@
%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 \texttt{makeglos.pl} as it may also
+%have been modified.
+%
% \section{Generating Glossary Information}
%
% The standard \LaTeX\ command \cmdname{makeglossary}\DescribeMacro{\makeglossary}{} (analogous to \cmdname{makeindex})
@@ -347,6 +351,11 @@
%fragile, care should be taken when using commands within its
%argument. If in doubt, use \cmdname{protect}.
%
+%As from version 2.36, if you want to use all glossary entries
+%which have been defined using \cmdname{storeglosentry}, do:
+%\verb|\useglosentry{*}|. (Note that this option is not
+%available for \cmdname{useGlosentry} and \cmdname{gls}.)
+%
%\section{makeglos.pl}
%
%The glossary information (as given by the commands
@@ -440,6 +449,7 @@
%options passed to the package.
%
%\section{Package Options}
+%\label{sec:options}
%
%The package options must be specified as a comma-separated list
%of \meta{key}=\meta{value} pairs. Available options are:
@@ -558,6 +568,15 @@
%\item[\pkgoptval{false}{acronym}] The acronyms will all
%be placed in the main glossary. (Default)
%\end{description}
+%
+%\item[\pkgopt{global}] Boolean variable:
+%\changes{2.31}{2005 December 5}{Package option \texttt{global}}
+%\begin{description}
+%\item[\pkgoptval{false}{global}] Acronym commands only have
+%a local effect. (Default)
+%\item[\pkgoptval{true}{global}] Acronym commands have a global
+%effect.
+%\end{description}
%\end{description}
% The \pkgopt{border}, \pkgopt{header} and \pkgopt{cols} options
%should not be used in conjunction with \pkgopt[list]{style}
@@ -691,7 +710,7 @@
%\label{sec:newglostype}
%
%A new type of glossary can be defined using the command:\DescribeMacro{\newglossarytype}\\[5pt]
-%\cmdname{newglossarytype}\verb/[/\meta{log-ext}\verb"]{"\meta{name}\verb'}{'\meta{out-ext}\verb+}{+\meta{in-ext}\verb!}!\\[5pt]
+%\cmdname{newglossarytype}\verb/[/\meta{log-ext}\verb"]{"\meta{name}\verb'}{'\meta{out-ext}\verb+}{+\meta{in-ext}\verb!}[!\meta{style list}\verb-]-\\[5pt]
%For example, suppose you want your document to have a separate
%index of terms and index of notation,
%you could use \icmdname{makeglossary}, \icmdname{glossary},
@@ -706,6 +725,17 @@
%and \cmdname{printnotation} which can be used for the second
%glossary.
%
+%\changes{2.3}{2005 Nov 18}{Added extra optional argument to'newglosarytype}
+%As from version 2.3, \cmdname{newglossarytype} now has an
+%additional optional argument \meta{style list}. This should
+%be a comma separated list of \meta{key}=\meta{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:
+%\texttt{style}, \texttt{header}, \texttt{border} and
+%\texttt{cols}. These can take the same values as those
+%given in the package options (described in section~\ref{sec:options}).
+%
%The command \cmdname{newglossarytype} should only occur in the
%preamble. The new commands
% \cmdname{make}\meta{name}, \verb'\'\meta{name},
@@ -827,7 +857,7 @@
%new glossary type called \texttt{acronym} will be defined as:
%\begin{verbatim}
%\newglossarytype[alg]{acronym}{acr}{acn}
-%\newcommand{\acronymname}{List of Acronyms}
+%\providecommand{\acronymname}{List of Acronyms}
%\end{verbatim}
%You will then need to use the commands \icmdname{makeacronym}
%and \icmdname{printacronym} to make the list of acronyms appear.
@@ -842,7 +872,16 @@
%\end{verbatim}
%Note that the package option \pkgopt[true]{acronym} is only
%appropriate if you want both a glossary and a separate list of
-%acronyms.
+%acronyms. If you do not write in English, you can set up your
+%own language definition
+%for \cmdname{acronymname} in the configuration file
+%\texttt{glossary}\filetype{cfg}. For example:
+%\begin{verbatim}
+%\newcommand{\acronymname}{Akronyme}
+%\end{verbatim}
+%(If \texttt{glossary.cfg} does not exist, create a new file, add the
+%appropriate definition of \cmdname{acronymname}, and save it to the
+%same directory as \texttt{glossary.sty}.)
%
%\changes{2.1}{2004 October 25}{name field can be omitted in
%\texttt{'newacronym}}
@@ -863,6 +902,43 @@
%\setacronymnamefmt{\gloshort}
%\end{verbatim}
%
+%\changes{2.32}{2006 January 5}{added \texttt{'setacronymdescfmt}}
+%As from version 2.32, you can also modify the way the description
+%key is formatted for acronyms using\DescribeMacro{\setacronymdescfmt}:\\[10pt]
+%\cmdname{setacronymdescfmt}\{\meta{format}\}\\[10pt]
+%Within \meta{format} you may use the commands \icmdname{glolong}
+%and \icmdname{gloshort} (as above), and you can also use
+%the command \icmdname{glodesc} which is the description as
+%specified by the \gloskey{description} key in
+%\icmdname{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:
+%\begin{verbatim}
+%\setacronymnamefmt{\gloshort}
+%\setacronymdescfmt{\glolong: \glodesc}
+%\newacronym{svm}{support vector machine}{description=Statistical
+%pattern recognition technique}
+%\end{verbatim}
+%will generate a glossary entry of the form:
+%\begin{verbatim}
+%\glossary{name=svm,description=support vector machine: Statistical
+%pattern recognition technique}
+%\end{verbatim}
+%Note that if you omit \icmdname{glodesc} from
+%\cmdname{setacronymdescfmt} the description specified
+%in \cmdname{newacronym} will be ignored. So
+%\begin{verbatim}
+%\setacronymnamefmt{\gloshort}
+%\setacronymdescfmt{\glolong}
+%\newacronym{svm}{support vector machine}{description=Statistical
+%pattern recognition technique}
+%\end{verbatim}
+%will generate a glossary entry of the form:
+%\begin{verbatim}
+%\glossary{name=svm,description=support vector machine}
+%\end{verbatim}
+%
%Given an acronym named \meta{acr-name} (the command name
%associated with the acronym as defined in
%\cmdname{newacronym} without the preceding backslash),
@@ -871,6 +947,7 @@
%\vspace{10pt}
%\changes{2.11}{2004 October 25}{\texttt{'useacronym}}
%\changes{2.18}{2005 July 5}{Fixed bug in 'useacronym}
+%\changes{2.26}{2005 November 17}{Fixed bug in 'useacronym}
%\noindent
%\cmdname{useacronym}\verb"["\meta{insert}\verb']{'\meta{acr-name}\verb!}!\DescribeMacro{\useacronym}\\[5pt]
%This command can be used instead of \cmdname{}\meta{acr-name}.
@@ -890,6 +967,16 @@
%\changes{2.21}{2005 July 27}{'resetallacronyms added}
%
%\vspace{10pt}
+%\changes{2.31}{2005 December 5}{'unsetacronym added}\noindent
+%\cmdname{unsetacronym}\verb'{'\meta{acr-name}\verb"}"
+%\DescribeMacro{\unsetacronym}\\[10pt]
+%This command will cause all subsequent uses of
+%\cmdname{}\meta{acr-name} to produce the short version.
+%To unset all acronyms
+%do \cmdname{unsetallacronyms}.\DescribeMacro{\unsetallacronyms}
+%\changes{2.31}{2005 December 5}{'unsetallacronyms added}
+%
+%\vspace{10pt}
%\changes{2.14}{2005 May 28}{'ifacronymfirstuse added}\noindent
%\cmdname{ifacronymfirstuse}%
%\verb'{'\meta{acr-name}%
@@ -932,6 +1019,8 @@
%be put in automatically using \icmdname{xspace}.
%\changes{2.22}{2005 Sept 16}{Added provision for 'xspace}
%\changes{2.23}{2005 Sept 17}{Fixed minor bug with hyperlinks and 'glsxspace}
+%\changes{2.28}{2005 July 9}{Fixed erroneous spaces occuring while
+%using xspace}
%
%\DescribeMacro{\acronymfont}
%\changes{2.22}{2005 Sept 12}{Added 'acronymfont}%
@@ -1053,6 +1142,36 @@
%\end{verbatim}
%By default, \cmdname{glossarypreamble} and \cmdname{glossarypostamble} do nothing.
%
+%\changes{2.3}{2005 Nov 18}{'glsbeforenum}%
+%\changes{2.3}{2005 Nov 18}{'glsafternum}%
+%Any text required before or after the list of page numbers
+%are specified by the commands \cmdname{glsbeforenum}
+%\DescribeMacro{\glsbeforenum}
+%and \cmdname{glsafternum}\DescribeMacro{\glsafternum}.
+%By default, these commands do nothing, any redefinition
+%of these commands should come somewhere before the
+%relevant \cmdname{printglossary} command. For example:
+%\begin{verbatim}
+%\printglossary
+%\renewcommand{\glsbeforenum}{(}
+%\renewcommand{\glsafternum}{)}
+%\printnotation
+%\end{verbatim}
+%This 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 \icmdname{newglossarystyle} (see
+%\autoref{sec:newglostype}) or using the command\DescribeMacro{setglossarystyle}:\\[10pt]
+%\cmdname{setglossarystyle}[\meta{type}]\{\meta{style list}\}\\[10pt]
+%For example:
+%\begin{verbatim}
+%\setglossarystyle[acronym]{style=long,border=true,cols=2}
+%\end{verbatim}
+%If \meta{type} is omitted, the change is applied to the main
+%glossary.
+%
%\changes{1.1}{2004 August 14}{\relax Increased User Flexibility}%
%\changes{2.14}{2005 May 29}{'setglossary added}
%\DescribeMacro{\setglossary}
@@ -1095,6 +1214,13 @@
%This setting corresponds to the \istkey{delim\_0} key in the
%\appname{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
+%\cmdname{noexpand}. For example:
+%\begin{verbatim}
+%\setglossary{glodelim={\noexpand\newline}}
+%\end{verbatim}
+%
%\item[\setglos{delimN}]
%\changes{1.1}{2004 August 14}{\texttt{'delimN}}
%The delimiter to be inserted between two
@@ -1114,6 +1240,34 @@
%package option \pkgopt[none]{number} is chosen, the value is set
%to empty.
%
+%\item[\setglos{gloskip}]
+%\changes{2.3}{2005 Nov 18}{'gloskip}
+%This specifies what to do between groups.
+%If \pkgopt[list]{style} or \pkgopt[altlist]{style} this has the
+%value \cmdname{indexspace}, otherwise it creates a blank line
+% in the \envname{longtable} or \envname{supertabular} environment.
+%This command corresponds to the \istkey{group\_skip} key in
+%the \appname{makeindex} style file.
+%Note that as from version 2.3, you should no longer redefine
+%the command \cmdname{gloskip}.
+%
+%\item[\setglos{delimT}]
+%\changes{2.3}{2005 Nov 18}{'delimT}
+%The text to be inserted after the list of
+%page numbers for an entry. (This corresponds to the
+%\istkey{delim\_t} key in the \appname{makeindex} style file.)
+%The default value depends on the glossary style. It does
+%nothing for the list-type styles, and has the value
+%\verb/\\/ for the tabular-type styles. Note that
+%\setglos{delimT} is separate from \cmdname{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:
+%\begin{verbatim}
+%\setglossary{delimT={\cr & \cr},gloskip={}}
+%\end{verbatim}
+%Note the use of \cmdname{cr} instead of \verb/\\/.
%\end{description}
%Note that:
%\begin{verbatim}
@@ -1172,14 +1326,15 @@
%\envname{longtable} or
%\envname{supertabular}
%environment with argument specified by
-%\cmdname{glossaryalignment}.\DescribeMacro{\glossaryalignment}
+%\cmdname{glossaryalignment}\footnote{This isn't quite true
+%anymore, see the documented code for clarification}.\DescribeMacro{\glossaryalignment}
%
%\changes{2.1}{2004 October 25}{made glossary compatible with array package}
-%The above conflicts with the \stynamefmt{array} package, so as
-%from version 2.1, if the \stynamefmt{array} package has been
-%loaded \emph{prior} to loading the \stynamefmt{glossary} package,
-%the new column type \texttt{G} will be defined and used
-%instead of \cmdname{glossaryalignment}.
+%\changes{2.3}{2005 Nov 18}{made glossary compatible with array package}
+%The glossary package no longer conflicts with the \stynamefmt{array}
+%package. Changes can now be made to \cmdname{glossaryalignment}
+%regardless of whether or not the \stynamefmt{array}
+%package has been used.
%
%The command \cmdname{gloitem}\DescribeMacro{\gloitem}\ indicates
%what to do at the start of each glossary entry.
@@ -1193,20 +1348,9 @@
%\verb"\item["\meta{text}\verb']\mbox{}\par'\\[5pt]
%otherwise it will do\\[5pt]
%\meta{text}\verb" &"\\[5pt]
-%if it's the first
-%item of the page or\\[5pt]
-%\verb'\\ '\meta{text}\verb" &"\\[5pt]
-%otherwise.
%This command corresponds to the \istkey{item\_0} key in the
%\appname{makeindex} style file.
%
-%The command \cmdname{gloskip}\DescribeMacro{\gloskip}\ specifies what to do between groups.
-%If \pkgopt[list]{style} or \pkgopt[altlist]{style} this has the
-%value \cmdname{indexspace}, otherwise it creates a blank line
-% in the \envname{longtable} or \envname{supertabular} environment.
-%This command corresponds to the \istkey{group\_skip} key in
-%the \appname{makeindex} style file.
-%
%The command \cmdname{glossaryheader}\DescribeMacro{\glossaryheader}\ (if \pkgopt[long]{style} or \pkgopt[super]{style} is selected)
%indicates what to do at the start of the \envname{longtable} or
%\envname{supertabular} environment. If \pkgopt[none]{border}, it
@@ -1252,6 +1396,7 @@
%\item \texttt{sampleNtn.tex} --- This has a glossary and defines
%a new glossary type called \texttt{notation}. The glossary has
%associated page numbers, but the new glossary type doesn't.
+%The two glossaries have different styles.
%You will need to do:
%\begin{verbatim}
%latex sampleNtn
@@ -1346,6 +1491,15 @@
%however, the entries with the same name but multiple descriptions
%will not be merged.
%
+%\item \texttt{sample4col.tex}---This illustrates how to
+%modify the glossary style so that it has 4 columns. You
+%will need to do:
+%\begin{verbatim}
+%latex sample4col
+%makeglos.pl sample4col
+%latex sample4col
+%\end{verbatim}
+%
%\end{itemize}
%
%\section{LaTeX2HTML Style File}
@@ -1419,6 +1573,10 @@
%
%\section{Troubleshooting}
%\label{sec:trouble}
+%
+%This is a list of common problems, for a more up-to-date FAQ, see
+%\url{http://theoval.cmp.uea.ac.uk/~nlct/packages/faq/}.
+%
%\begin{enumerate}
%\item My glossary hasn't appeared.
%
@@ -1476,6 +1634,14 @@
%in the list of acronyms, where \cmdname{}\meta{acr-name} is the
%name of an acronym command.
%
+%\item My acronym has been expanded twice.
+%
+%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 \pkgopt{global}
+%package option.
+%
%\item I get an error when using the command
%\icmdname{saveglosentry}.
%
@@ -1594,9 +1760,10 @@
%\end{verbatim}
%
%The \stynamefmt{glossary} package used to conflict with the
-%\stynamefmt{array} package. This was fixed in version 2.1,
-%however, you must load the \stynamefmt{array} package
-%\emph{prior} to loading the \stynamefmt{glossary} package.
+%\stynamefmt{array} package. This was fixed in version 2.1.
+%As from version 2.3, it doesn't matter whether you load
+%the \stynamefmt{glossary} package before or after the
+%\stynamefmt{array} package.
%
%\item\label{itm:fragile} I get the following error:
%\begin{verbatim}
@@ -1734,13 +1901,8 @@
%
%\section{Acknowledgements}
%
-%I would like to thank the following people for their
-%suggestions:
-%Jens~Happe,
-%Dmitry~Katsubo,
-%Markus~Lazanowski,
-%Slava~Pestov and
-%Dario~Teixeira
+%I would like to thank all the many people who have made suggestions
+%and pointed out bugs.
%
% \StopEventually{\PrintChanges\addcontentsline{toc}{section}{Change History}\PrintIndex\addcontentsline{toc}{section}{Index}}
%
@@ -1754,7 +1916,7 @@
% \subsection{Package Definition}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossary}[2005/09/27 2.24 (NLCT)]
+\ProvidesPackage{glossary}[2006/07/09 2.38 (NLCT)]
% \end{macrocode}
% Load packages needed by glossary.sty:
% \begin{macrocode}
@@ -1835,7 +1997,14 @@
\newif\ifglsacronym
\define@key{gloss}{acronym}[true]{\ifthenelse{\equal{#1}{true} \or \equal{#1}{false}}{\setboolean{glsacronym}{#1}}{%
-\PackageError{glossary}{Glossary option 'acronym' is boolean}{The value of 'acronym' canonly be set to 'true' or 'false'}}}
+\PackageError{glossary}{Glossary option 'acronym' is boolean}{The
+value of 'acronym' can only be set to 'true' or 'false'}}}
+
+\newif\ifglsglobal
+\define@key{gloss}{global}[true]{\ifthenelse{\equal{#1}{true}\or
+\equal{#1}{false}}{\setboolean{glsglobal}{#1}}{%
+\PackageError{glossary}{Glossary option 'global' is boolean}{The
+value of 'global' can only be set to 'true' or 'false'}}}
% \end{macrocode}
% Set up defaults
% \begin{macrocode}
@@ -1863,9 +2032,10 @@
\let\glsxspace\relax}{%
\let\glsxspace\xspace}
% \end{macrocode}
-% Temporarily disable xspace:
+% Set "\glossaryalignment" to "\relax" before loading
+% configuration file.
% \begin{macrocode}
-\newcommand{\gls@noxspace}[1]{{\let\glsxspace\relax#1}}
+\let\glossaryalignment\relax
% \end{macrocode}
% Load configuation file if it exists
% \begin{macrocode}
@@ -1886,8 +2056,13 @@
% \end{macrocode}
%Check to make sure that the options don't conflict.
% \begin{macrocode}
-\ifthenelse{\(\equal{\gls@style}{list} \or \equal{\gls@style}{altlist}\) \and \(\not\equal{\gls@header}{none} \or \not\equal{\gls@border}{none} \or \gls@cols=3\)}
-{\PackageError{glossary}{You can't have option 'style=list' or 'style=altlist' in combination with any of the other options}
+\ifthenelse{\(\equal{\gls@style}{list} \or
+\equal{\gls@style}{altlist}\) \and
+\(\not\equal{\gls@header}{none} \or \not\equal{\gls@border}{none}
+\or \gls@cols=3\)}
+{\PackageError{glossary}{You can't have option 'style=list' or
+'style=altlist' in combination with any of the other style
+options}
{The 'list' and 'altlist' options don't have a header, border or number of columns option.}}
{}
% \end{macrocode}
@@ -1940,6 +2115,16 @@
\gdef\@glo@n@me{}\setkeys{wrgloss}{#1}\relax
\endgroup\@esphack}
% \end{macrocode}
+% Command to extract description key from glossary entry.
+% \begin{macrocode}
+\newcommand{\@gls@getdescr}[1]{%
+\@bsphack\begingroup\@sanitize
+\protected@edef\@gls@dos@tk@y{\noexpand\setkeys{wrgloss}{#1}}%
+\def\@descr{}\@gls@dos@tk@y\relax
+\global\let\@glo@desc\@descr
+\endgroup\@esphack
+}
+% \end{macrocode}
% Now do macro so you can have a hyperlink that takes
% you to the entry in the glossary
% \begin{macrocode}
@@ -1947,24 +2132,42 @@
\glossref{\@glo@l@bel}{##1}\renewcommand{\@@wrglossary}{}}%
\glossary}
% \end{macrocode}
-% Save a bit of typing. The followig command is new to v2.17
+% Save a bit of typing. The following command is new to v2.17
+% (New to version 2.36: store label in a list)
+% \begin{macrocode}
+\newcommand*{\@glo@label@list}{}
+\toksdef\gls@ta=0 \toksdef\gls@tb=2
+\newcommand{\@glo@label@addtolist}[1]{%
+\gls@ta={{#1}}\gls@tb=\expandafter{\@glo@label@list}%
+\xdef\@glo@label@list{\the\gls@ta,\the\gls@tb}}
+% \end{macrocode}
+% First define command to store details:
% \begin{macrocode}
\newcommand*{\storeglosentry}[3][glossary]{%
+\ifthenelse{\equal{#2}{*}}{%
+\PackageError{glossary}{Glossary label '*' invalid}{You can't have
+a glossary entry with a * as the label}}{%
\@ifundefined{glo@#2@entry}{%
+\@glo@label@addtolist{#2}%
\expandafter\def\csname glo@#2@type\endcsname{#1}%
\expandafter\def\csname glo@#2@entry\endcsname{#3}%
\@gls@getn@me{#3}%
\expandafter\protected@edef\csname glo@#2@name\endcsname{\@glo@n@me}%
}{%
\PackageError{glossary}{Glossary entry '#2' already
-defined}{There already exists a glossary entry with the label '#2'}}%
+defined}{There already exists a glossary entry with the label '#2'}}}%
}
-
+% \end{macrocode}
+% This command will not produce text in the document, but will
+% produce the relevant glossary entry.
+% \begin{macrocode}
\providecommand{\useglosentry}[2][\relax]{%
+\ifthenelse{\equal{#2}{*}}{\@for\@glolab:=\@glo@label@list\do{%
+\ifthenelse{\equal{\@glolab}{}}{}{\useglosentry[#1]{\@glolab}}}}{%
\@ifundefined{glo@#2@type}{%
\PackageError{glossary}{Glossary entry '#2' undefined}{You need
to define the entry using \string\storeglosentry\space before
-using it.}}{%
+using it.}}{{%
\edef\@glostype{\csname glo@#2@type\endcsname}%
\ifx#1\relax
\protected@edef\@glo@cmd{\expandafter\noexpand\csname \@glostype\endcsname{\csname glo@#2@entry\endcsname}}%
@@ -1972,13 +2175,17 @@ using it.}}{%
\protected@edef\@glo@cmd{\expandafter\noexpand\csname \@glostype{\csname glo@#2@entry\endcsname,#1}}%
\fi
\@glo@cmd
-}}
-
+}}}}
+% \end{macrocode}
+% This command will produce the specified text in the document
+% (with a hyperlink if enabled), and will produce the relevant
+% glossary entry.
+% \begin{macrocode}
\providecommand{\useGlosentry}[3][\relax]{%
\@ifundefined{glo@#2@type}{%
\PackageError{glossary}{Glossary entry '#2' undefined}{You need
to define the entry using \string\storeglosentry\space before
-using it.}}{%
+using it.}}{{%
\edef\@glostype{x\csname glo@#2@type\endcsname}%
\ifx#1\relax
\protected@edef\@glo@cmd{\expandafter\noexpand\csname \@glostype\endcsname{\csname glo@#2@entry\endcsname}}%
@@ -1986,8 +2193,11 @@ using it.}}{%
\protected@edef\@glo@cmd{\expandafter\noexpand\csname \@glostype\endcsname{\csname glo@#2@entry\endcsname,#1}}%
\fi
\@glo@cmd{#3}%
-}}
-
+}}}
+% \end{macrocode}
+% As above, but the text displayed in the document is constructed from
+% the name key.
+% \begin{macrocode}
\newcommand{\gls}[2][\relax]{\useGlosentry[#1]{#2}{\csname glo@#2@name\endcsname}}
% \end{macrocode}
% This command was defined in earlier verions, but doesn't
@@ -2038,7 +2248,12 @@ using it.}}{%
\def\@glostype{glossary}
\newcommand{\delimN}{\csname @\@glostype @delimN\endcsname}
\newcommand{\delimR}{\csname @\@glostype @delimR\endcsname}
-\newcommand{\glodelim}{\csname @\@glostype @glodelim\endcsname}
+\newcommand{\gloitem}{\csname @\@glostype @gloitem\endcsname}
+\newcommand{\gloskip}{\csname @\@glostype @gloskip\endcsname}
+\newcommand{\delimT}{\glsafternum
+\csname @\@glostype @delimT\endcsname}
+\newcommand{\glodelim}{\csname @\@glostype @glodelim\endcsname
+\glsbeforenum}
% \end{macrocode}
% Allow user to change number format for different
@@ -2048,6 +2263,8 @@ using it.}}{%
\define@key{glossnum}{type}{\def\@glsnumtype{#1}}
\define@key{glossnum}{delimN}{\def\@delimN{#1}}
\define@key{glossnum}{delimR}{\def\@delimR{#1}}
+\define@key{glossnum}{delimT}{\def\@delimT{#1}}
+\define@key{glossnum}{gloskip}{\def\@gloskip{#1}}
\define@key{glossnum}{glodelim}{\def\@glodelim{#1}}
\providecommand{\ignore}[1]{}
@@ -2056,6 +2273,8 @@ using it.}}{%
\def\@glsnumtype{glossary}%
\def\@delimN{@dontchange@}%
\def\@delimR{@dontchange@}%
+\def\@delimT{@dontchange@}%
+\def\@gloskip{@dontchange@}%
\def\@glodelim{@dontchange@}%
\setkeys{glossnum}{#1}\relax
\@ifundefined{print\@glsnumtype}{%
@@ -2070,19 +2289,27 @@ Glossary type '\@glsnumtype' has not been defined}
\expandafter\xdef\csname @\@glsnumtype @delimR\endcsname{}%
}{}%
}%
-
+%
\ifthenelse{\equal{\@delimN}{@dontchange@}}{}{%
\expandafter\xdef\csname @\@glsnumtype @delimN\endcsname{%
-\@delimN}}
-
+\@delimN}}%
+%
\ifthenelse{\equal{\@delimR}{@dontchange@}}{}{%
\expandafter\xdef\csname @\@glsnumtype @delimR\endcsname{%
-\@delimR}}
-
+\@delimR}}%
+%
+\ifthenelse{\equal{\@delimT}{@dontchange@}}{}{%
+\expandafter\xdef\csname @\@glsnumtype @delimT\endcsname{%
+\@delimT}}%
+%
+\ifthenelse{\equal{\@gloskip}{@dontchange@}}{}{%
+\expandafter\xdef\csname @\@glsnumtype @gloskip\endcsname{%
+\@gloskip}}%
+%
\ifthenelse{\equal{\@glodelim}{@dontchange@}}{}{%
\expandafter\xdef\csname @\@glsnumtype @glodelim\endcsname{%
-\@glodelim}
-}
+\@glodelim}%
+}%
}}
% \end{macrocode}
% Now define the command "\printglossary" which will print the contents of the glossary file.
@@ -2113,34 +2340,74 @@ Glossary type '\@glsnumtype' has not been defined}
% version 2.24)
% \begin{macrocode}
\providecommand{\glossarytitle}{%
-\@ifundefined{chapter}
-{\section*{\@glossaryname}\relax
- \ifgls@toc\@glosaddtoc{section}\fi}
-{\ifthenelse{\boolean{gls@section}}
- {\section*{\@glossaryname}\relax
- \ifgls@toc\@glosaddtoc{section}\fi}
- {\ifgls@hypertoc\@ifundefined{if@twoside}{\clearpage}{%
- \if@twoside\@ifundefined{cleardoublepage}{\cleardoublepage}{\clearpage}\else
- \clearpage\fi}\phantomsection\@glosaddtoc{chapter}\fi\chapter*{\@glossaryname}\relax
- \ifgls@toc\@glosaddtoc{chapter}\fi}}
+\@ifundefined{chapter}%
+% \chapter not defined
+{%
+\ifgls@hypertoc
+% hypertoc option used
+\phantomsection% add anchor before \section*
+\@glosaddtoc{section}%
+\section*{\@glossaryname}\relax
+\else
+% hypertoc=false
+\section*{\@glossaryname}\relax
+% only add contentsline if toc=true
+\ifgls@toc\@glosaddtoc{section}\fi
+\fi}%
+{% \chapter defined
+\ifthenelse{\boolean{gls@section}}%
+{% user requested \section
+\ifgls@hypertoc
+% hypertoc=true
+\phantomsection% add anchor before \section*
+\@glosaddtoc{section}%
+\section*{\@glossaryname}\relax
+\else
+%hypertoc=false
+\section*{\@glossaryname}\relax
+% only add contentsline if toc=true
+\ifgls@toc\@glosaddtoc{section}\fi
+\fi}%
+{% use \chapter
+\ifgls@hypertoc
+% hypertoc=true
+% chapters usually start a new page, so to ensure
+% anchor is at the top of the correct page, issue
+% a \clearpage (or \cleardoublepage) to place the
+% anchor at the correct place
+\@ifundefined{if@twoside}{%
+% If document class doesn't support twosided documents
+% just do \clearpage
+\clearpage}{%
+\if@twoside
+% Document is two-sided
+% If \cleardoublepage is defined, use that
+% otherwise just do \clearpage
+\@ifundefined{cleardoublepage}{\clearpage}{\cleardoublepage}%
+\else
+% One-sided document, just do \clearpage
+\clearpage
+\fi}%
+\phantomsection% add anchor before \chapter
+\@glosaddtoc{chapter}%
+\fi
+\chapter*{\@glossaryname}\relax
+% only add contentsline if toc=true
+\ifgls@toc\@glosaddtoc{chapter}\fi}}
\markboth{\@shortglossaryname}{\@shortglossaryname}%
}
% \end{macrocode}
% Now define theglossary environment. Version 2.2:
% check to see if defined already
% \begin{macrocode}
-\@ifundefined{theglossary}{
-\newenvironment{theglossary}
-{\glossarytitle
- \glossarypreamble\@bef@reglos}
- {\@ftergl@s\glossarypostamble}
-}{%
-\PackageWarning{glossary}{Redefining 'theglossary' environment}
-\renewenvironment{theglossary}
-{\glossarytitle
- \glossarypreamble\@bef@reglos}
- {\@ftergl@s\glossarypostamble}
-}
+\@ifundefined{theglossary}{%
+\newenvironment{theglossary}{}{}}{%
+\PackageWarning{glossary}{Redefining 'theglossary' environment}}
+% \end{macrocode}
+% \begin{macrocode}
+\renewenvironment{theglossary}{%
+\glossarytitle
+\glossarypreamble\@bef@reglos}{\@ftergl@s\glossarypostamble}
% \end{macrocode}
% Provide a means to add text to the beginning or end
% of the glossary.
@@ -2162,21 +2429,62 @@ Glossary type '\@glsnumtype' has not been defined}
\newcommand{\@bef@reglos}{\global\gloitemfirsttrue\beforeglossary}
\newcommand{\@ftergl@s}{\afterglossary\global\gloitemfirstfalse}
% \end{macrocode}
+% Set up defaults.
+% \begin{macrocode}
+\newcommand{\glossaryalignment}{\relax}
+\newcommand{\@gls@align@glossary}{}
+\newcommand{\glosstail}{%
+\@ifundefined{@gls@tail@\@glostype}{%
+\PackageError{glossary}{No glossary tail defined for glossary
+type '\@glostype'}{}}{%
+\csname @gls@tail@\@glostype\endcsname}}
+\newcommand{\@gls@tail@glossary}{}
+\newcommand{\afterglossary}{%
+\@ifundefined{@gls@afterglos@\@glostype}{%
+\PackageError{glossary}{No after glossary defined for glossary
+type '\@glostype'}{}}{%
+\csname @gls@afterglos@\@glostype\endcsname}}
+\newcommand{\beforeglossary}{%
+\@ifundefined{@gls@beforeglos@\@glostype}{%
+\PackageError{glossary}{No before glossary defined for glossary
+type '\@glostype'}{}}{%
+\csname @gls@beforeglos@\@glostype\endcsname}}
+\newcommand{\@gls@beforeglos@glossary}{}
+\newcommand{\@gls@afterglos@glossary}{}
+\newcommand{\@glossary@glodelim}{}
+\newcommand{\@glossary@delimT}{}
+\newcommand{\glsafternum}{}
+\newcommand{\glsbeforenum}{}
+\newcommand{\@glossary@gloskip}{}
+\newcommand{\@glossary@gloitem}[1]{#1}
+% \end{macrocode}
% Now define what to do depending on which style has been selected.
-%First deal with the "list" and "altlist" style, as they're the easiest.
+% First define command to switch to "list" style:
% \begin{macrocode}
-
-\ifthenelse{\equal{\gls@style}{list} \or \equal{\gls@style}{altlist}}
-{
-\newcommand{\beforeglossary}{\begin{description}}
-\newcommand{\afterglossary}{\end{description}}
-\newcommand{\gloskip}{\indexspace}
-\ifthenelse{\equal{\gls@style}{list}}
- {\newcommand{\gloitem}[1]{\item[#1]}
- \newcommand{\@glossary@glodelim}{, }}
- {\newcommand{\gloitem}[1]{\item[#1]\mbox{}\par}
- \newcommand{\@glossary@glodelim}{ }}
-}{
+\newcommand{\gls@setlist}[1][glossary]{%
+\expandafter\def\csname @gls@beforeglos@#1\endcsname{%
+\begin{description}}%
+\expandafter\def\csname @gls@afterglos@#1\endcsname{%
+\end{description}}%
+\expandafter\def\csname @#1@gloskip\endcsname{\indexspace}%
+\expandafter\def\csname @#1@glodelim\endcsname{, }%
+\expandafter\def\csname @#1@gloitem\endcsname##1{\item[##1]}%
+\expandafter\def\csname @#1@glodelim\endcsname{, }%
+\expandafter\def\csname @#1@delimT\endcsname{}
+}
+% \end{macrocode}
+% Next define command to switch to "altlist" style:
+% \begin{macrocode}
+\newcommand{\gls@setaltlist}[1][glossary]{%
+\expandafter\def\csname @gls@beforeglos@#1\endcsname{%
+\begin{description}}%
+\expandafter\def\csname @gls@afterglos@#1\endcsname{%
+\end{description}}%
+\expandafter\def\csname @#1@gloskip\endcsname{\indexspace}%
+\expandafter\def\csname @#1@gloitem\endcsname##1{\item[##1]\mbox{}\nopagebreak\par\nopagebreak}%
+\expandafter\def\csname @#1@glodelim\endcsname{ }%
+\expandafter\def\csname @#1@delimT\endcsname{}
+}
% \end{macrocode}
%Now deal with the other styles. I orginally used a "tabular" environment,
%but obviously this doesn't work for a glossary longer than one page.
@@ -2191,102 +2499,199 @@ Glossary type '\@glsnumtype' has not been defined}
{If you want the "super" option, you have to have the "supertab" package installed.}}}
}
{\RequirePackage{longtable}}
-
+% \end{macrocode}
+% Define new length specifying the width of the description field.
+% \begin{macrocode}
\newlength{\descriptionwidth}
\setlength{\descriptionwidth}{0.6\textwidth}
-
-\ifthenelse{\equal{\gls@header}{none}}
-{
- \ifthenelse{\equal{\gls@border}{none}}
- {\newcommand{\glossaryheader}{}}
- {\newcommand{\glossaryheader}{\hline }}
+% \end{macrocode}
+% Initalise header to nothing. If this command is redefined it
+% will override the default header. This enables the user to
+% redesign the header by changing the definition of
+% "\glossaryheader" (thus providing backward compatibility.)
+% \begin{macrocode}
+\newcommand*{\glossaryheader}{\relax}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\@glossaryheader}{%
+\ifx\glossaryheader\relax
+\csname @\@glostype @header\endcsname
+\else
+\glossaryheader
+\fi
}
-{
+% \end{macrocode}
+% Define command to set header style.
+% \begin{macrocode}
+\newcommand{\gls@setheader}[1][glossary]{%
+\ifthenelse{\equal{\gls@header}{none}}%
+{%
+\ifthenelse{\equal{\gls@border}{none}}
+{\expandafter\def\csname @#1@header\endcsname{}%
+}{\expandafter\def\csname @#1@header\endcsname{\hline}}%
+}{%
\ifnum\gls@cols=2\relax
- \ifthenelse{\equal{\gls@border}{none}}
- {\newcommand{\glossaryheader}
- {\bfseries\entryname & \bfseries \descriptionname\\}}
- {\newcommand{\glossaryheader}
- {\hline\bfseries\entryname & \bfseries\descriptionname
- \\\hline\hline}}
+\ifthenelse{\equal{\gls@border}{none}}
+{%
+\expandafter\def\csname @#1@header\endcsname{%
+\bfseries\entryname & \bfseries \descriptionname\\}}%
+{%
+\expandafter\def\csname @#1@header\endcsname{%
+\hline\bfseries\entryname & \bfseries\descriptionname
+\\\hline\hline}}%
\else
- \ifthenelse{\equal{\gls@border}{none}}
- {\newcommand{\glossaryheader}
- {\bfseries\entryname & \bfseries \descriptionname & \\}}
- {\newcommand{\glossaryheader}
- {\hline\bfseries\entryname &\bfseries\descriptionname &
- \\\hline\hline}}
+\ifthenelse{\equal{\gls@border}{none}}
+{%
+\expandafter\def\csname @#1@header\endcsname{%
+\bfseries\entryname & \bfseries \descriptionname & \\}}%
+{%
+\expandafter\def\csname @#1@header\endcsname{%
+\hline\bfseries\entryname &\bfseries\descriptionname &
+\\\hline\hline}}%
\fi
-}
-
+}}
+% \end{macrocode}
+% Define command to set glossary alignment and borders
+% \begin{macrocode}
+\newcommand{\gls@setalignment}[1][glossary]{%
\ifthenelse{\equal{\gls@border}{none}}
{
\ifnum\gls@cols=2\relax
- \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}}}{
- \newcolumntype{G}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}}}
+\expandafter\def\csname @gls@align@#1\endcsname{%
+@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}}
\else
- \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l}}{
- \newcolumntype{G}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l}}
+\expandafter\def\csname @gls@align@#1\endcsname{%
+@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l}
\fi
-
- \ifthenelse{\equal{\gls@style}{super}}{
- \newcommand{\afterglossary}{ \\\end{supertabular}}
- }
- {
- \newcommand{\afterglossary}{ \\\end{longtable}}
- }
-
- \newcommand{\glosstail}{}
-}
-{
+%
+\expandafter\def\csname @gls@tail@#1\endcsname{}%
+}{%
\ifnum\gls@cols=2\relax
- \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}}{
- \newcolumntype{G}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}}
+\expandafter\def\csname @gls@align@#1\endcsname{%
+|@{\hspace{\tabcolsep}\bfseries
+}lp{\descriptionwidth}|}
\else
- \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l|}}{
- \newcolumntype{G}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l|}}
+\expandafter\def\csname @gls@align@#1\endcsname{%
+|@{\hspace{\tabcolsep}\bfseries
+}lp{\descriptionwidth}l|}
\fi
-
- \ifthenelse{\equal{\gls@style}{super}}{
- \newcommand{\afterglossary}{ \\\hline\end{supertabular}}
- }
- {
- \newcommand{\afterglossary}{ \\\hline\end{longtable}}
- }
-
- \newcommand{\glosstail}{\hline}
-}
-
-\ifthenelse{\equal{\gls@style}{super}}
-{
- \@ifundefined{newcolumntype}{
- \newcommand{\beforeglossary}
- {\tablehead{\glossaryheader}\tabletail{\glosstail}
- \begin{supertabular}{\glossaryalignment}}}
- {\newcommand{\beforeglossary}
- {\tablehead{\glossaryheader}\tabletail{\glosstail}
- \begin{supertabular}{G}}}
+%
+\expandafter\def\csname @gls@tail@#1\endcsname{\hline}%
+}%
+%
+\expandafter\def\csname @#1@delimT\endcsname{\\}
+%
+\ifnum\gls@cols=2\relax
+\expandafter\def\csname @#1@gloskip\endcsname{& \\}%
+\expandafter\def\csname @#1@glodelim\endcsname{, }%
+\else
+\expandafter\def\csname @#1@gloskip\endcsname{& & \\}%
+\expandafter\def\csname @#1@glodelim\endcsname{& }%
+\fi
+\expandafter\def\csname @#1@gloitem\endcsname##1{##1 &}%
}
-{
- \@ifundefined{newcolumntype}{\newcommand{\beforeglossary}
- {\begin{longtable}{\glossaryalignment}
- \glossaryheader\endhead\glosstail\endfoot}}
- {\newcommand{\beforeglossary}
- {\begin{longtable}{G}
- \glossaryheader\endhead\glosstail\endfoot}}
+% \end{macrocode}
+% Need a way to avoid conflict with the array package. In an
+% earlier version I defined a new column type if the array
+% package was being used, however this restricts the ability
+% to have multiple glossaries with different column alignments.
+% \begin{macrocode}
+\newcommand{\@st@rtglostable}[2]{%
+\gls@ta={\begin{#1}}\gls@tb=\expandafter{#2}%
+\edef\@st@rtglost@ble{\the\gls@ta{\the\gls@tb}}
+\@st@rtglost@ble}
+% \end{macrocode}
+% Define command to switch to "super" style:
+% \begin{macrocode}
+\newcommand{\gls@setsuper}[1][glossary]{%
+\gls@setalignment[#1]%
+\gls@setheader[#1]%
+%
+\expandafter\def\csname @gls@beforeglos@#1\endcsname{%
+\tablehead{\@glossaryheader}\tabletail{\glosstail}%
+\if\glossaryalignment\relax
+\expandafter\let\expandafter\@glossaryalignment\csname @gls@align@#1\endcsname
+\else
+\let\@glossaryalignment\glossaryalignment
+\fi
+\@st@rtglostable{supertabular}\@glossaryalignment}
+%
+\expandafter\def\csname @gls@afterglos@#1\endcsname{%
+\end{supertabular}}%
}
-
-\ifnum\gls@cols=2\relax
-\newcommand{\gloskip}{\ifgloitemfirst\global\gloitemfirstfalse \else\\ \fi &}
-\newcommand{\@glossary@glodelim}{, }
+% \end{macrocode}
+% Define command to switch to "long" style:
+% \begin{macrocode}
+\newcommand{\gls@setlong}[1][glossary]{%
+\gls@setalignment[#1]%
+\gls@setheader[#1]%
+%
+\expandafter\def\csname @gls@beforeglos@#1\endcsname{%
+\if\relax\glossaryalignment
+\expandafter\let\expandafter\@glossaryalignment\csname @gls@align@#1\endcsname
\else
-\newcommand{\gloskip}{\ifgloitemfirst\global\gloitemfirstfalse \else\\ \fi & &}
-\newcommand{\@glossary@glodelim}{& }
+\let\@glossaryalignment\glossaryalignment
\fi
-\newcommand{\gloitem}[1]{\ifgloitemfirst\global\gloitemfirstfalse #1 \else \\#1 \fi &}
+\@st@rtglostable{longtable}{\@glossaryalignment}
+\@glossaryheader\endhead\glosstail\endfoot}
+
+%
+\expandafter\def\csname @gls@afterglos@#1\endcsname{%
+\end{longtable}}%
}
+% \end{macrocode}
+% Define command to set the glossary style.
+% \begin{macrocode}
+\newcommand{\@setglossarystyle}[1][glossary]{%
+\@ifundefined{gls@set\gls@style}{%
+\PackageError{glossary}{Glossary style '\gls@style' undefined}{}}{%
+\csname gls@set\gls@style\endcsname[#1]}}
+% \end{macrocode}
+% Set glossary style
+% \begin{macrocode}
+\@setglossarystyle
+% \end{macrocode}
+% Define keys to change glossary style
+% \begin{macrocode}
+\define@key{glosstyle}
+ {style}
+ {\ifthenelse{\equal{#1}{list} \or \equal{#1}{altlist} \or \equal{#1}{super} \or \equal{#1}{long}}
+ {\def\gls@style{#1}}
+ {\PackageError{glossary}
+ {Unknown glossary style '#1'}
+ {Available styles are: list, altlist, super and long}}}
-\ifthenelse{\equal{\gls@number}{none} \and \gls@cols<3}{\renewcommand{\@glossary@glodelim}{}}{}
+\define@key{glosstyle}
+ {header}[plain]{\ifthenelse{\equal{#1}{none} \or \equal{#1}{plain}}
+ {\def\gls@header{#1}}
+ {\PackageError{glossary}
+ {Unknown glossary style '#1'}
+ {Available styles are: none and plain}}}
+
+\define@key{glosstyle}
+ {border}[plain]{\ifthenelse{\equal{#1}{none} \or \equal{#1}{plain}}
+ {\def\gls@border{#1}}
+ {\PackageError{glossary}
+ {Unknown glossary border '#1'}
+ {Available styles are: none and plain}}}
+\define@key{glosstyle}{cols}{\gls@cols=#1\relax
+\ifthenelse{\gls@cols<2 \or \gls@cols>3}
+ {\PackageError{glossary}
+ {invalid number of columns}
+ {The cols option can only be 2 or 3}}
+ {}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\setglossarystyle}[2][glossary]{%
+\setkeys{glosstyle}{#2}%
+\@setglossarystyle[#1]%
+}
+% \end{macrocode}
+% Set the delimiter for the case where there is no numbering
+% and there aren't 3 columns.
+% \begin{macrocode}
+\ifthenelse{\equal{\gls@number}{none} \and \gls@cols<3}{%
+\renewcommand{\@glossary@glodelim}{}}{}
% \end{macrocode}
% \subsection{Makeindex style file}
%This is the code to generate the ".ist" file.
@@ -2309,6 +2714,7 @@ Glossary type '\@glsnumtype' has not been defined}
\write\istfile{page_compositor "\pagecompositor"}
\write\istfile{delim_n "\string\\delimN "}
\write\istfile{delim_r "\string\\delimR "}
+\write\istfile{delim_t "\string\\delimT "}
\closeout\istfile
}
\catcode`\%14\relax
@@ -2337,9 +2743,13 @@ Glossary type '\@glsnumtype' has not been defined}
\@bsphack\begingroup\@sanitize\@index}
% \end{macrocode}
%\subsection{Defining new glossary type}
-%First parameter name of new glossary type e.g.\ "notation".
-%Second parameter extension of output file (equivalent to "ind" or "glo".
-%Third parameter extension of input file (equivalent to "idx" or "gls").
+% First parameter (optional) is the extension of the log file
+% (information used by makeglos.pl but not \LaTeX).
+% Second parameter is the name of new glossary type
+% e.g.\ "notation". Third parameter is the extension of output
+% file (equivalent to "ind" or "glo". Fourth parameter
+% is the extension of input file (equivalent to "idx" or "gls").
+% The fifth parameter (optional) is the format.
% \begin{macrocode}
\newcommand{\@newglossarytype}[4][glg]{}
\newcommand{\newglossarytype}[4][glg]{
@@ -2349,7 +2759,6 @@ Glossary type '\@glsnumtype' has not been defined}
\expandafter\gdef\csname glsX\@glstype Xnumformat\endcsname{\glsXglossaryXnumformat}%
\expandafter\gdef\csname @\@glstype @delimN\endcsname{\@glossary@delimN}%
\expandafter\gdef\csname @\@glstype @delimR\endcsname{\@glossary@delimR}%
-\expandafter\gdef\csname @\@glstype @glodelim\endcsname{\@glossary@glodelim}%
\expandafter\gdef\csname @gls@\@glstype @inext\endcsname{#4}%
\expandafter\def\csname @gls@#2@type\endcsname{#4}%
\expandafter\edef\csname make\@glstype\endcsname{%
@@ -2371,12 +2780,14 @@ Glossary type '\@glsnumtype' has not been defined}
}{%
\noexpand\edef\noexpand\@shortglossaryname{%
\noexpand\csname short\@glstype name\noexpand\endcsname}}%
-\noexpand\@prntgl@ss@ry{\@glsin}}
+\noexpand\@prntgl@ss@ry{\@glsin}}%
}{\PackageError{glossary}{Command
\expandafter\string\csname #2\endcsname \space already defined}{%
You can't call your new glossary type '#2' because there already
-exists a command with this name}}
-}
+exists a command with this name}}%
+\@@n@wglostype}
+\newcommand{\@@n@wglostype}[1][]{%
+\setglossarystyle[\@glstype]{#1}}
% \end{macrocode}
% Define equivalent of "\makeglossary":
% \begin{macrocode}
@@ -2462,11 +2873,18 @@ exists a command with this name}}
% \begin{macrocode}
\newcommand{\glsprimaryfmt}[1]{\textbf{\glsnumformat{#1}}}
% \end{macrocode}
+% Specify how to control the way the name key is
+% set for acronyms.
% \begin{macrocode}
-%\newcommand{\acronymlabprefix}{GGG}
\newcommand{\@acronymnamefmt}{\glolong\ (\gloshort)}
\newcommand{\setacronymnamefmt}[1]{\def\@acronymnamefmt{#1}}
% \end{macrocode}
+% Specify how to control the way the description key is
+% set for acronyms.
+% \begin{macrocode}
+\newcommand{\@acronymdescfmt}{\glodesc}
+\newcommand{\setacronymdescfmt}[1]{\def\@acronymdescfmt{#1}}
+% \end{macrocode}
% Format the acronym abbreviation in the format specified
% by \verb'\acronymfont'. This simply prints its
% argument by default.
@@ -2479,64 +2897,70 @@ exists a command with this name}}
\ifthenelse{\equal{#1}{}}{\renewcommand\@acrnmcmd{#2}}{\renewcommand\@acrnmcmd{#1}}
\@ifundefined{\@acrnmcmd}{%
\expandafter\newcommand\csname\@acrnmcmd short\endcsname{#2\protect\glsxspace}
+\expandafter\newcommand\csname\@acrnmcmd @nx@short\endcsname{#2}
\expandafter\newcommand\csname\@acrnmcmd long\endcsname{#3\protect\glsxspace}
+\expandafter\newcommand\csname\@acrnmcmd @nx@long\endcsname{#3}
\def\@acrn@entry{#4}
{
+% extract description
+\@gls@getdescr{\@acrn@entry}%
+\let\glodesc\@glo@desc%
\def\glolong{#3}%
\def\gloshort{\noexpand\acronymfont{#2}}%
\expandafter\protected@xdef\expandafter\@acrnamefmt{\@acronymnamefmt}
+\expandafter\protected@xdef\expandafter\@acrdesc{\@acronymdescfmt}
}
\@acr@addtolist{\@acrnmcmd}
-\protected@edef\@acr@glsentry{name=\@acrnamefmt,format=glsnumformat,sort=\@acrnmcmd,\@acrn@entry}
+\protected@edef\@acr@glsentry{name={\@acrnamefmt},format=glsnumformat,sort={\@acrnmcmd},\@acrn@entry,description={\@acrdesc}}
\newboolean{\@acrnmcmd first}\setboolean{\@acrnmcmd first}{true}
\expandafter\protected@edef\csname \@acrnmcmd\endcsname{\noexpand\@ifstar{\csname @s@\@acrnmcmd\endcsname}{\csname @\@acrnmcmd\endcsname}}
-\ifglshyperacronym
+\ifglshyperacronym % hyperlinks
% unstarred version
\expandafter\protected@edef\csname @\@acrnmcmd\endcsname{%
\noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{%
-\noexpand\gls@noxspace{\csname\@acrnmcmd long\endcsname\noexpand\@acrnmins\
+\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\
(\noexpand\xacronym{\@acr@glsentry}{%
-\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}%
-})}\noexpand\setboolean{\@acrnmcmd first}{false}%
+\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}%
+})\noexpand\unsetacronym{\@acrnmcmd}%
}{\noexpand\xacronym{\@acr@glsentry}{%
-\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}\noexpand\@acrnmins}}\noexpand\glsxspace}
+\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}\noexpand\@acrnmins}}\noexpand\glsxspace}
% starred version
\expandafter\protected@edef\csname @s@\@acrnmcmd\endcsname{%
\noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{%
-\noexpand\gls@noxspace{\noexpand\expandafter\noexpand\MakeUppercase
-\csname\@acrnmcmd long\endcsname\noexpand\@acrnmins\
+\noexpand\expandafter\noexpand\MakeUppercase
+\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\
(\noexpand\xacronym{\@acr@glsentry}{%
-\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}%
-})}%
-\noexpand\setboolean{\@acrnmcmd first}{false}}{%
+\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}%
+})%
+\noexpand\unsetacronym{\@acrnmcmd}}{%
\noexpand\xacronym{\@acr@glsentry}{%
\noexpand\acronymfont{\noexpand\expandafter\noexpand\MakeUppercase
-\csname\@acrnmcmd short\endcsname}%
+\csname\@acrnmcmd @nx@short\endcsname}%
\noexpand\@acrnmins}}\noexpand\glsxspace}
-\else
+\else % no hyperlinks
% unstarred version
\expandafter\protected@edef\csname @\@acrnmcmd\endcsname{%
\noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{%
-\noexpand\gls@noxspace{\csname\@acrnmcmd long\endcsname\
+\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\
(\noexpand\acronym{\@acr@glsentry}{%
-\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}%
-})}\noexpand\setboolean{\@acrnmcmd first}{false}%
+\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}%
+})\noexpand\unsetacronym{\@acrnmcmd}%
}{\noexpand\acronym{\@acr@glsentry}{%
-\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}}}%
+\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}\noexpand\@acrnmins}}%
\noexpand\glsxspace}
% starred version
\expandafter\protected@edef\csname @s@\@acrnmcmd\endcsname{%
\noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{%
-\noexpand\gls@noxspace{\noexpand\expandafter
+\noexpand\expandafter
\noexpand\MakeUppercase
-\csname\@acrnmcmd long\endcsname\noexpand\@acrnmins\
+\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\
(\noexpand\acronym{\@acr@glsentry}{%
-\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}%
-})}%
-\noexpand\setboolean{\@acrnmcmd first}{false}}{%
+\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}%
+})%
+\noexpand\unsetacronym{\@acrnmcmd}}{%
\noexpand\acronym{\@acr@glsentry}{%
\noexpand\acronymfont{\noexpand\expandafter\noexpand\MakeUppercase
-\csname\@acrnmcmd short\endcsname}%
+\csname\@acrnmcmd @nx@short\endcsname}%
\noexpand\@acrnmins}}\noexpand\glsxspace}
\fi
}{%
@@ -2555,21 +2979,23 @@ exists a command with this name}}
\newcommand{\@acrln}[1]{\@ifundefined{#1long}{%
\PackageError{glossary}{Acronym '#1' has not been defined}{}}{%
-\gls@noxspace{\csname#1long\endcsname}}}
+\csname#1@nx@long\endcsname}}
\newcommand{\@sacrln}[1]{\@ifundefined{#1long}{%
\PackageError{glossary}{Acronym '#1' has not been defined}{}}{%
-\gls@noxspace{\expandafter\expandafter\expandafter
-\MakeUppercase\csname#1long\endcsname}}}
+\expandafter\expandafter\expandafter
+\MakeUppercase\csname#1@nx@long\endcsname}}
\newcommand{\acrsh}{\@ifstar\@sacrsh\@acrsh}
\newcommand{\@acrsh}[1]{\@ifundefined{#1short}{%
-\PackageError{glossary}{Acronym '#1' has not been defined}{}}{\acronymfont{\gls@noxspace{\csname#1short\endcsname}}}}
+\PackageError{glossary}{Acronym '#1' has not been defined}{}}{%
+\acronymfont{\csname#1@nx@short\endcsname}}}
\newcommand{\@sacrsh}[1]{\@ifundefined{#1short}{%
\PackageError{glossary}{Acronym '#1' has not been defined}{}}{%
-\acronymfont{\gls@noxspace{\expandafter\expandafter\expandafter\MakeUppercase\csname#1short\endcsname}}}}
+\acronymfont{\expandafter\expandafter\expandafter
+\MakeUppercase\csname#1@nx@short\endcsname}}}
\newcommand{\ifacronymfirstuse}[3]{%
\@ifundefined{if#1first}{%
@@ -2579,10 +3005,26 @@ exists a command with this name}}
\newcommand{\resetacronym}[1]{%
\@ifundefined{if#1first}{%
\PackageError{glossary}{Acronym '#1' not defined}{}}{%
-\setboolean{#1first}{true}}}
+\ifglsglobal
+\expandafter\global\csname #1firsttrue\endcsname
+\else
+\setboolean{#1first}{true}%
+\fi}}
+
+\newcommand{\unsetacronym}[1]{%
+\@ifundefined{if#1first}{%
+\PackageError{glossary}{Acronym '#1' not defined}{}}{%
+\ifglsglobal
+\expandafter\global\csname #1firstfalse\endcsname
+\else
+\setboolean{#1first}{false}%
+\fi}}
\newcommand{\resetallacronyms}{%
\@for\@acr:=\@acr@list\do{\resetacronym{\@acr}}}
+
+\newcommand{\unsetallacronyms}{%
+\@for\@acr:=\@acr@list\do{\unsetacronym{\@acr}}}
% \end{macrocode}
%These commands are provided to make it easier change the page number format to bf, sf, tt and it
%if you are using hyperlinks
@@ -2658,7 +3100,7 @@ exists a command with this name}}
% \begin{macrocode}
\ifglsacronym
\newglossarytype[alg]{acronym}{acr}{acn}
-\newcommand{\acronymname}{List of Acronyms}
+\providecommand{\acronymname}{List of Acronyms}
\else
\let\acronym=\glossary
\let\xacronym=\xglossary
@@ -2676,7 +3118,7 @@ exists a command with this name}}
# File : makeglos
# Author : Nicola Talbot
-# Version : 1.3 (2005/06/28)
+# Version : 1.4 (2005/11/19)
# Description: simple Perl script that calls makeindex.
# Intended for use with "glossary.sty" (saves having to remember
# all the various switches)
@@ -2953,6 +3395,11 @@ sub makeindex{
for ($i=0; $i <= $j; $i++)
{
+ # remove all but the last \delimT
+ while ($item[$i]{'desc'}=~s/\\delimT/$&/sg > 1)
+ {
+ $item[$i]{'desc'}=~s/\\delimT//s;
+ }
print OUTPUT "\\gloitem ", $item[$i]{'name'},
$item[$i]{'desc'};
}
@@ -2977,7 +3424,7 @@ sub makeindex{
% \begin{macrocode}
@rem = '-*- Perl -*-
@echo off
-perl -S %0.pl %1 %2 %3 %4 %5 %6 %7 %8 %9
+perl -S %~dp0makeglos.pl %*
% \end{macrocode}
% \begin{macrocode}
%</makeglos.bat>
@@ -2988,8 +3435,8 @@ perl -S %0.pl %1 %2 %3 %4 %5 %6 %7 %8 %9
% \begin{macrocode}
# File : glossary.perl
# Author : Nicola Talbot
-# Date : 8 July 2005
-# Version : 1.02
+# Date : 5 December 2005
+# Version : 1.03
# Description : LaTeX2HTML implementation of glossary package.
package main;
@@ -3759,6 +4206,36 @@ sub do_cmd_resetallacronyms{
$_;
}
+sub do_cmd_unsetacronym{
+ local($_) = @_;
+ local($cmdname);
+
+ $cmdname = &missing_braces unless
+ (s/$next_pair_pr_rx/$cmdname=$2;''/eo);
+
+ if (defined %{$acronym{$cmdname}})
+ {
+ $global{"${cmdname}first"} = 0;
+ }
+ else
+ {
+ &write_warnings("acronym '$cmdname' not defined");
+ }
+
+ $_;
+}
+
+sub do_cmd_unsetallacronyms{
+ local($_) = @_;
+
+ foreach $key (keys %acronym)
+ {
+ $global{"${key}first"} = 0;
+ }
+
+ $_;
+}
+
%savedglosentry = ();
# This command is deprecated
@@ -4067,6 +4544,10 @@ merge them. This can be done using
\texttt{makeglos.pl}, and passing the option
\texttt{-m}.
+If a comma appears within the name or description, grouping
+must be used: \xglossary{name=page list,description={a list
+of individual pages or page ranges, e.g.\ 1,2,4,7-9}}{page list}
+
\printglossary
\end{document}
@@ -4074,29 +4555,63 @@ merge them. This can be done using
%</sample.tex>
% \end{macrocode}
% \begin{macrocode}
+%<*sample4col.tex>
+% \end{macrocode}
+\documentclass[a4paper]{article}
+
+% start out with 3 column format to make it easier to modify
+\usepackage[style=long,cols=3]{glossary}
+
+% make glossary have 4 columns all left aligned
+% (this assumes entries can fit onto a single line
+% otherwise use p specifier instead of l)
+\renewcommand{\glossaryalignment}{llll}
+% Header row
+\renewcommand{\glossaryheader}{%
+\bfseries Name & \bfseries Description & \bfseries Unit &
+\bfseries Page}
+
+\makeglossary
+
+\begin{document}
+
+\printglossary
+
+The width\glossary{name={$w$},sort=w,description={width&m}}, $w$, is
+measured in meters. The
+mass\glossary{name={$M$},sort=M,description={mass&kg}}, $M$ is
+measured in kilograms.
+
+\end{document}
+% \begin{macrocode}
+%</sample4col.tex>
+% \end{macrocode}
+% \begin{macrocode}
%<*sampleAcr.tex>
% \end{macrocode}
\documentclass[a4paper]{report}
\usepackage{xspace}
\usepackage[colorlinks,plainpages=false]{hyperref}
-\usepackage[style=altlist,toc,number=none]{glossary}
+\usepackage[style=altlist,hypertoc,number=none,acronym]{glossary}
+%\usepackage[style=long,toc,number=none]{glossary}
-\makeglossary
+%\makeglossary
+\makeacronym
-\renewcommand{\acronymfont}[1]{\textmd{\scshape #1}}
+%\renewcommand{\acronymfont}[1]{\textmd{\scshape #1}}
-\setacronymnamefmt{\gloshort: \expandafter\MakeUppercase\glolong}
+%\setacronymnamefmt{\gloshort: \expandafter\MakeUppercase\glolong}
+%\setacronymnamefmt{\gloshort}
+%\setacronymdescfmt{\expandafter\MakeUppercase\glolong: \glodesc}
\newacronym{svm}{support vector machine}{description=Statistical pattern recognition technique~\cite{svm}}
-\newacronym[ksvm]{k-svm}{kernel support vector machine}{description=Statistical pattern recognition technique using
-the ``kernel trick'' (see also SVM)}
+\newacronym[ksvm]{k-svm}{kernel support vector machine}{description={Statistical pattern recognition technique using
+the ``kernel trick'' (see also SVM)}}
\begin{document}
\tableofcontents
-\printglossary
-
\chapter{Support Vector Machines}
@@ -4120,6 +4635,9 @@ The \ksvm\ is \ifacronymfirstuse{svm}{a}{an} \svm\ that uses the so called ``ker
\bibitem{svm} \ldots
\end{thebibliography}
+%\printglossary
+\printacronym
+
\end{document}
% \begin{macrocode}
%</sampleAcr.tex>
@@ -4132,13 +4650,15 @@ The \ksvm\ is \ifacronymfirstuse{svm}{a}{an} \svm\ that uses the so called ``ker
\usepackage{amsmath}
\usepackage[header,border=none,cols=3]{glossary}
-
\newcommand{\erf}{\operatorname{erf}}
\newcommand{\erfc}{\operatorname{erfc}}
\renewcommand{\theglossarynum}{\theequation}
\renewcommand{\pagecompositor}{.}
+% The following will put a blank line between every entry
+%\setglossary{delimT={\cr & \cr},gloskip={}}
+
\renewcommand{\glossaryname}{Index of Special Functions and Notations}
\renewcommand{\glossaryheader}{\bfseries Notation &
@@ -4573,18 +5093,18 @@ G = 0.915\,965\,594\ldots
\usepackage[plainpages=false,colorlinks]{hyperref}
\usepackage{html}
-\usepackage[toc]{glossary}
+%\usepackage{array}
+\usepackage[toc,style=long,cols=3]{glossary}
\makeglossary
-\newglossarytype{notation}{not}{ntn}
+\newglossarytype{notation}{not}{ntn}[style=long,cols=2,border,header]
% Set up notation style
\newcommand{\notationname}{Notation}
% Don't display numbers, remove commas and number hyphens
% for notation entries
-\setglossary{type=notation,glsnumformat=ignore,%
-glodelim={.}}
+%\setglossary{type=notation,glsnumformat=ignore,glodelim={.}}
\makenotation