%\iffalse % glossary.dtx generated using 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" % -doc "manual.tex" % -author "Nicola Talbot" % -dir "source" % glossary % Created on 2005/9/27 12:20 %\fi %\iffalse %<*package> %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} % %\fi % \iffalse % Doc-Source file to use with LaTeX2e % Copyright (C) 2005 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> \documentclass[a4paper]{ltxdoc} \usepackage{ifthen} \usepackage[colorlinks, bookmarks, hyperindex=false, pdfauthor={N.L.C. Talbot}, pdftitle={glossary.sty: LaTeX2e Package to Assist Generating Glossaries}, pdfkeywords={LaTeX,package,glossary}]{hyperref} %hyperindex conflicts with doc %(end up with |usage|hyperpage in indexentry) %This unfortunately means that the changes section doesn't %have active links, but at least it will keep makeindex happy. \renewcommand{\usage}[1]{\textit{\hyperpage{#1}}} \renewcommand{\main}[1]{\hyperpage{#1}} \newcommand{\see}[2]{\emph{see} #1} \makeatletter \def\index@prologue{\section*{Index}} \makeatother \RecordChanges \PageIndex \OnlyDescription \newcommand{\cmdname}[1]{\texttt{\symbol{92}#1}} \newcommand{\istkey}[1]{\texttt{#1}\index{makeindex key>#1|hyperpage}} \newcommand{\icmdname}[1]{\texttt{\symbol{92}#1}\SpecialMainIndex{#1}} \newcommand{\appname}[1]{\texttt{#1}\index{#1=\texttt{#1}|hyperpage}} \newcommand{\gloskey}[1]{\texttt{#1}\index{glossary keys=\cmdname{glossary} keys>#1|hyperpage}} \newcommand{\setglos}[1]{\texttt{#1}\index{setglossary keys=\cmdname{setglossary} keys>#1|hyperpage}} \newcommand{\glsnumfmt}[1]{\texttt{#1}% \index{page number formats>#1|hyperpage}% \index{glossary keys=\cmdname{glossary} keys>format>#1|hyperpage}} \newcommand{\pkgopt}[2][]{% \ifthenelse{\equal{#1}{}}{% \texttt{#2}\index{package options>#2|hyperpage}}{% \texttt{#2=#1}\index{package options>#2>#1|hyperpage}}} \newcommand{\pkgoptval}[2]{\texttt{#1}\index{package options>#2>#1|hyperpage}} \newcommand{\filetype}[1]{\texttt{#1}\index{file types>#1|hyperpage}} \newcommand{\stynamefmt}[1]{\textsf{#1}\index{#1=\textsf{#1}|hyperpage}} \newcommand{\envname}[1]{\textsf{#1}} \begin{document} \DocInput{glossary.dtx} \end{document} % %\fi %\MakeShortVerb{"} %\DeleteShortVerb{\|} % % \title{glossary.sty v 2.24: \LaTeXe\ Package to Assist Generating Glossaries} % \author{Nicola L.C. Talbot} % \date{27th September 2005} % \maketitle %\tableofcontents % % \section{Introduction} % \changes{1.0}{2004 July 29}{Initial version} % The \stynamefmt{glossary} package is provided to assist %generating a glossary. It has a certain amount of flexibility, %allowing the user to customize the format of the glossary, and %define new glossary-style objects. % %\section{Installation} % %You need to make sure you have downloaded the following three %files: %\begin{verbatim} %glossary.ins %glossary.dtx %README %\end{verbatim} %To extract the code from the \texttt{glossary.dtx} file, you %will need to run the installation file through LaTeX: %\begin{verbatim} %latex glossary.ins %\end{verbatim} %This will create the following files: %\begin{verbatim} %glossary.sty %glossary.perl %makeglos.pl %makeglos.bat %\end{verbatim} %along with several sample files. The file \texttt{glossary.sty} %should be placed somewhere in the \LaTeX\ path, e.g.\ %\texttt{texmf/tex/latex/glossary/}. The file %\texttt{glossary.perl} is a \LaTeX2HTML\ style file, and should %be placed in the \LaTeX2HTML\ style file directory (usually %\texttt{latex2html/styles/}). The file \texttt{makeglos.pl} %is a Perl script which calls \appname{makeindex}. If you are %using UNIX or Linux, you will need to set the permissions so %that you can execute the file: %\begin{verbatim} %chmod a+x makeglos.pl %\end{verbatim} %You should then place this file somewhere on your path. %(You may also need to edit the first line of %this file, if \appname{perl} is located in a directory other than \verb"/usr/bin/"\footnote{and you can also remove the \texttt{.pl} %extension which isn't to everyone's liking.}.) % %If you are not using UNIX or Linux, you may have to explicitly %load the file into Perl, so you would need to do %\texttt{perl makeglos.pl} instead of just \texttt{makeglos.pl}. %If you are using Windows, a batch file, \texttt{makeglos.bat} %is provided which will run Perl on \texttt{makeglos.pl}. %Both \texttt{makeglos.pl} and \texttt{makeglos.bat} should %be placed somewhere specified by the PATH environment %variable. (For example, put them both in the same %directory as \appname{makeindex}, which will probably %be in \verb+\texmf\miktex\bin\+). %\changes{2.22}{2005 Sept 12}{added makeglos.bat file} % %If you don't have Perl installed on your system, you can just use %\appname{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. % % \section{Generating Glossary Information} % % The standard \LaTeX\ command \cmdname{makeglossary}\DescribeMacro{\makeglossary}{} (analogous to \cmdname{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 %\cmdname{glossary}\verb"{"\meta{key-val list}\verb'}'\DescribeMacro{\glossary}. % This command is a slightly modified version of the standard %\cmdname{glossary} command, in order to separate out the %information into \meta{entry-name} and \meta{entry-description}. %The argument to \cmdname{glossary} must be a comma-separated %list of \meta{key}=\meta{value} pairs. The following keys are %available: %\begin{center} %\begin{tabular}{ll} %\bfseries Key & \bfseries Value\\ %\ttfamily \gloskey{name} & The entry name\\ %\ttfamily \gloskey{description} & A description about the entry\\ %\ttfamily \gloskey{sort} & How to sort the entry. (Entry name used if sort omitted)\\ %\ttfamily \gloskey{format} & How to format the page number %\end{tabular} %\end{center} % For example: %\begin{verbatim} %\glossary{name={singular matrix}, % description={A matrix with zero determinant}} %\end{verbatim} % The following example sorts on the text \texttt{U} instead of %\verb"$\mathcal{U}$": %\begin{verbatim} %\glossary{name={$\mathcal{U}$}, % description={The universal set}, % sort=U} %\end{verbatim} %The page format for individual entries can be changed using the %\gloskey{format} key. This should be the name of a \LaTeX\ %formatting command without the preceding \verb'\' (as with the %\verb'|' operator in \cmdname{index}.) For example: %\begin{verbatim} %\glossary{name={$\mathbb{R}$}, % description={The set of real numbers}, % sort=R, % format=textbf} %\end{verbatim} %In addition, the following formats are also available: %\changes{2.0}{2004 September 21}{Hyper page formats: %\texttt{'hypersf}, \texttt{'hypertt}, \texttt{'hyperbf} and %\texttt{'hyperbf}} %\changes{2.12}{2004 November 1}{Hyper page format: %\texttt{'hyperrm}} %\begin{center} %\begin{tabular}{ll} %\glsnumfmt{hyperrm} & The number is a hyper link in roman \\ %\glsnumfmt{hypersf} & The number is a hyper link in sans-serif \\ %\glsnumfmt{hypertt} & The number is a hyper link in typewriter font \\ %\glsnumfmt{hyperbf} & The number is a hyper link in bold \\ %\glsnumfmt{hyperit} & The number is a hyper link in italic %\end{tabular} %\end{center} %If the \pkgopt{hyper} option has not been set, %\glsnumfmt{hyperrm} etc are equivalent to \texttt{textrm} etc. %You should use \icmdname{hyperrm} instead of %\cmdname{hyperpage}, as \cmdname{hyperpage} won't %work on a list or range of numbers in the glossary% %\footnote{This is because the list and number ranges are %delimited using \cmdname{delimR} and \cmdname{delimN} instead of %explicitly using a comma or en-dash.}. % %As with the \cmdname{index} command, care must be taken if you %want to use the special characters: \verb'@' \verb/|/ \verb+"+ and %\verb'!'. These characters should be preceded by the double quote %character. For example: %\begin{verbatim} %\glossary{name={$"|\mathcal{S}"|$, %description=The cardinality of the set \mathcal{S}}} %\end{verbatim} %There is no provision for sub-entries, as these are %generally only applicable in an index, and not in a glossary. % %\changes{2.14}{2005 May 28}{'xglossary added}% %As from version 2.14, there is an additional command available: %\DescribeMacro{\xglossary} %\par\vspace{10pt}\noindent\cmdname{xglossary}\verb'{'\meta{gls-entry}% %\verb'}{'\meta{text}\verb"}" %\par\vspace{10pt}\noindent This is equivalent to\meta{text}\icmdname{glossary}\verb'{'\meta{gls-entry}\verb"}", %where \meta{text} will be made a hyperlink to the %relevant entry in the glossary, if hyper %links are supported. % %\subsection{Storing Glossary Information} % %\changes{2.17}{2005 June 28}{'storeglosentry added} %\DescribeMacro{\storeglosentry} %The following command:\\[10pt] %\begin{ttfamily} %\cmdname{storeglosentry}[\textrm{\meta{gls-type}}]\{\textrm{\meta{label}}\}\{\textrm{\meta{gls-entry}}\} %\end{ttfamily}\\[10pt] %can be used to store glossary information. That information %can then be used later with any of the following commands: %\changes{2.14}{2005 May 28}{'useglosentry added} %\changes{2.14}{2005 May 28}{'useGlosentry added} %\changes{2.18}{2005 July 5}{'gls added} %\DescribeMacro{\useglosentry} %\DescribeMacro{\useGlosentry} %\DescribeMacro{\gls}\\[10pt] %\begin{ttfamily} %\cmdname{useglosentry}[\textrm{\meta{opt}}]\{\textrm{\meta{label}}\}\\ %\cmdname{useGlosentry}[\textrm{\meta{opt}}]\{\textrm{\meta{label}}\}\{\textrm{\meta{text}}\}\\ %\cmdname{gls}[\textrm{\meta{opt}}]\{\textrm{\meta{label}}\} %\end{ttfamily}\\[10pt] %\cmdname{useglosentry} adds the stored glossary entry %\meta{gls-entry} to the appropriate glossary, %\cmdname{useGlosentry} adds the stored glossary entry, and %makes \meta{text} a hyperlink to that entry (if hyperlinks are %supported). The third command, \cmdname{gls}, is like %\cmdname{useGlosentry}, but forms \meta{text} from the name %given in \meta{gls-entry}. % %Returning to an earlier example, instead of typing: %\begin{verbatim} %\glossary{name={$\mathcal{U}$}, % description={The universal set}, % sort=U} %\end{verbatim} %every time you want to add this entry to the glossary, you %can instead store the information: %\changes{2.19}{2005 July 8}{fixed bug in 'storeglosentry} %\begin{verbatim} %\storeglosentry{glos:U}{name={$\protect\mathcal{U}$}, % description={The universal set}, % sort=U} %\end{verbatim} %(Note the use of \cmdname{protect}.) Now, instead of continually %copying and pasting the glossary command for this entry (which %can have quite a large \gloskey{description} field), you can use either: %\begin{verbatim} %\useglosentry{glos:U} %\end{verbatim} %which is equivalent to: %\begin{verbatim} %\glossary{name={$\mathcal{U}$}, % description={The universal set}, % sort=U} %\end{verbatim} %or you can use: %\begin{verbatim} %\useGlosentry{glos:U}{text} %\end{verbatim} %which is equivalent to: %\begin{verbatim} %\xglossary{name={$\mathcal{U}$}, % description={The universal set}, % sort=U}{text} %\end{verbatim} %or you can use: %\begin{verbatim} %\gls{glos:U} %\end{verbatim} %which is equivalent to: %\begin{verbatim} %\xglossary{name={$\mathcal{U}$}, % description={The universal set}, % sort=U}{$\mathcal{U}$} %\end{verbatim} %The optional argument \meta{gls-type} indicates the glossary %type (see \autoref{sec:newglostype} to find out how to define new %glossary types). If omitted, the standard glossary is used. % %The optional argument \meta{opt} allows you to add additional %information to the glossary entry, for example: %\begin{verbatim} %\useglosentry[format=textbf]{glos:U} %\end{verbatim} %is equivalent to: %\begin{verbatim} %\glossary{name={$\mathcal{U}$}, % description={The universal set}, % sort=U, % format=textbf} %\end{verbatim} %The identifying label, \meta{label}, should not contain any %special characters, and since \cmdname{storeglosentry} is %fragile, care should be taken when using commands within its %argument. If in doubt, use \cmdname{protect}. % %\section{makeglos.pl} % %The glossary information (as given by the commands %\cmdname{glossary} and \cmdname{xglossary}) is saved in the file %with the extension \filetype{glo} (unless the %\icmdname{makeglossary} command is omitted, in which case the %glossary information is simply ignored.) A \appname{makeindex} %style file\index{makeindex style file (.ist)|see{file types, ist}} %(\filetype{ist}) is also created, which is customized for the %document, and can be passed to \appname{makeindex}. % %For example, suppose your document is called \texttt{mydoc.tex}, %the glossary will be saved in the file %\texttt{mydoc.}\filetype{glo}, and the \appname{makeindex} style %file \texttt{mydoc.}\filetype{ist} will be created. % These files can then be passed to \appname{makeindex} as follows: %\begin{verbatim} %makeindex -s mydoc.ist -t mydoc.glg -o mydoc.gls mydoc.glo %\end{verbatim} %which generates the output file \texttt{mydoc.}\filetype{gls}, %with transcript written to %\texttt{mydoc.}\filetype{glg}. % %The Perl script \appname{makeglos.pl} provided with this package %allows you to use \appname{makeindex} without having to remember %all the command line options. The command %\begin{verbatim} %makeglos.pl mydoc.glo %\end{verbatim} %will perform the command: %\begin{verbatim} %makeindex -s mydoc.ist -t mydoc.glg -o mydoc.gls mydoc.glo %\end{verbatim} %The \filetype{glo} extension may be omitted. In addition, %\appname{makeglos.pl} also takes the option %\texttt{-m} which can be used to collate entries where the %same name has multiple descriptions. %\changes{2.14}{2005 May 28}{makeglos -m switch added} % %\appname{makeglos.pl} has the following syntax: %\begin{verbatim} %makeglos.pl [-ilqrgm] [-s sty] [-o gls] [-t log] [-p num] %\end{verbatim} %where all switches, apart from \texttt{-m} are the same as %those for \appname{makeindex}. In addition, if the extension %to the input file name is omitted, \filetype{glo} will be %assumed. If there are multiple glossary types (see %\autoref{sec:newglostype}) and the file extension is omitted, \appname{makeglos.pl} will %iterate through each glossary type. % %The name of the \filetype{ist} file can be changed by redefining %the command \cmdname{istfilename}\DescribeMacro{\istfilename}. %For example: %\begin{verbatim} %\renewcommand{\istfilename}{foo.ist} %\end{verbatim} %However, you will need to explicitly pass the name of this %file to \appname{makeglos.pl} using the \texttt{-s} switch. % %Creation of the \filetype{ist} file can be suppressed by issuing %the command \cmdname{noist}\DescribeMacro{\noist}\ before %\icmdname{makeglossary}. It will also be suppressed when the %command \icmdname{nofiles} is used, or if the command %\icmdname{makeglossary} is omitted. % %It should be noted that there are a few packages that can %cause problems with the creation of the \filetype{ist} file, %for example \stynamefmt{ngerman}. If you encounter problems %when \LaTeX\ is processing the \icmdname{makeglossary} command, %or if you get errors from \appname{makeindex} complaining about %the style file, this is the most probable cause. %See \autoref{sec:trouble}, item~\ref{itm:ngerman} for %information on how to fix this. % %\section{Displaying the Glossary} % % Once the \filetype{gls} file has been created by %\appname{makeindex} (as described in the previous % section) the glossary can then be included in the document with %the command \cmdname{printglossary}\DescribeMacro{\printglossary}. % If chapters are defined, the glossary will start %with\SpecialMainIndex{glossaryname} %\begin{verbatim} %\chapter*{\glossaryname} %\end{verbatim} %If not, it will start with %\begin{verbatim} %\section*{\glossaryname} %\end{verbatim} %The format of the main body of the glossary depends on the %options passed to the package. % %\section{Package Options} % %The package options must be specified as a comma-separated list %of \meta{key}=\meta{value} pairs. Available options are: %\begin{description} %\item[\pkgopt{style}] The glossary style. Values: %\index{glossary style|see{package options, style}} %\begin{description} %\item[\pkgoptval{list}{style}] use %\envname{description} environment in the glossary %\item[\pkgoptval{altlist}{style}] modified %version of \pkgopt[list]{style}. The description starts on the %line following the name of the term being defined. %\changes{2.0}{2004 September 21}{Package option \texttt{altlist} %style} %\item[\pkgoptval{super}{style}] use %\envname{supertabular} environment in the glossary %\item[\pkgoptval{long}{style}] use %\envname{longtable} environment in the glossary (Default) %\end{description} % %\item[\pkgopt{header}]\index{glossary header|see{package options, header}} Glossary %header. Values: %\begin{description} %\item[\pkgoptval{none}{header}] The glossary %doesn't have a heading (Default) %\item[\pkgoptval{plain}{header}] The glossary %has a heading %\end{description} % %\item[\pkgopt{border}]\index{glossary border|see{package options, border}} Glossary %border. Values: %\begin{description} %\item[\pkgoptval{none}{border}] The glossary %doesn't have a border (Default) %\item[\pkgoptval{plain}{border}] Border %around the main body of the glossary %\end{description} % %\item[\pkgopt{cols}]\index{glossary columns|see{package options, cols}} Number of %columns. Values: %\begin{description} %\item[\pkgoptval{2}{cols}] The entry name and description are in two separate %columns with the associated page numbers in the same column as %the description. (Default) %\item[\pkgoptval{3}{cols}] The entry name, description and associated page numbers %are in three separate columns. %\end{description} % % \changes{1.1}{2004 August 14}{Package option \texttt{number}} %\item[\pkgopt{number}] % Associated number corresponding to each entry. Values: %\begin{description} %\item[\pkgoptval{page}{number}] %Each entry has the corresponding page number(s) where the %entry is defined. (Default) %\item[\pkgoptval{section}{number}] %Each entry has the corresponding section number(s) where %the entry is defined. %\item[\pkgoptval{none}{number}] The corresponding numbers are %suppressed. %\end{description} % %\item[\pkgopt{toc}]\index{table of contents, adding to|see{package options, toc}} %Boolean variable: %\changes{2.0}{2004 September 21}{Package option \texttt{toc}} %\begin{description} %\item[\pkgoptval{true}{toc}] Add glossary to table of contents %\item[\pkgoptval{false}{toc}] Omit glossary from table of contents (Default) %\end{description} %Note that if you specify this option, you will need to run %\LaTeX\ twice after generating the glossary. % %\item[\pkgopt{hypertoc}] %Boolean variable. This is similar to the package option %\pkgopt{toc}, but if you are using the \stynamefmt{hyperref} %package, \pkgopt{hypertoc} will generate a link to the %beginning of the page, whereas \pkgopt{toc} will have %a hyperlink to jst after the glossary title. Note %that you can not use both \pkgopt[true]{toc} and %\pkgopt[true]{hypertoc}. Default value: %\pkgopt[false]{hypertoc}. %\changes{2.24}{2005 September 27}{Package option \texttt{hypertoc}} % %\item[\pkgopt{hyper}] Boolean %variable: %\changes{2.0}{2004 September 21}{Package option \texttt{hyper}} %\begin{description} %\item[\pkgoptval{true}{hyper}] Make associated numbers in the %glossary a hypertext link, and also make acronyms, and the text %given by \icmdname{xglossary} have a hyperlink to their %corresponding entries in the glossary. %\item[\pkgoptval{false}{hyper}] Don't make associated numbers a hypertext link %\end{description} %If the \stynamefmt{hyperref} or \stynamefmt{html} package has %been loaded prior to loading \texttt{glossary.sty}, %\pkgopt[true]{hyper} is set, otherwise %the default is \pkgopt[false]{hyper}. Note that this package %option now encompasses the old \pkgopt{hyperacronym} option. % %\item[\pkgopt{section}] Boolean variable: %\changes{2.12}{2004 November 1}{Package option \texttt{section}} %\begin{description} %\item[\pkgoptval{true}{section}] Make the glossary an unnumbered %section, even if chapters are defined% % %\item[\pkgoptval{false}{section}] Only make glossary an %unnumbered section if chapters are not defined (default). %\end{description} % %\item[\pkgopt{acronym}] Boolean variable: %\changes{2.17}{2005 June 28}{Package option \texttt{acronym}} %\begin{description} %\item[\pkgoptval{true}{acronym}] Make the list of acronyms %separate from the main glossary. % %\item[\pkgoptval{false}{acronym}] The acronyms will all %be placed in the main glossary. (Default) %\end{description} %\end{description} % The \pkgopt{border}, \pkgopt{header} and \pkgopt{cols} options %should not be used in conjunction with \pkgopt[list]{style} %or \pkgopt[altlist]{style}, as they only make sense with one of %the tabular-style options. %The value for the boolean variables can be omitted if they are %to be set. For example % \pkgopt{toc} is equivalent to \pkgopt[true]{toc}. Note that the %\pkgoptval{altlist}{style} style is better suited to %glossaries with long entry names. % %You can set up your own preferred defaults in a configuration %file% %\index{glossary.cfg|see{file type, cfg}}. %The file must be called \texttt{glossary.}\filetype{cfg} and %should be placed somewhere on the \TeX\ path. In this file you %can use the command \DescribeMacro{\glossarypackageoptions}% %\noindent %\cmdname{glossarypackageoptions}\verb'{'\meta{option-list}\verb/}/ %\noindent %where \meta{option-list} is a comma-separated list of %\meta{key}=\meta{value} pairs, as passed to the %\stynamefmt{glossary} %package. Note that this command may only be used in the %configuration file. % %\subsection{Examples} % Suppose the document has the following \icmdname{glossary} %commands: %\begin{center}\ttfamily %\begin{tabular}{@{\rmfamily}ll@{}l} %\bfseries Page & \multicolumn{2}{c}{\bfseries\rmfamily Command}\\ %1 & \cmdname{glossary}\{&name=diagonal matrix,\\ % & &description=Matrix whose only non-zero\\ % & &entries are along the leading diagonal\}\\ %2 & \cmdname{glossary}\{&name=identity matrix,\\ % & &description=Diagonal matrix with 1s along the \\ % & &leading diagonal\}\\ %4 & \cmdname{glossary}\{&name=singular matrix,\\ % & &description=Matrix with zero determinant\} %\end{tabular} %\end{center} % %\noindent Variations: %\begin{enumerate} %\item If \pkgopt[list]{style} is chosen, the glossary will look like: %\begin{description} %\item[diagonal matrix] Matrix whose only non-zero entries are along the leading % diagonal, 1 %\item[identity matrix] Diagonal matrix with 1s along the leading diagonal, 2 %\item[singular matrix] Matrix with zero determinant, 4 %\end{description} % %\item If \pkgopt[altlist]{style} is chosen, the glossary will look like: %\begin{description} %\item[diagonal matrix]\mbox{}\par Matrix whose only non-zero entries are along the leading % diagonal, 1 %\item[identity matrix]\mbox{}\par Diagonal matrix with 1s along the leading diagonal, 2 %\item[singular matrix]\mbox{}\par Matrix with zero determinant, 4 %\end{description} % %\item If \pkgopt[list]{style},\pkgopt[none]{number}% % is chosen, the glossary will look like: %\begin{description} %\item[diagonal matrix] Matrix whose only non-zero entries are along the leading % diagonal %\item[identity matrix] Diagonal matrix with 1s along the leading diagonal %\item[singular matrix] Matrix with zero determinant %\end{description} % %\item If \pkgopt[long]{style},\pkgopt[none]{border},% %\pkgopt[none]{header},\pkgopt[page]{number} %is chosen (default), the glossary will look like:\\[10pt] %\newlength{\descriptionwidth}\setlength{\descriptionwidth}{0.6\textwidth} %\begin{tabular}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}} & %\\ diagonal matrix & Matrix whose only non-zero entries are along the leading % diagonal, 1 %\\ & %\\identity matrix & Diagonal matrix with 1s along the leading diagonal, 2 %\\ & %\\ singular matrix & Matrix with zero determinant, 4 %\end{tabular} % %\item If \pkgopt[long]{style},\pkgopt[plain]{border},% %\pkgopt[none]{header} is chosen, %the glossary will look like: %\\[10pt] %\begin{tabular}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}\hline & %\\ diagonal matrix & Matrix whose only non-zero entries are along the leading % diagonal, 1 %\\ & %\\identity matrix & Diagonal matrix with 1s along the leading diagonal, 2 %\\ & %\\ singular matrix & Matrix with zero determinant, 4 %\\ & \\\hline %\end{tabular} % %\item If \pkgopt[long]{style},\pkgopt[plain]{border},% %\pkgopt[plain]{header} is %chosen, the glossary will look like: %\\[10pt] %\begin{tabular}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}\hline %\bfseries Notation & \bfseries Description\\\hline\hline & %\\ diagonal matrix & Matrix whose only non-zero entries are along the leading % diagonal, 1 %\\ & %\\identity matrix & Diagonal matrix with 1s along the leading diagonal, 2 %\\ & %\\ singular matrix & Matrix with zero determinant, 4 %\\ & \\\hline %\end{tabular} % %\item If \pkgopt[long]{style},\pkgopt[none]{border},% %\pkgopt[plain]{header},\pkgopt[3]{cols} is chosen, the %glossary will look like: %\\[10pt] %\begin{tabular}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l} %\bfseries Notation & \bfseries Description & \\ & %\\ diagonal matrix & Matrix whose only non-zero entries are along the leading % diagonal & 1 %\\ & %\\identity matrix & Diagonal matrix with 1s along the leading diagonal & 2 %\\ & %\\ singular matrix & Matrix with zero determinant & 4 %\\ & \\ %\end{tabular} %\end{enumerate} % % %\section{Defining New Glossary Types} %\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] %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}, %\icmdname{xglossary} and \icmdname{printglossary} for the first %glossary, and define a new type of glossary called say, %\texttt{notation}, using %\begin{verbatim} %\newglossarytype[nlg]{notation}{not}{ntn} %\end{verbatim} %which will create the analogous commands: %\cmdname{makenotation}, \cmdname{notation}, \cmdname{xnotation} %and \cmdname{printnotation} which can be used for the second %glossary. % %The command \cmdname{newglossarytype} should only occur in the %preamble. The new commands % \cmdname{make}\meta{name}, \verb'\'\meta{name}, %\verb'\x'\meta{name} and \cmdname{print}\meta{name} all have the %same format as their ``glossary'' counter-parts. % %The glossary information will be saved to a file %with the extension given by \meta{out-ext} (analogous to %\filetype{glo}), which can then be passed to \appname{makeindex} %either directly or via \appname{makeglos.pl}, %and the file to be read in (i.e.\ the file created by %\appname{makeindex}) will have the extension \meta{in-ext} %(analogous to \filetype{gls}). % %The optional argument \meta{log-ext} indicates %the extension for the \appname{makeindex} log file, if omitted the %extension \filetype{glg} is used. This is not used by \LaTeX, %however \appname{makeglos.pl} reads in this information from %the \LaTeX\ auxiliary file and passes it to \appname{makeindex}.\changes{2.22}{2005 Sept 12}{changed makeglos to read information in from .aux instead of .log file} % %For the above \texttt{notation} %example, if your document is called, say, \texttt{mydoc.tex}, % you will need to do the following: %\begin{verbatim} %latex mydoc %makeglos.pl mydoc %latex mydoc %\end{verbatim} %(You may need to do an extra \verb"latex mydoc" to get %cross-references up-to-date.) Note that if you don't specify the %file extension when using \appname{makeglos.pl}, it will %check the transcript file from the \LaTeX\ run to determine %all the glossary types, so, for this example, %\begin{verbatim} %makeglos.pl mydoc %\end{verbatim} %is equivalent to: %\begin{verbatim} %makeglos.pl mydoc.glo %makeglos.pl mydoc.not %\end{verbatim} %since \appname{makeglos.pl} has read in the information %for the \texttt{notation} glossary type from the file %\texttt{mydoc.log}. % %If you don't have Perl installed %on your system, or for any other reason are unable to use %\appname{makeglos.pl}, you can call \appname{makeindex} %explicitly: %\begin{verbatim} %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 %\end{verbatim} % %Note that you can use the command %\icmdname{printglossary}\texttt[\meta{name}\texttt] %instead of \verb'\print'\meta{name}. %These two commands have the same effect when using \LaTeX, %however, they have a slightly different effect when %using \LaTeX2HTML (see \autoref{sec:l2h}). % %If the command \verb'\'\meta{glossary-type}\verb"name" %is defined, (e.g.\ \verb'\notationname' in the above example) %this will be used as the title for the specified %glossary. If this command is not defined, \icmdname{glossaryname} %will be used instead. %If the command \verb'\short'\meta{glossary-type}\verb"name" %is defined, (e.g.\ \cmdname{shortnotationname} in the above %example) this will be used for the table of contents %entry, otherwise \verb'\'\meta{glossary-type}\verb"name" will %be used instead. %For example: %\begin{verbatim} %\newglossarytype[nlg]{notation}{not}{ntn} %\newcommand{\notationname}{Index of Notation} %\newcommand{\shortnotationname}{Notation} %\end{verbatim} % %\section{Acronyms} % %\changes{2.0}{2004 September 21}{Acronyms} %The \stynamefmt{glossary} package provides the command\DescribeMacro{\newacronym}:\\[5pt] %\begin{ttfamily} %\cmdname{newacronym}[\textrm{\meta{cmd-name}}]\{\textrm{\meta{acronym}}\}\{\textrm{\meta{long}}\}\{\textrm{\meta{glossary entry}}\} %\end{ttfamily}\\[5pt] %which can be used to define acronyms. The argument \meta{long} %is the full name, the argument \meta{acronym} is the acronym for %\meta{long} and \meta{glossary entry} is the glossary information %in the form used by the \icmdname{glossary} command. If the %optional argument \meta{cmd-name} is missing, %\cmdname{newacronym} will create a command called %\verb!\!\meta{acronym}, otherwise it will create a command %called \verb'\'\meta{cmd-name} (henceforth denoted \cmdname{}\meta{acr-name}). %This command can then be used throughout the text. The first %instance of this command is equivalent to:\\[10pt] %\meta{long} \texttt(\icmdname{xacronym}\verb"{"\gloskey{name}\texttt{=}\meta{long} \texttt(\meta{acronym}\texttt{),}\meta{glossary entry}\verb'}{'\meta{acronym}\verb/}/\texttt)\\[10pt] %subsequent instances will be equivalent to:\\[10pt] %\icmdname{xacronym}\verb"{"\gloskey{name}\texttt{=}\meta{long} \texttt(\meta{acronym}\texttt{),}\meta{glossary entry}\verb'}{'\meta{acronym}\verb/}/\\[10pt] %The command \cmdname{}\meta{acr-name} also has a starred %version, which will make the first letter of \meta{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 \gloskey{sort} key, otherwise you %will get an error. For example: %\begin{verbatim} %\newacronym[SVM]{\textsc{svm}}{Support Vector Machine}% %{description=Statistical pattern recognition %technique,sort=svm} %\end{verbatim} % %If the package option \pkgopt{acronym} is not set (default) %\icmdname{xacronym}, is a synonym for \icmdname{xglossary}. %If the package option \pkgopt[true]{acronym} is specified, a %new glossary type called \texttt{acronym} will be defined as: %\begin{verbatim} %\newglossarytype[alg]{acronym}{acr}{acn} %\newcommand{\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. %You will also need to run the \filetype{acr} file through %\appname{makeindex} (or \appname{makeglos.pl}). For example: %\begin{verbatim} %makeindex -s mydoc.ist -t mydoc.alg -o mydoc.acn mydoc.acr %\end{verbatim} %alternatively: %\begin{verbatim} %makeglos.pl mydoc %\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. % %\changes{2.1}{2004 October 25}{name field can be omitted in %\texttt{'newacronym}} %The \gloskey{name} key is not used in \meta{glossary %entry}, as it is constructed from \meta{long} and %\meta{acronym}. By default this will be in the form: %\meta{long} (\meta{acronym}), however the format can be %overridden using the %command:\DescribeMacro{\setacronymnamefmt}\\[10pt] %\cmdname{setacronymnamefmt}\{\meta{format}\}\\[10pt] %Within \meta{format} the following commands may %be used to represent \meta{long} and \meta{acronym}: %\DescribeMacro{\glolong}\icmdname{glolong} and %\DescribeMacro{\gloshort}\icmdname{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: %\begin{verbatim} %\setacronymnamefmt{\gloshort} %\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), %the following commands are also available: % %\vspace{10pt} %\changes{2.11}{2004 October 25}{\texttt{'useacronym}} %\changes{2.18}{2005 July 5}{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}. %\cmdname{useacronym} also has a starred version equivalent to %\cmdname{}\meta{acr-name}\texttt{*}. %The optional argument \meta{insert} allows you to insert text %after \meta{long}, if this is the first occurrence of the %acronym, or after the acronym on subsequent occurrences. % %\vspace{10pt} %\changes{2.14}{2005 May 28}{'resetacronym added}\noindent %\cmdname{resetacronym}\verb'{'\meta{acr-name}\verb"}" %\DescribeMacro{\resetacronym}\\[10pt] %This command will cause the next use of \cmdname{}\meta{acr-name} %to produce the long version. To reset all acronyms %do \cmdname{resetallacronyms}.\DescribeMacro{\resetallacronyms} %\changes{2.21}{2005 July 27}{'resetallacronyms added} % %\vspace{10pt} %\changes{2.14}{2005 May 28}{'ifacronymfirstuse added}\noindent %\cmdname{ifacronymfirstuse}% %\verb'{'\meta{acr-name}% %\verb'}{'\meta{true text}\verb"}{"\meta{false text}\verb!}! %\DescribeMacro{\ifacronymfirstuse}\\[10pt] %This will test if the acronym has been used yet. If it has been %used, \meta{true text} will be implemented, otherwise %\meta{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:\\[10pt] %\changes{2.19}{2005 July 8}{'acrln added}% %\cmdname{acrln}\verb'{'\meta{acr-name}\verb/}/\DescribeMacro{\acrln}\\ %\cmdname{acrsh}\verb'{'\meta{acr-name}\verb/}/\DescribeMacro{\acrsh} %\changes{2.19}{2005 July 8}{'acrsh added}\\[10pt] %Or, alternatively:\\[10pt] %\cmdname{}\meta{acr-name}\texttt{long}\\ %\cmdname{}\meta{acr-name}\texttt{short}\\[10pt] %The first two commands (\cmdname{acrln} and \cmdname{acrsh}) %have a starred form that makes the first letter uppercase. %The other two commands, simply contain \meta{long} and %\meta{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 \pkgopt{hyper} package option. They are %provided for use in situations where the associated glossary %command may cause problems (e.g.\ in the table of contents entry.) % %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 \verb/\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.\ \verb/\SVM{}/) or use %\cmdname{\textvisiblespace} i.e.\ a backslash followed by %a space (e.g.\ \verb/\SVM\ /). Alternatively, as from %version 2.22, if you load the \stynamefmt{xspace} package %before loading the \stynamefmt{glossary} package, spaces will %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} % %\DescribeMacro{\acronymfont} %\changes{2.22}{2005 Sept 12}{Added 'acronymfont}% %If you want the acronym to appear in a particular font, %for example, small caps, you can redefine the command %\cmdname{acronymfont}. For example: %\begin{verbatim} %\renewcommand{\acronymfont}[1]{\textsc{#1}} %\end{verbatim} %The default definition of \cmdname{acronymfont} is: %\begin{verbatim} %\newcommand{\acronymfont}[1]{#1} %\end{verbatim} % %\subsection{Examples} % %\begin{verbatim} %\newacronym{SVM}{Support Vector Machine}{description=Statistical %pattern recognition technique} %\end{verbatim} %This will define the command \cmdname{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 \meta{cmd-name} since the %acronym contains a non-alphabetical character: %\begin{verbatim} %\newacronym[KSVM]{K-SVM}{Kernel Support Vector %Machine}{description=Statistical pattern recognition %technique using the ``kernel trick''} %\end{verbatim} %This will define the command \cmdname{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: %\begin{verbatim} %\ifacronymfirstuse{SVM}{a}{an} \SVM\ is \ldots %\end{verbatim} %If the acronym has not been used, the following text will %be produced:\\[10pt] %a Support Vector Machine is \ldots\\[10pt] %otherwise it will produce:\\[10pt] %an SVM is \ldots\\[10pt] %To expand the acronym a second time: %\begin{verbatim} %\chapter{An overview of the \protect\SVM} %\resetacronym{SVM} %The \SVM\ \ldots %\end{verbatim} %Note the use of \cmdname{protect} (see %note~\ref{itm:fragile} on page~\pageref{itm:fragile}.) In fact, in this situation %it would be better to do: %\begin{verbatim} %\chapter[An overview of the \SVMlong]{An overview of the \protect\SVM} %\resetacronym{SVM} %The \SVM\ \ldots %\end{verbatim} % %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: %\begin{verbatim} %\newacronym{SVM}{support vector machine}{description=Statistical %pattern recognition technique} %\end{verbatim} %however, if the command \cmdname{SVM} occurs at the start of the %sentence, you would clearly want the first letter as an %uppercase letter. This can be done using \cmdname{SVM*} instead %of \cmdname{SVM}. For example: %\begin{verbatim} %\SVM*\ techniques are widely used \ldots %\end{verbatim} %This will then come out as: Support vector machine (SVM) %techniques are widely used \ldots (Assuming this is the first %use of either \cmdname{SVM} or \cmdname{SVM*}.) % %Alternatively, \icmdname{useacronym}\verb'{SVM}' can be used instead of %\cmdname{SVM}. For example: %\begin{verbatim} %\useacronym*[s]{SVM} are widely used in the area of pattern %recognition. %\end{verbatim} %If this is the first use of the acronym SVM, it will produce the %following text:\\[10pt] %Support vector machines (SVM) are widely used in the area of %pattern recognition.\\[10pt] %If this is not the first use of this acronym, it will produce the %following text:\\[10pt] %SVMs are widely used in the area of pattern recognition. % %\section{Customizing the Glossary} %The \stynamefmt{glossary} package provides commands which can be redefined to customize the %glossary. The following name commands are defined by this package: %\begin{center}\DescribeMacro{\glossaryname}\DescribeMacro{\entryname}\DescribeMacro{\descriptionname}\relax %\begin{tabular}{ll} %\bfseries Command & \bfseries Default Value\\ %\cmdname{glossaryname} & Glossary\\ %\cmdname{shortglossaryname} & \cmdname{glossaryname}\\ %\cmdname{entryname} & Notation\\ %\cmdname{descriptionname} & Description %\end{tabular} %\end{center} %\changes{2.2}{2005 July 15}{'glossaryname now defined using 'providecommand instead of 'newcommand} % \changes{2.15}{2005 June 5}{'shortglossaryname} %\changes{2.16}{2005 June 8}{fixed bug preventing changes %to 'glossaryname and 'shortglossaryname} %\DescribeMacro{\shortglossaryname} %The command \cmdname{shortglossaryname} is used for the %page headers and table of contents entry. % \changes{1.1}{2004 August 14}{'glossarypreamble}% % \changes{1.1}{2004 August 14}{'glossarypostamble}% %Any text required before or after the glossary can be added %by redefining the commands \DescribeMacro{\glossarypreamble}\cmdname{glossarypreamble} %and \DescribeMacro{\glossarypostamble}\cmdname{glossarypostamble}. %For example. %\begin{verbatim} %\renewcommand{\glossarypreamble}{Page numbers in %italic indicate the main definition\par} %\end{verbatim} %By default, \cmdname{glossarypreamble} and \cmdname{glossarypostamble} do nothing. % %\changes{1.1}{2004 August 14}{\relax Increased User Flexibility}% %\changes{2.14}{2005 May 29}{'setglossary added} %\DescribeMacro{\setglossary} %The command \cmdname{setglossary}\verb'{'\meta{key-val list}\verb"}" %can be used to modify some of the glossary settings. The argument %\meta{key-val list} is a comma-separated list of %\meta{key}=\meta{value} pairs. Available keys are: %\begin{description} %\item[\setglos{type}] This is the glossary type. %If it is omitted, the standard glossary is assumed. % %\item[\setglos{glsnumformat}] %\changes{1.1}{2004 August 14}{\texttt{'glsnumformat}}% %This is the name of the command, %\emph{without} the preceding backslash\footnote{Note, you should %no longer try redefining the command \cmdname{glsnumformat}, as %this now takes an optional argument, allowing for different %glossary types}, to format the %entry numbers. For example, to make all the entry numbers italic, %do: %\begin{verbatim} %\setglossary{glsnumformat=textit} %\end{verbatim} %To suppress numbering altogether, you can do: %\begin{verbatim} %\setglossary{glsnumformat=ignore} %\end{verbatim} % %\item[\setglos{glodelim}] This %specifies what to do after the entry description and %before the page numbers. The default value is a comma, unless the \pkgopt[3]{cols} option is specified, %in which case it has the value \verb"&", or if %\pkgopt[altlist]{style}, %in which case it is simply a space\footnote{This %is because the \texttt{altlist} style is intended for use with long descriptions that will look better ending with a % full stop which the user can add if desired.}. If the package option \pkgopt[none]{number} is %specified, \setglos{glodelim} will have an empty value (unless %\pkgopt[3]{cols} is specified, %where, again, it will have the value \verb"&".) %This setting corresponds to the \istkey{delim\_0} key in the %\appname{makeindex} style file. % %\item[\setglos{delimN}] %\changes{1.1}{2004 August 14}{\texttt{'delimN}} %The delimiter to be inserted between two %page numbers for the same entry. (This corresponds to the %\istkey{delim\_n} key in the \appname{makeindex} style file.) %By default, this has the value %\texttt{,\textvisiblespace} (comma followed by a space). If the %package option \pkgopt[none]{number} is chosen, the value is set %to empty. % %\item[\setglos{delimR}] %\changes{1.1}{2004 August 14}{'delimR} %The delimiter to be inserted between the starting and ending page %number range for the same entry. (This corresponds to the %\istkey{delim\_r} key in the \appname{makeindex} style file.) %By default, this has the value \verb"--". If the %package option \pkgopt[none]{number} is chosen, the value is set %to empty. % %\end{description} %Note that: %\begin{verbatim} %\setglossary{glsnumformat=ignore} %\end{verbatim} %is equivalent to %\begin{verbatim} %\setglossary{glsnumformat=ignore,delimN={},delimR={}} %\end{verbatim} % %The number associated with each entry is, by default, the page number where % that entry was defined. If the package option %\pkgopt[section]{number} has been chosen, this % will be the section number instead. You can choose a different counter % by changing the value of the command \cmdname{theglossarynum}\DescribeMacro{\theglossarynum}. %For example, suppose you have the following code: %\begin{verbatim} %\begin{equation} %\Gamma(z) = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt %\end{equation} %\glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma} %\end{verbatim} %and you want the glossary to refer to the equation number, instead of the %page or section number, this can be done by redefining \cmdname{theglossarynum} %as follows: %\begin{verbatim} %\renewcommand{\theglossarynum}{\theequation} %\end{verbatim} %If the equation number depends on another counter (such as %\texttt{chapter}) %you will need to specify that the number is in the form \meta{NUM}.\meta{num} % (e.g.\ 3.24). This can be done by redefining the \cmdname{pagecompositor}\DescribeMacro{\pagecompositor}\ command: %\begin{verbatim} %\renewcommand{\pagecompositor}{.} %\end{verbatim} %(By default this value is \texttt{-}, unless the package option %\pkgopt[section]{number} has %been chosen, in which case this command has the value \texttt{.}\ %(full stop), as in the example above). %The \cmdname{pagecompositor} command must be %redefined before \icmdname{makeglossary} for it to have any effect. %If the package option \pkgopt[none]{number} is used, %the numbering will be suppressed, regardless %of the value of \icmdname{theglossarynum}. %This command corresponds to the \istkey{page\_compositor} key %in the \appname{makeindex} style file. % %The start and end of the main body of the glossary is given by the commands: %\cmdname{beforeglossary}\DescribeMacro{\beforeglossary}{} and %\cmdname{afterglossary}\DescribeMacro{\afterglossary}. %If the \pkgopt[list]{style} %or \pkgopt[altlist]{style} %package options are chosen these commands simply begin and end %the \envname{description} %environment, otherwise these commands begin and end the %\envname{longtable} or %\envname{supertabular} %environment with argument specified by %\cmdname{glossaryalignment}.\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}. % %The command \cmdname{gloitem}\DescribeMacro{\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 \gloskey{name} key %in the \icmdname{glossary} command. In the case of the %\pkgopt[list]{style} option, %\cmdname{gloitem}\verb"{"\meta{text}\verb'}' %will do\\[5pt] %\verb"\item["\meta{text}\verb']'\\[5pt] %or if \pkgopt[altlist]{style}:\\[5pt] %\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 %is defined as: %\begin{verbatim} %\bfseries\entryname & \bfseries \descriptionname\\ %\end{verbatim} %So, if you want the \icmdname{descriptionname} to be centred, you could do: %\begin{verbatim} %\renewcommand{\glossaryheader}{\bfseries\entryname & % \hfil\bfseries\descriptionname\\} %\end{verbatim} %The command \cmdname{glosstail}\DescribeMacro{\glosstail}\ indicates what to do at the end of %the \envname{longtable} or \envname{supertabular} environment. % %The width of the second column for the tabular-type styles is given by the length %\cmdname{descriptionwidth}\DescribeMacro{\descriptionwidth}. This value can be changed using %the \cmdname{setlength} command (the default value is \verb"0.6\textwidth"). % %\section{Sample Documents} %This package comes with the following sample documents: %\begin{itemize} %\item \texttt{sampleSec.tex} --- This document uses the options: %\pkgopt[altlist]{style}, \pkgopt{toc} and %\pkgopt[section]{number}. It also loads the %\stynamefmt{hyperref} package before loading the %\stynamefmt{glossary} package, so the glossary has hyperlinks %to the section numbers. Experimenting with different package %options, will illustrate the different glossary styles. %You will need to do: %\begin{verbatim} %pdflatex sampleSec %makeglos.pl sampleSec %pdflatex sampleSec %pdflatex sampleSec %\end{verbatim} %If you don't want to use \appname{makeglos.pl}, you will need %to do %\begin{verbatim} %makeindex -s sampleSec.ist -t sampleSec.glg -o sampleSec.gls sampleSec.glo %\end{verbatim} % %\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. %You will need to do: %\begin{verbatim} %latex sampleNtn %makeglos.pl sampleNtn %latex sampleNtn %latex sampleNtn %\end{verbatim} %If you don't want to use \appname{makeglos.pl}, you will need %to do %\begin{verbatim} %makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo %makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.ntn sampleNtn.not %\end{verbatim} % %\item \texttt{sampleNtn2.tex} ---This is similar to %\texttt{sampleNtn.tex}, but uses \icmdname{storeglosentry}. % %\item \texttt{sampleEq.tex} --- This has a glossary where the %numbers in the glossary refer to the equation number rather than %the page number. The \icmdname{pagecompositor}, %\icmdname{theglossarynum}, \icmdname{glossaryname} and %\icmdname{glossaryheader} are all redefined to customize the %glossary. You will need to do: %\begin{verbatim} %latex sampleEq %makeglos.pl sampleEq %latex sampleEq %\end{verbatim} %If you don't want to use \appname{makeglos.pl}, you will need %to do %\begin{verbatim} %makeindex -s sampleEq.ist -t sampleEq.glg -o sampleEq.gls sampleEq.glo %\end{verbatim} % %\item \texttt{sampleEqPg.tex} --- This is a modified version of %\texttt{sampleEq.tex}. This example has one glossary, where some %of the entry numbers refer to the corresponding page number, and %some of the entry numbers refer to the corresponding equation %number. You will need to do: %\begin{verbatim} %latex sampleEqPg %makeglos.pl sampleEqPg %latex sampleEqPg %\end{verbatim} %If you don't want to use \appname{makeglos.pl}, you will need %to do %\begin{verbatim} %makeindex -s sampleEqPg.ist -t sampleEqPg.glg -o sampleEqPg.gls sampleEqPg.glo %\end{verbatim} % %\item \texttt{sampleAcr.tex} --- This has a glossary containing %acronyms. It uses the style \pkgoptval{altlist}{style} as this is better %suited to glossaries with long names. It also uses the %\stynamefmt{hyperref} package, so the page numbers in the %glossary will automatically be hyperlinks, and the acronyms %within the text will have hyperlinks to their corresponding entry %in the glossary. You will need to do: %\begin{verbatim} %pdflatex sampleAcr %makeglos.pl sampleAcr %pdflatex sampleAcr %pdflatex sampleAcr %\end{verbatim} %If you don't want to use \appname{makeglos.pl}, you will need %to do %\begin{verbatim} %makeindex -s sampleAcr.ist -t sampleAcr.glg -o sampleAcr.gls sampleAcr.glo %\end{verbatim} % % %\item \texttt{sample.tex} --- This has a glossary entry %with two different definitions of the same name. %If you just use \appname{makeindex}, the two entries %will be treated separately, however, if you want them %concatenated, you can use \appname{makeglos.pl} with %the \texttt{-m} switch. You will need to do: %\begin{verbatim} %pdflatex sample %makeglos.pl -m sample %pdflatex sample %pdflatex sample %\end{verbatim} %(Depending on the configuration of your system, you %may have to do \texttt{perl makeglos.pl} instead of %just \appname{makeglos.pl}) % %If you don't want to use \appname{makeglos.pl}, you will need %to do %\begin{verbatim} %makeindex -s sample.ist -t sample.glg -o sample.gls sample.glo %\end{verbatim} %however, the entries with the same name but multiple descriptions %will not be merged. % %\end{itemize} % %\section{LaTeX2HTML Style File} %\label{sec:l2h} % %A \LaTeX2HTML\ Perl script, \texttt{glossary.}\filetype{perl}, is %provided with this package for those wishing to use the %glossary package with the \LaTeX2HTML translator. %The file \texttt{glossary.}\filetype{perl} should be extracted %along with \texttt{glossary.sty} when you run the %installation script (\texttt{glossary.ins}) through \LaTeX. % %\subsection{Limitations} % %\begin{itemize} %\item The only package options supported are: %\pkgopt[altlist]{style}, \pkgopt[true]{hyper}, \pkgopt[true]{toc}, %\pkgopt[true]{acronym} and \pkgopt[false]{acronym}. % %\item If you have more than one glossary type, the %secondary glossaries will occur in the same segment %as the primary glossary if you use the command %\verb'\print'\meta{name} instead of %\verb'\printglossary['\meta{name}\verb"]", where %\meta{name} is the name of the glossary type. % %\item The command \icmdname{setglossary} must be %placed in the preamble to have an effect. % %\item The \icmdname{storeglosentry} commands must be in %the document environment to have an effect. (They don't %seem to work in the preamble, I don't know why.) % %\item If you place a \icmdname{glossary} command %inside an environment not translated by \LaTeX2HTML %(for example, inside a mathematics environment), %it will not be entered into the glossary. % %\item The combinations \verb'""', \verb!"|!, \verb+"!+ %and \verb'"@' will be correctly translated, unless they %occur within a maths environment. This is because %the maths environment is translated before being %passed to \icmdname{glossary}. You can overcome this %by doing, e.g.:\\ %\cmdname{begin}\verb'{latexonly}'\\ %\verb'\glossary{name=$"|\mathcal{S}"|$,description=cardinality of set'\\ %\verb'$\mathcal{S}$,sort=cardinality}'\\ %\cmdname{end}\verb'{latexonly}'\\ %\cmdname{begin}\verb'{htmlonly}'\\ %\verb'\glossary{name=$|\mathcal{S}|$,description=cardinality of set'\\ %\verb'$\mathcal{S}$,sort=cardinality}'\\ %\cmdname{end}\verb'{htmlonly}' % %Alternative, you can use \cmdname{mid} instead: %\begin{verbatim} %\glossary{name=$\mid\mathcal{S}\mid$,description=cardinality of %set $\mathcal{S}$,sort=cardinality} %\end{verbatim} % %\item Glossary items with the same names but different %definitions will not be merged. % %\item The command \icmdname{theglossarynum} is ignored %by \LaTeX2HTML, as page numbers have no meaning within %HTML files. % %\item The configuration file \texttt{glossary.cfg} is ignored. % %\end{itemize} % % %\section{Troubleshooting} %\label{sec:trouble} %\begin{enumerate} %\item My glossary hasn't appeared. % %Check the following: %\begin{itemize} %\item Have you included the command \icmdname{makeglossary} %in the preamble? % %\item Have you put the command \icmdname{printglossary} where %you want the glossary to appear? % %\item Have you used \appname{makeglos.pl} or \appname{makeindex}, %and if you did, did it successfully create the \filetype{gls} %file? (Check the transcript \filetype{glg} file.) % %\begin{itemize} %\item If you used \appname{makeindex} directly, did you specify %the \filetype{ist} file created by \icmdname{makeglossary}, %and did you remember to specify the output file with the extension %\filetype{gls}? % %\item When \appname{makeindex} scans the \filetype{ist} file, %it should generate the message: %\begin{verbatim} %9 attributes redefined, 0 ignored %\end{verbatim} %If you have a number other than 0 ignored, then there is something %wrong with the \filetype{ist} file. Some packages can cause %problems with the creation of this file, see %item~\ref{itm:ngerman} below. %\end{itemize} % %\item Have you remembered to \LaTeX\ your document again %after using \appname{makeglos.pl} or \appname{makeindex}? % %\item Have you used \icmdname{glossary} or \icmdname{xglossary}? % %\item If you have used \icmdname{storeglosentry}, have you also %used \icmdname{useglosentry}, \icmdname{useGlosentry} or %\icmdname{gls}? %\end{itemize} % %If you have defined a new glossary type, have you checked %all the analogous commands to the above? % %\item My list of acronyms hasn't appeared. % %Have you used the \pkgopt[true]{acronym} package option? If no, %check the answers to the previous item, if yes, make sure %you have used \icmdname{makeacronym} and \icmdname{printacronym}. %Have you used any of the acronyms you have defined? Remember %that \cmdname{acrsh}, \cmdname{acrln}, %\cmdname{}\meta{acr-name}\texttt{short} and %\cmdname{}\meta{acr-name}\texttt{long} don't generate entries %in the list of acronyms, where \cmdname{}\meta{acr-name} is the %name of an acronym command. % %\item I get an error when using the command %\icmdname{saveglosentry}. % %Don't use this command it's obsolete, use %\icmdname{storeglosentry} instead. % %\item One of more of my glossary entries hasn't appeared. % %Check the following %\begin{itemize} %\item If you defined the entry using \icmdname{storeglosentry} %have you used either \icmdname{useglosentry}, %\icmdname{useGlosentry} or \icmdname{gls}? % %\item Have you remembered to \icmdname{protect} commands %such as \cmdname{mathcal} within \icmdname{storeglosentry}? % %\item Have you used the characters \texttt{@} \texttt{!} %\texttt{\textbar} \verb'"'? If so, have you preceded them %with a double quote character? %\end{itemize} % %Check the \appname{makeindex} log file to see if there are %any error messages. % %\item My glossary has duplicate entries on separate lines. % %\LaTeX\ treats multiple spaces equivalent to a single space, but \appname{makeindex} %takes spaces into account when determining whether two entries are identical. %For example: %\begin{verbatim*} %\glossary{name=Identity matrix, %description=diagonal matrix with 1's along the diagonal} %\end{verbatim*} %and %\begin{verbatim*} %\glossary{name=Identity matrix, %description=diagonal matrix with 1's along the diagonal} %\end{verbatim*} %will be treated as different entries by \appname{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 %\icmdname{storeglosentry} together with \icmdname{useglosentry}, %\icmdname{useGlosentry} or \icmdname{gls}. % %\item I had an error, fixed it, but I keep getting the same error message. % %Suppose you've made an error in the \icmdname{glossary} command. For example: %\begin{verbatim} %\glossary{name=Java,description=A programming language,format=texbf} %\end{verbatim} %In this case \texttt{textbf} has been mis-spelt. This error will be copied to the \filetype{glo} file, %which in turn will be copied to the \filetype{gls} file by %\appname{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 \filetype{gls} file. The best thing to do is to delete the %\filetype{gls} file, and try again. % %\item My glossary has ended up wider than my page. % %This may occur if you have long entry names, and you are using %either the \pkgopt[long]{style} or \pkgopt[super]{style} %options. The width of the description column is proportional to %the text width (in fact, it's \verb"0.6\textwidth") %but the first column is as wide as the widest entry name. You %can either redefine \icmdname{glossaryalignment} to change the %column specifications, or use one of the list-type styles. % %\item The page numbers in my glossary don't match up with the actual page numbers where the entry %was defined. % %You may need to \LaTeX\ your document again (just as you have to do with \cmdname{tableofcontents}, \cmdname{listoffigures} etc). % %\item I'm getting a \appname{keyval} error. % %The \stynamefmt{glossary} package uses the \stynamefmt{keyval} %package to extract the information from \meta{key}=\meta{value} %comma separated lists. You need to make sure the syntax is correct. If your \meta{value} contains a %comma, you will need to enclose \meta{value} in curly braces. See the \stynamefmt{keyval} documentation for %further information\footnote{This should be in the directory %\texttt{texmf/doc/latex/graphics/}}. % %\item I've used the \pkgopt{hyper} option, but nothing happens %when I click on the numbers in the glossary. % %Check the following: %\begin{enumerate} %\item Have you remembered to use PDF\LaTeX\ instead of \LaTeX, %or used a driver that understands hyperlinks? %\item Have you remembered to use the \stynamefmt{hyperref} or %\stynamefmt{html} package? %\item Have you remembered to use a formatting command which uses \cmdname{hyperlink}? (E.g.\ using \glsnumfmt{hyperbf} instead %of \texttt{textbf})? Remember to check the \gloskey{format} key %in your \icmdname{glossary} commands, and the %\setglos{glsnumformat} key in the \icmdname{setglossary} %command. %\item What application are you using to view the PDF file? %Ghostview can display a PDF file, but ignores the links. If you are using Windows, try %using Adobe's Acrobat Reader, or if you are using UNIX or Linux, try using \appname{xpdf} or \appname{acroread}. %\end{enumerate} % %\item The \stynamefmt{glossary} package conflicts with the %\stynamefmt{datetime} package. %\changes{2.01}{21 Oct 2004}{Fixed conflict with datetime package} % %This has been fixed in version 2.01. % %\item I get an error when using certain commands, such as \cmdname{cite} or \verb"~" in \icmdname{newacronym}. % %This has been fixed in version 2.1. % %\item I get the following error: %\begin{verbatim} %! Package array Error: Illegal pream-token (\glossaryalignment): `c' used. %\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. % %\item\label{itm:fragile} I get the following error: %\begin{verbatim} %Use of \@chapter doesn't match its definition %\end{verbatim} %or %\begin{verbatim} %! Argument of \@sect has an extra } %\end{verbatim} % %If you want to use an acronym command in a moving argument (such as a chapter heading) %you need to \cmdname{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. %\begin{verbatim} %\chapter[Introduction to Kernel Support Vector Machines]{Introduction %to \protect\KSVM} %\end{verbatim} %You will also need to do this if you are using bookmarks in a PDF document. % %Alternatively, you can do: %\begin{verbatim} %\resetacronym{KSVM} %\chapter{Introduction to \protect\KSVM} %\end{verbatim} %or if you are using PDFLaTeX: %\begin{verbatim} %\resetacronym{KSVM} %\chapter{Introduction to \texorpdfstring{\protect\KSVM}{KSVM}} %\end{verbatim} % %\item\label{itm:ngerman} The \stynamefmt{glossary} package conflicts with %\stynamefmt{ngerman}. % %This problem is caused by the fact that \stynamefmt{ngerman} %redefines the effect of the double quote %character, but this character is used in the creation of the %\filetype{ist} \appname{makeindex} style file. %Try one of the following methods: %\begin{enumerate} %\item Include the \stynamefmt{ngerman} package after the %\icmdname{makeglossary} command: %\begin{verbatim} %\usepackage{glossary} %\makeglossary %\usepackage{ngerman} %\end{verbatim} % %\item First omit the \stynamefmt{ngerman} package and include %\icmdname{makeglossary} then \LaTeX\ your document. %This will create the \filetype{ist} file. Then include the %\stynamefmt{ngerman} package, and insert \icmdname{noist} before %the \icmdname{makeglossary} command, this will prevent further attempts to generate the \filetype{ist} file. %\begin{verbatim} %\usepackage{ngerman} %\usepackage{glossary} %\noist\makeglossary %\end{verbatim} % %\item Use \icmdname{noist}, as above, and create the %\filetype{ist} file %in an ordinary text editor. The file should contain the %following lines: %\begin{verbatim} %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 " %\end{verbatim} %\end{enumerate} %It is possible that there may be other packages which will %also cause a problem, if so, try any of the above. % %\item \appname{makeglos.pl} gives the following error message: %\begin{verbatim} %unable to extract name from glossary item: %\end{verbatim} % %You are using an old version of \appname{makeglos.pl} with a %new version of the \stynamefmt{glossary} package. You will need %to update your version \appname{makeglos.pl}. %\end{enumerate} %Let me know if you encounter any other problems or if you have any comments regarding this package. % %\section{Obsolete Commands} % %The commands described in this section are now obsolete, but %are currently still provided for backwards compatibility. Their %use is deprecated. % %\changes{2.14}{2005 May 28}{'saveglosentry added} %\DescribeMacro{\saveglosentry} %\icmdname{saveglosentry}\{\textrm{\meta{name}}\}\{\meta{description}\}\\ %This command has now been replaced by \cmdname{storeglosentry}. % %\changes{2.0}{2004 November 1}{primary acronym number format %\texttt{'glsprimaryfmt}} %\changes{2.12}{2004 November 1}{primary acronym number format %\texttt{'glsprimaryfmt} no longer used} %\DescribeMacro{\glsprimaryfmt}% %The command \cmdname{glsprimaryfmt} is no longer used in \icmdname{newacronym} as you can end up with duplicate %page numbers, however the command is currently still defined (although it % may be removed in future versions.) % %The package option \pkgopt{hyperacronym} is now superseded by the package option %\pkgopt{hyper}. This option was implemented prior to the %introduction of the command \icmdname{xglossary}. Since the %acronyms now use \icmdname{xglossary}, there is no difference %between the \pkgopt{hyperacronym} and \pkgopt{hyper} options. %This option has a boolean value: %\changes{2.13}{2004 December 1}{Package option \texttt{hyperacronym}} %\begin{description} %\item[\pkgoptval{true}{hyperacronym}] Make acronyms link to their corresponding entry in the glossary %\item[\pkgoptval{false}{hyperacronym}] Acronyms don't have a hyperlink. %\end{description} %If the \stynamefmt{hyperref} package has been loaded prior to %loading \texttt{glossary.sty} or if \pkgopt[true]{hyper} is set, %\pkgopt[true]{hyperacronym} otherwise %\pkgopt[false]{hyperacronym}.% % %\section{Contact Details} %\noindent %Dr Nicola Talbot\\ %School of Computing Sciences\\ %University of East Anglia\\ %Norwich. Norfolk\\ %NR4 7TJ. United Kingdom.\\ %\url{http://theoval.cmp.uea.ac.uk/~nlct/} % %\section{Acknowledgements} % %I would like to thank the following people for their %suggestions: %Jens~Happe, %Dmitry~Katsubo, %Markus~Lazanowski, %Slava~Pestov and %Dario~Teixeira % % \StopEventually{\PrintChanges\addcontentsline{toc}{section}{Change History}\PrintIndex\addcontentsline{toc}{section}{Index}} % % % % %\section{The Code} % \begin{macrocode} %<*glossary.sty> % \end{macrocode} % \subsection{Package Definition} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{glossary}[2005/09/27 2.24 (NLCT)] % \end{macrocode} % Load packages needed by glossary.sty: % \begin{macrocode} \RequirePackage{ifthen} \RequirePackage{keyval} % \end{macrocode} % The package options are in the form of a comma-separated list of % \meta{key}=\meta{value} pairs. First need to set up the keys. % \begin{macrocode} \define@key{gloss} {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}}} \define@key{gloss} {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{gloss} {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}}} \newcount\gls@cols \define@key{gloss}{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}} {}} \define@key{gloss} {number} {\ifthenelse{\equal{#1}{none}\or\equal{#1}{page}\or\equal{#1}{section}} {\def\gls@number{#1}} {\PackageError{glossary} {Unknown glossary number style '#1'} {Available styles are: none, page and section}}} \newif\ifgls@toc \define@key{gloss}{toc}[true]{\ifthenelse{\equal{#1}{true} \or \equal{#1}{false}} {\csname gls@toc#1\endcsname} {\PackageError{glossary}{Glossary option 'toc' is boolean} {The value of 'toc' can only be set to 'true' or 'false'}}} \newif\ifgls@hypertoc \define@key{gloss}{hypertoc}[true]{\ifthenelse{\equal{#1}{true} \or \equal{#1}{false}} {\csname gls@hypertoc#1\endcsname} {\PackageError{glossary}{Glossary option 'hypertoc' is boolean} {The value of 'hypertoc' can only be set to 'true' or 'false'}}} \newif\ifgls@section \define@key{gloss}{section}[true]{\ifthenelse{\equal{#1}{true} \or \equal{#1}{false}} {\csname gls@section#1\endcsname} {\PackageError{glossary}{Glossary option 'section' is boolean} {The value of 'section' can only be set to 'true' or 'false'}}} \gls@sectionfalse \newif\ifglshyper \newif\ifglshyperacronym \define@key{gloss}{hyper}[true]{\ifthenelse{\equal{#1}{true} \or \equal{#1}{false}} {\csname glshyper#1\endcsname\glshyperacronymtrue} {\PackageError{glossary}{Glossary option 'hyper' is boolean} {The value of 'hyper' can only be set to 'true' or 'false'}}} \define@key{gloss}{hyperacronym}[true]{\ifthenelse{\equal{#1}{true} \or \equal{#1}{false}} {\csname glshyperacronym#1\endcsname} {\PackageError{glossary}{Glossary option 'hyperacronym' is boolean} {The value of 'hyperacronym' can only be set to 'true' or 'false'}}} \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'}}} % \end{macrocode} % Set up defaults % \begin{macrocode} \def\gls@style{long} \def\gls@header{none} \def\gls@border{none} \def\gls@number{page} \gls@cols=2\relax \gls@tocfalse \@ifundefined{hyperpage}{\glshyperfalse\glshyperacronymfalse}{\glshypertrue\glshyperacronymtrue} \@ifundefined{hypertarget}{ % no hyperlinks \newcommand{\glosslabel}[2]{#2}% \newcommand{\glossref}[2]{#2}% }{% \newcommand{\glosslabel}[2]{\hypertarget{#1}{#2}}% \newcommand{\glossref}[2]{\hyperlink{#1}{#2}} } % \end{macrocode} % If the xspace package has been loaded, use \verb/\xspace/ % in acronyms. % \begin{macrocode} \@ifundefined{xspace}{% \let\glsxspace\relax}{% \let\glsxspace\xspace} % \end{macrocode} % Temporarily disable xspace: % \begin{macrocode} \newcommand{\gls@noxspace}[1]{{\let\glsxspace\relax#1}} % \end{macrocode} % Load configuation file if it exists % \begin{macrocode} \newcommand{\glossarypackageoptions}[1]{\setkeys{gloss}{#1}} \InputIfFileExists{glossary.cfg}{% \typeout{Glossary configuration file loaded}}{% \typeout{No configuration file glossary.cfg found}} \renewcommand{\glossarypackageoptions}[1]{% \PackageError{glossary}{Command \string\glossarypackageoptions ^^Jcan only be used in configuration file}{}} % \end{macrocode} % Process options % \begin{macrocode} \DeclareOption*{\edef\@pkg@ptions{\noexpand\setkeys{gloss}{\CurrentOption}} \ifthenelse{\equal{\CurrentOption}{}}{}{\@pkg@ptions}} \ProcessOptions % \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} {The 'list' and 'altlist' options don't have a header, border or number of columns option.}} {} % \end{macrocode} % Can't have both toc and hypertoc. Make it a warning rather % than an error. % \begin{macrocode} \ifthenelse{\boolean{gls@hypertoc} \and \boolean{gls@toc}}{% \PackageWarning{glossary}{Can't have both 'toc' and 'hypertoc', ignoring 'toc' option} \ifgls@hypertoc\gls@tocfalse\fi}{} % \end{macrocode} %\subsection{Redefining \texttt{\symbol{92}glossary} format} % The glossary is going to be redefined so that it accepts \meta{key}=\meta{value} % information, so need to define the keys (see keyval documentation for further details % on how to do this) % \begin{macrocode} \define@key{wrgloss}{name}{\gdef\@glo@n@me{#1}} \define@key{wrgloss}{description}{\def\@descr{#1}} \define@key{wrgloss}{sort}{\gdef\@s@rt{#1}} \define@key{wrgloss}{format}{\def\@f@rm@t{#1}} % \end{macrocode} % Redefine "\@wrglossary" so that it separates out the entry name and % entry description. Substitute "\thepage" for "\theglossarynum" which % the user can redefine to be "\theequation" etc, % \begin{macrocode} \newcommand{\@@wrglossary}{} \newcommand{\@glo@l@bel}{} \renewcommand{\@wrglossary}[1]{\relax \gdef\@glo@n@me{}\def\@descr{}\def\@s@rt{}\def\@f@rm@t{}\relax \setkeys{wrgloss}{#1}\relax \ifthenelse{\equal{\@s@rt}{}}{\gdef\@s@rt{\@glo@n@me}}{}% \ifthenelse{\equal{\@glo@l@bel}{}}{\gdef\@glo@l@bel{GGG:\@s@rt}}{}% \ifthenelse{\equal{\@f@rm@t}{}} {\protected@write\@glossaryfile{}% {\string\glossaryentry{\@s@rt @{% \string\glosslabel{\@glo@l@bel}{\@glo@n@me}}\@descr \string\relax|glsnumformat}{\theglossarynum}}} {\protected@write\@glossaryfile{}% {\string\glossaryentry{\@s@rt @{% \string\glosslabel{\@glo@l@bel}{\@glo@n@me}}\@descr \string\relax|\@f@rm@t}{\theglossarynum}}}\relax \endgroup\@esphack \@@wrglossary } % \end{macrocode} % Command to extract name key from glossary entry. % \begin{macrocode} \newcommand{\@gls@getn@me}[1]{\@bsphack\begingroup\@sanitize \gdef\@glo@n@me{}\setkeys{wrgloss}{#1}\relax \endgroup\@esphack} % \end{macrocode} % Now do macro so you can have a hyperlink that takes % you to the entry in the glossary % \begin{macrocode} \newcommand{\xglossary}{\renewcommand{\@@wrglossary}[1]{% \glossref{\@glo@l@bel}{##1}\renewcommand{\@@wrglossary}{}}% \glossary} % \end{macrocode} % Save a bit of typing. The followig command is new to v2.17 % \begin{macrocode} \newcommand*{\storeglosentry}[3][glossary]{% \@ifundefined{glo@#2@entry}{% \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'}}% } \providecommand{\useglosentry}[2][\relax]{% \@ifundefined{glo@#2@type}{% \PackageError{glossary}{Glossary entry '#2' undefined}{You need to define the entry using \string\storeglosentry\space before 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}}% \else \protected@edef\@glo@cmd{\expandafter\noexpand\csname \@glostype{\csname glo@#2@entry\endcsname,#1}}% \fi \@glo@cmd }} \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.}}{% \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}}% \else \protected@edef\@glo@cmd{\expandafter\noexpand\csname \@glostype\endcsname{\csname glo@#2@entry\endcsname,#1}}% \fi \@glo@cmd{#3}% }} \newcommand{\gls}[2][\relax]{\useGlosentry[#1]{#2}{\csname glo@#2@name\endcsname}} % \end{macrocode} % This command was defined in earlier verions, but doesn't % work very well, currently retained for backwards compatibility, % but may well be removed at a later date. % \begin{macrocode} \providecommand{\saveglosentry}[3][glossary]{% \expandafter\def\csname glo@#2@type\endcsname{#1}% \expandafter\def\csname glo@#2@entry\endcsname{name={#2},description={#3}} } % \end{macrocode} %Set up default number formats, dependent on the package "number" option. %Define default page compositor. Any redefinition of the page compositor %will need to come before the ".ist" file is written. The other commands %can be redefined at any point before "\printglossary" % \begin{macrocode} \ifthenelse{\equal{\gls@number}{page}}{ \newcommand{\theglossarynum}{\thepage} \newcommand{\pagecompositor}{-} \newcommand{\@glossary@delimN}{, } \newcommand{\@glossary@delimR}{--} \ifglshyper \newcommand{\glsXglossaryXnumformat}[1]{\hyperrm{#1}}% \else \newcommand{\glsXglossaryXnumformat}[1]{#1}\fi} {\ifthenelse{\equal{\gls@number}{section}} {\newcommand{\theglossarynum}{\thesection} \newcommand{\pagecompositor}{.} \newcommand{\@glossary@delimN}{, } \newcommand{\@glossary@delimR}{--} \ifglshyper \newcommand{\glsXglossaryXnumformat}[1]{\hyperrm{#1}}% \else \newcommand{\glsXglossaryXnumformat}[1]{#1}% \fi} {\newcommand{\theglossarynum}{\thepage} \newcommand{\pagecompositor}{-} \newcommand{\@glossary@delimN}{} \newcommand{\@glossary@delimR}{} \newcommand{\glsXglossaryXnumformat}[1]{}}} \newcommand{\glsnumformat}[2][glossary]{% \@ifundefined{glsX#1Xnumformat}{% \PackageError{glossary}{Glossary type '#1' undefined}{}}{% \csname glsX#1Xnumformat\endcsname{#2}}} \def\@glostype{glossary} \newcommand{\delimN}{\csname @\@glostype @delimN\endcsname} \newcommand{\delimR}{\csname @\@glostype @delimR\endcsname} \newcommand{\glodelim}{\csname @\@glostype @glodelim\endcsname} % \end{macrocode} % Allow user to change number format for different % glossary types. % \begin{macrocode} \define@key{glossnum}{glsnumformat}{\def\@glsnumformat{#1}} \define@key{glossnum}{type}{\def\@glsnumtype{#1}} \define@key{glossnum}{delimN}{\def\@delimN{#1}} \define@key{glossnum}{delimR}{\def\@delimR{#1}} \define@key{glossnum}{glodelim}{\def\@glodelim{#1}} \providecommand{\ignore}[1]{} \newcommand{\setglossary}[1]{% \def\@glsnumformat{}% \def\@glsnumtype{glossary}% \def\@delimN{@dontchange@}% \def\@delimR{@dontchange@}% \def\@glodelim{@dontchange@}% \setkeys{glossnum}{#1}\relax \@ifundefined{print\@glsnumtype}{% \PackageError{glossary}{Invalid glossary type '\@glsnumtype'}{% Glossary type '\@glsnumtype' has not been defined} }{% \ifthenelse{\equal{\@glsnumformat}{}}{}{% \expandafter\xdef\csname glsX\@glsnumtype Xnumformat\endcsname{% \noexpand\csname\@glsnumformat\noexpand\endcsname}% \ifthenelse{\equal{\@glsnumformat}{ignore}}{% \expandafter\xdef\csname @\@glsnumtype @delimN\endcsname{}% \expandafter\xdef\csname @\@glsnumtype @delimR\endcsname{}% }{}% }% \ifthenelse{\equal{\@delimN}{@dontchange@}}{}{% \expandafter\xdef\csname @\@glsnumtype @delimN\endcsname{% \@delimN}} \ifthenelse{\equal{\@delimR}{@dontchange@}}{}{% \expandafter\xdef\csname @\@glsnumtype @delimR\endcsname{% \@delimR}} \ifthenelse{\equal{\@glodelim}{@dontchange@}}{}{% \expandafter\xdef\csname @\@glsnumtype @glodelim\endcsname{% \@glodelim} } }} % \end{macrocode} % Now define the command "\printglossary" which will print the contents of the glossary file. % \begin{macrocode} \newcommand{\@gls@glossary@inext}{gls} \newcommand\printglossary[1][glossary]{% \def\@glostype{#1}% \@ifundefined{#1name}{% \renewcommand{\@glossaryname}{\glossaryname}}{% \renewcommand{\@glossaryname}{\csname #1name\endcsname}}% \@ifundefined{short#1name}{% \renewcommand{\@shortglossaryname}{\@glossaryname}}{% \renewcommand{\@shortglossaryname}{\csname short#1name\endcsname}}% \@input@{\jobname.\csname @gls@#1@inext\endcsname}} % \end{macrocode} % Define contextual names. Changed \verb/\newcommand/ % to \verb/\providecommand/ in version 2.2. % \begin{macrocode} \providecommand{\glossaryname}{Glossary} \newcommand{\shortglossaryname}{\glossaryname} \newcommand{\entryname}{Notation} \newcommand{\descriptionname}{Description} \newcommand{\istfilename}{\jobname.ist} \def\@glossaryname{\glossaryname} \def\@shortglossaryname{\shortglossaryname} % \end{macrocode} % Define command to generate glossary title (new to % 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}} \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} } % \end{macrocode} % Provide a means to add text to the beginning or end % of the glossary. % \begin{macrocode} \newcommand{\glossarypreamble}{} \newcommand{\glossarypostamble}{} % \end{macrocode} % By default, add the short title to the table of contents. % \begin{macrocode} \newcommand{\@glosaddtoc}[1]{% \addcontentsline{toc}{#1}{\@shortglossaryname} } % \end{macrocode} % Set up switch to determine whether the item is the first item in the % glossary (in the event that a special case is needed for the first item) % \begin{macrocode} \newif\ifgloitemfirst \newcommand{\@bef@reglos}{\global\gloitemfirsttrue\beforeglossary} \newcommand{\@ftergl@s}{\afterglossary\global\gloitemfirstfalse} % \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. % \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}{ }} }{ % \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. %Nick van Foreest recommended the "supertabular" environment. The % "longtable" environment also works, so have both options, and leave it to % the user. % \begin{macrocode} \ifthenelse{\equal{\gls@style}{super}}{ \IfFileExists{supertab.sty}{\RequirePackage{supertab}} {\IfFileExists{supertabular.sty}{\RequirePackage{supertabular}} {\PackageError{glossary}{Option "super" chosen, but can't find "supertab" package} {If you want the "super" option, you have to have the "supertab" package installed.}}} } {\RequirePackage{longtable}} \newlength{\descriptionwidth} \setlength{\descriptionwidth}{0.6\textwidth} \ifthenelse{\equal{\gls@header}{none}} { \ifthenelse{\equal{\gls@border}{none}} {\newcommand{\glossaryheader}{}} {\newcommand{\glossaryheader}{\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}} \else \ifthenelse{\equal{\gls@border}{none}} {\newcommand{\glossaryheader} {\bfseries\entryname & \bfseries \descriptionname & \\}} {\newcommand{\glossaryheader} {\hline\bfseries\entryname &\bfseries\descriptionname & \\\hline\hline}} \fi } \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}}} \else \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l}}{ \newcolumntype{G}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l}} \fi \ifthenelse{\equal{\gls@style}{super}}{ \newcommand{\afterglossary}{ \\\end{supertabular}} } { \newcommand{\afterglossary}{ \\\end{longtable}} } \newcommand{\glosstail}{} } { \ifnum\gls@cols=2\relax \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}}{ \newcolumntype{G}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}} \else \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l|}}{ \newcolumntype{G}{|@{\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}}} } { \@ifundefined{newcolumntype}{\newcommand{\beforeglossary} {\begin{longtable}{\glossaryalignment} \glossaryheader\endhead\glosstail\endfoot}} {\newcommand{\beforeglossary} {\begin{longtable}{G} \glossaryheader\endhead\glosstail\endfoot}} } \ifnum\gls@cols=2\relax \newcommand{\gloskip}{\ifgloitemfirst\global\gloitemfirstfalse \else\\ \fi &} \newcommand{\@glossary@glodelim}{, } \else \newcommand{\gloskip}{\ifgloitemfirst\global\gloitemfirstfalse \else\\ \fi & &} \newcommand{\@glossary@glodelim}{& } \fi \newcommand{\gloitem}[1]{\ifgloitemfirst\global\gloitemfirstfalse #1 \else \\#1 \fi &} } \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. % \begin{macrocode} \newif\ifist \let\noist=\istfalse \if@filesw\isttrue\else\istfalse\fi \newwrite\istfile \catcode`\%11\relax \newcommand{\writeist}{ \openout\istfile=\istfilename \write\istfile{% makeindex style file created by LaTeX for document "\jobname" on \the\year-\the\month-\the\day} \write\istfile{keyword "\string\\glossaryentry"} \write\istfile{preamble "\string\\begin{theglossary}"} \write\istfile{postamble "\string\n\string\\end{theglossary}\string\n"} \write\istfile{group_skip "\string\\gloskip "} \write\istfile{item_0 "\string\n\string\\gloitem "} \write\istfile{delim_0 "\string\n\string\\glodelim "} \write\istfile{page_compositor "\pagecompositor"} \write\istfile{delim_n "\string\\delimN "} \write\istfile{delim_r "\string\\delimR "} \closeout\istfile } \catcode`\%14\relax % \end{macrocode} %Redefine "\makeglossary" so that it creates the ".ist" file. Once it is % created, the "\ifist" flag is set to false to prevent repeated creation of % the file in the event that another glossary-style type is created. If a % different ".ist" file is desired for each glossary type, you will need % to precede each "\make"\meta{type} with "\isttrue" and changed the definition % of "\istfilename". (This is unlikely to occur unless more than one type % of page compositor is required.) % The "\glossary" command has been modified to allow for % an optional argument to modify the label. % \begin{macrocode} \renewcommand{\makeglossary}{ \newwrite\@glossaryfile \immediate\openout\@glossaryfile=\jobname.glo \renewcommand{\glossary}[1][]{\gdef\@glo@l@bel{##1}% \@bsphack \begingroup \@sanitize \@wrglossary } \typeout {Writing glossary file \jobname .glo } \let \makeglossary \@empty \ifist\writeist\fi \noist} \renewcommand{\glossary}[1][]{% \@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"). % \begin{macrocode} \newcommand{\@newglossarytype}[4][glg]{} \newcommand{\newglossarytype}[4][glg]{ \@ifundefined{#2}{% \protected@write\@auxout{}{\@newglossarytype[#1]{#2}{#3}{#4}}% \def\@glstype{#2}\def\@glsout{#3}\def\@glsin{#4}% \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{% \noexpand\@m@kegl@ss{\@glstype}{\@glsout}} \expandafter\edef\csname \@glstype\endcsname{% \noexpand\@gl@ss@ary{\@glstype}} \expandafter\edef\csname x\@glstype\endcsname{% \noexpand\@Gl@ss@ary{\@glstype}} \expandafter\edef\csname print\@glstype\endcsname{% \noexpand\def\noexpand\@glostype{\@glstype}% \noexpand\@ifundefined{\@glstype name}{% \noexpand\def\noexpand\@glossaryname{\noexpand\glossaryname}% }{% \noexpand\def\noexpand\@glossaryname{% \noexpand\csname\@glstype name\noexpand\endcsname}}% % \noexpand\@ifundefined{short\@glstype name}{% \noexpand\def\noexpand\@shortglossaryname{\noexpand\@glossaryname}% }{% \noexpand\edef\noexpand\@shortglossaryname{% \noexpand\csname short\@glstype name\noexpand\endcsname}}% \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}} } % \end{macrocode} % Define equivalent of "\makeglossary": % \begin{macrocode} \newcommand\@m@kegl@ss[2]{ \expandafter\newwrite\csname @#1file\endcsname \expandafter\immediate\expandafter \openout\csname @#1file\endcsname=\jobname.#2 \typeout {Writing #1 file \jobname .#2 } \expandafter\let \csname make#1\endcsname \@empty \ifist\writeist\fi \expandafter\def\csname the#1num\endcsname{\thepage} \noist } % \end{macrocode} % Define equivalent of "\@wrglossary": % \begin{macrocode} \newcommand{\@wrgl@ss@ry}[2]{\relax \gdef\@glo@n@me{}\def\@descr{}\def\@s@rt{}\def\@f@rm@t{}\relax \xdef\@pr@fix{\csname @gls@#1@type\endcsname}% \ifthenelse{\equal{\@s@rt}{}}{\gdef\@s@rt{\@glo@n@me}}{}% \ifthenelse{\equal{\@glo@l@bel}{}}{\gdef\@glo@l@bel{\@pr@fix:\@s@rt}}{}% \setkeys{wrgloss}{#2}\relax \ifthenelse{\equal{\@f@rm@t}{}} {\expandafter\protected@write\csname @#1file\endcsname{}{% \string\glossaryentry{\@s@rt @{% \string\glosslabel{\@glo@l@bel}{\@glo@n@me}}% \@descr\string\relax|glsnumformat[#1]}{\csname the#1num\endcsname}}} {\expandafter\protected@write\csname @#1file\endcsname{}{% \string\glossaryentry{\@s@rt @{% \string\glosslabel{\@glo@l@bel}{\@glo@n@me}}% \@descr\string\relax|\@f@rm@t}{\csname the#1num\endcsname}}}\relax \endgroup\@esphack \@@wrgl@ss@ry } \newcommand{\@@wrgl@ss@ry}{} % \end{macrocode} % Define the equivalent of "\glossary". % \begin{macrocode} \newcommand\@gl@ss@ary[2][]{\@ifundefined{@#2file}{% \@bsphack\begingroup \@sanitize \@index}{% \gdef\@glo@l@bel{#1}% \@bsphack \begingroup \@sanitize \@wrgl@ss@ry{#2}}} % \end{macrocode} % Define the equivalent of "\xglossary". % \begin{macrocode} \newcommand{\@Gl@ss@ary}{% \renewcommand{\@@wrgl@ss@ry}[1]{% \glossref{\@glo@l@bel}{##1}\renewcommand{\@@wrgl@ss@ry}{}}% \@gl@ss@ary} % \end{macrocode} % Define equivalent of "\printglossary". % \begin{macrocode} \newcommand\@prntgl@ss@ry[1]{\@input@{\jobname.#1}} % \end{macrocode} % The command "\newglossarytype" should only be used in the preamble. % \begin{macrocode} \@onlypreamble{\newglossarytype} % \end{macrocode} % Define "\newacronym"[\meta{cmd-name}]\{\meta{abbrv}\}\{\meta{long name}\}\{\meta{glos entry}\} % \begin{macrocode} \newcommand\@acrnmsh{} \newcommand\@sacrnmsh{} \newcommand\@acrnmln{} \newcommand\@acrnmcmd{} \newcommand\@acrnmgls{} \newcommand\@acrnmins{} % \end{macrocode} % List of all defined acronyms. % \begin{macrocode} \toksdef\@glo@tb=2 \newcommand{\@acr@list}{} % \end{macrocode} % append acronym to list % \begin{macrocode} \newcommand{\@acr@addtolist}[1]{\edef\@glo@ta{#1}% \ifthenelse{\equal{\@acr@list}{}}{% \edef\@acr@list{\@glo@ta}}{% \@glo@tb=\expandafter{\@acr@list}% \edef\@acr@list{\the\@glo@tb,\@glo@ta}}} % \end{macrocode} % This should no longer be used % \begin{macrocode} \newcommand{\glsprimaryfmt}[1]{\textbf{\glsnumformat{#1}}} % \end{macrocode} % \begin{macrocode} %\newcommand{\acronymlabprefix}{GGG} \newcommand{\@acronymnamefmt}{\glolong\ (\gloshort)} \newcommand{\setacronymnamefmt}[1]{\def\@acronymnamefmt{#1}} % \end{macrocode} % Format the acronym abbreviation in the format specified % by \verb'\acronymfont'. This simply prints its % argument by default. % \begin{macrocode} \newcommand{\acronymfont}[1]{#1} % \end{macrocode} % This command has been restructured as from v2.17 % \begin{macrocode} \newcommand{\newacronym}[4][]{% \ifthenelse{\equal{#1}{}}{\renewcommand\@acrnmcmd{#2}}{\renewcommand\@acrnmcmd{#1}} \@ifundefined{\@acrnmcmd}{% \expandafter\newcommand\csname\@acrnmcmd short\endcsname{#2\protect\glsxspace} \expandafter\newcommand\csname\@acrnmcmd long\endcsname{#3\protect\glsxspace} \def\@acrn@entry{#4} { \def\glolong{#3}% \def\gloshort{\noexpand\acronymfont{#2}}% \expandafter\protected@xdef\expandafter\@acrnamefmt{\@acronymnamefmt} } \@acr@addtolist{\@acrnmcmd} \protected@edef\@acr@glsentry{name=\@acrnamefmt,format=glsnumformat,sort=\@acrnmcmd,\@acrn@entry} \newboolean{\@acrnmcmd first}\setboolean{\@acrnmcmd first}{true} \expandafter\protected@edef\csname \@acrnmcmd\endcsname{\noexpand\@ifstar{\csname @s@\@acrnmcmd\endcsname}{\csname @\@acrnmcmd\endcsname}} \ifglshyperacronym % unstarred version \expandafter\protected@edef\csname @\@acrnmcmd\endcsname{% \noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{% \noexpand\gls@noxspace{\csname\@acrnmcmd long\endcsname\noexpand\@acrnmins\ (\noexpand\xacronym{\@acr@glsentry}{% \noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% })}\noexpand\setboolean{\@acrnmcmd first}{false}% }{\noexpand\xacronym{\@acr@glsentry}{% \noexpand\acronymfont{\csname\@acrnmcmd 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\xacronym{\@acr@glsentry}{% \noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% })}% \noexpand\setboolean{\@acrnmcmd first}{false}}{% \noexpand\xacronym{\@acr@glsentry}{% \noexpand\acronymfont{\noexpand\expandafter\noexpand\MakeUppercase \csname\@acrnmcmd short\endcsname}% \noexpand\@acrnmins}}\noexpand\glsxspace} \else % unstarred version \expandafter\protected@edef\csname @\@acrnmcmd\endcsname{% \noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{% \noexpand\gls@noxspace{\csname\@acrnmcmd long\endcsname\ (\noexpand\acronym{\@acr@glsentry}{% \noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% })}\noexpand\setboolean{\@acrnmcmd first}{false}% }{\noexpand\acronym{\@acr@glsentry}{% \noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}}}% \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\acronym{\@acr@glsentry}{% \noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% })}% \noexpand\setboolean{\@acrnmcmd first}{false}}{% \noexpand\acronym{\@acr@glsentry}{% \noexpand\acronymfont{\noexpand\expandafter\noexpand\MakeUppercase \csname\@acrnmcmd short\endcsname}% \noexpand\@acrnmins}}\noexpand\glsxspace} \fi }{% \PackageError{glossary}{Command '\expandafter\string\csname\@acrnmcmd\endcsname' already defined}{ The command name specified by \string\newacronym already exists.}}} \newcommand{\useacronym}{\@ifstar\@suseacronym\@useacronym} \newcommand{\@suseacronym}[2][]{{\let\glsxspace\relax \def\@acrnmins{#1}\csname @s@#2\endcsname}% \setboolean{#2first}{false}} \newcommand{\@useacronym}[2][]{{\let\glsxspace\relax \def\@acrnmins{#1}\csname @#2\endcsname}% \setboolean{#2first}{false}} \newcommand{\acrln}{\@ifstar\@sacrln\@acrln} \newcommand{\@acrln}[1]{\@ifundefined{#1long}{% \PackageError{glossary}{Acronym '#1' has not been defined}{}}{% \gls@noxspace{\csname#1long\endcsname}}} \newcommand{\@sacrln}[1]{\@ifundefined{#1long}{% \PackageError{glossary}{Acronym '#1' has not been defined}{}}{% \gls@noxspace{\expandafter\expandafter\expandafter \MakeUppercase\csname#1long\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}}}} \newcommand{\@sacrsh}[1]{\@ifundefined{#1short}{% \PackageError{glossary}{Acronym '#1' has not been defined}{}}{% \acronymfont{\gls@noxspace{\expandafter\expandafter\expandafter\MakeUppercase\csname#1short\endcsname}}}} \newcommand{\ifacronymfirstuse}[3]{% \@ifundefined{if#1first}{% \PackageError{glossary}{Acronym '#1' not defined}{}}{% \ifthenelse{\boolean{#1first}}{#2}{#3}}} \newcommand{\resetacronym}[1]{% \@ifundefined{if#1first}{% \PackageError{glossary}{Acronym '#1' not defined}{}}{% \setboolean{#1first}{true}}} \newcommand{\resetallacronyms}{% \@for\@acr:=\@acr@list\do{\resetacronym{\@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 % \begin{macrocode} \ifglshyper % this is modified from definition of "\hyperpage" in "hyperref.sty" \def\glshyperpage#1{\@glshyperpage#1\delimR \delimR \\} \def\@glshyperpage#1\delimR #2\delimR #3\\{% \ifx\\#2\\% \@delimNhyperpage{#1}% \else \@ifundefined{hyperlink}{#1\delimR #2}{\hyperlink{page.#1}{#1}\delimR \hyperlink{page.#2}{#2}}% \fi } \def\@delimNhyperpage#1{\@@delimNhyperpage#1\delimN \delimN\\} \def\@@delimNhyperpage#1\delimN #2\delimN #3\\{% \ifx\\#2\\% \@ifundefined{hyperlink}{#1}{\hyperlink{page.#1}{#1}}% \else \@ifundefined{hyperlink}{#1\delimN #2}{\hyperlink{page.#1}{#1}\delimN \hyperlink{page.#2}{#2}}% \fi } \def\glshypersection#1{\@glshypersection#1\delimR \delimR \\} \def\@glshypersection#1\delimR #2\delimR #3\\{% \ifx\\#2\\% \@delimNhypersection{#1}% \else \@ifundefined{hyperlink}{#1\delimR #2}{\hyperlink{section.#1}{#1}\delimR \hyperlink{section.#2}{#2}}% \fi } \def\@delimNhypersection#1{\@@delimNhypersection#1\delimN \delimN\\} \def\@@delimNhypersection#1\delimN #2\delimN #3\\{% \ifx\\#2\\% \@ifundefined{hyperlink}{#1}{\hyperlink{section.#1}{#1}}% \else \@ifundefined{hyperlink}{#1\delimN #2}{\hyperlink{section.#1}{#1}\delimN \hyperlink{section.#2}{#2}}% \fi } \ifthenelse{\equal{\gls@number}{section}}{ \ifglshyper \@ifundefined{chapter} {} {\let\@gls@old@chapter\@chapter \def\@chapter[#1]#2{\@gls@old@chapter[{#1}]{#2}\@ifundefined{hyperdef}{}{\hyperdef{section}{\thechapter.0}{}}}} \fi \providecommand\hyperrm[1]{\textrm{\glshypersection{#1}}} \providecommand\hypersf[1]{\textsf{\glshypersection{#1}}} \providecommand\hypertt[1]{\texttt{\glshypersection{#1}}} \providecommand\hyperbf[1]{\textbf{\glshypersection{#1}}} \providecommand\hyperit[1]{\textit{\glshypersection{#1}}} } { \providecommand\hyperrm[1]{\textrm{\glshyperpage{#1}}} \providecommand\hypersf[1]{\textsf{\glshyperpage{#1}}} \providecommand\hypertt[1]{\texttt{\glshyperpage{#1}}} \providecommand\hyperbf[1]{\textbf{\glshyperpage{#1}}} \providecommand\hyperit[1]{\textit{\glshyperpage{#1}}} } \else \providecommand\hyperrm[1]{\textsf{#1}} \providecommand\hypersf[1]{\textsf{#1}} \providecommand\hypertt[1]{\texttt{#1}} \providecommand\hyperbf[1]{\textbf{#1}} \providecommand\hyperit[1]{\textit{#1}} \fi % \end{macrocode} % Check to see if acronyms should be separate from glossary % \begin{macrocode} \ifglsacronym \newglossarytype[alg]{acronym}{acr}{acn} \newcommand{\acronymname}{List of Acronyms} \else \let\acronym=\glossary \let\xacronym=\xglossary \fi % \end{macrocode} %\subsection{makeglos code} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*makeglos.pl> % \end{macrocode} % \begin{macrocode} #!/usr/bin/perl # File : makeglos # Author : Nicola Talbot # Version : 1.3 (2005/06/28) # Description: simple Perl script that calls makeindex. # Intended for use with "glossary.sty" (saves having to remember # all the various switches) use Getopt::Std; if ($#ARGV < 0) { die "Syntax : $0 [-ilqrcgm] [-s sty] [-o gls] [-t log] [-p num] \n"; } getopt('sotp'); getopts('ilqrcgm'); # define known extensions %exttype = ( glossary => {in=>'glo', out=>'gls', 'log'=>'glg'}, ); $ext = ''; if (length(@ARGV[0]) < 4) { $name = @ARGV[0]; } elsif (substr(@ARGV[0],-4,1) eq ".") { $name = substr(@ARGV[0],0,length(@ARGV[0])-4); $ext = substr(@ARGV[0],-3,3); } else { $name = @ARGV[0]; } # check log file for other glossary types if (open AUXFILE, "$name.aux") { while () { if (m/\\\@newglossarytype\s*\[(.*)\]{(.*)}{(.*)}{(.*)}/) { $exttype{$2}{'in'} = $3; $exttype{$2}{'out'} = $4; $exttype{$2}{'log'} = $1; if (!$opt_q) { print "added glossary type '$2' ($3,$4,$1)\n"; } } } close AUXFILE; } else { print "unable to open $name.aux\n"; } # save all the general makeindex switches $mkidxopts = ''; if ($opt_i) { $mkidxopts .= " -i"; } if ($opt_l) { $mkidxopts .= " -l"; } if ($opt_q) { $mkidxopts .= " -q"; } if ($opt_r) { $mkidxopts .= " -r"; } if ($opt_c) { $mkidxopts .= " -c"; } if ($opt_g) { $mkidxopts .= " -g"; } unless ($opt_p eq "") { $mkidxopts .= " -p $opt_p"; } if ($opt_s eq "") { $istfile = "$name.ist"; } else { $istfile = $opt_s; } if ($ext ne '') { %thistype = %{$exttype{'glossary'}}; #default foreach $type (keys %exttype) { if ($exttype{$type}{'in'} eq $ext) { %thistype = %{$exttype{$type}}; last; } } if ($opt_o eq "") { $outfile = "$name.$thistype{out}"; } else { $outfile = $opt_o; } if ($opt_t eq "") { $transcript = "$name.$thistype{'log'}"; } else { $transcript = $opt_t; } &makeindex("$name.$ext",$outfile,$transcript,$istfile, $mkidxopts,$opt_q,$opt_m); } else { foreach $type (keys %exttype) { %thistype = %{$exttype{$type}}; $inputfile = "$name.$thistype{in}"; if (-r $inputfile) { if ($opt_o eq "") { $outfile = "$name.$thistype{out}"; } else { $outfile = $opt_o; } if ($opt_t eq "") { $transcript = "$name.$thistype{'log'}"; } else { $transcript = $opt_t; } &makeindex($inputfile,$outfile,$transcript, $istfile,$mkidxopts,$opt_q,$opt_m); } elsif (!$opt_q) { print "no read access for '$inputfile'\n"; } } } sub makeindex{ local($in,$out,$trans,$ist,$rest,$quiet,$merge) = @_; local($name,$cmdstr,$buffer,$n,$i,$j); local(@stuff,@item); if ($merge) { $cmdstr = "$rest -s $ist -t $trans -o tmp_$out $in"; } else { $cmdstr = "$rest -s $ist -t $trans -o $out $in"; } unless ($quiet) { print "makeindex $cmdstr\n"; } `makeindex $cmdstr`; if ($merge) { print "Merging entries\n"; open INPUT, ") { $buffer .= $_; } close INPUT; open OUTPUT, ">$out"; @stuff = split /\\gloitem /, $buffer; $n = scalar(@stuff); if ($n < 2) { print OUTPUT $buffer; } else { print OUTPUT $stuff[0]; for ($i = 1, $j=-1; $i < $n; $i++) { if ($stuff[$i]=~s/{\\glosslabel{(.+)}{(.+)}}//) { $name = $&; if ($j==-1) { $j = 0; $item[0]{'name'} = $name; $item[0]{'desc'} = $stuff[$i]; } else { # makeindex has already sorted the entries # alphabetically, so duplicate entries # will be one after the other if ($item[$j]{'name'} eq $name) { $item[$j]{'desc'} .= $stuff[$i]; print "collating $name\n"; } else { $j++; $item[$j]{'name'} = $name; $item[$j]{'desc'} = $stuff[$i]; } } } else { print STDERR "unable to extract name from glossary item:\n", $stuff[$i]; } } for ($i=0; $i <= $j; $i++) { print OUTPUT "\\gloitem ", $item[$i]{'name'}, $item[$i]{'desc'}; } } close OUTPUT; print "Output written in $out\n"; unlink "tmp_$out" or print "Can't delete tmp_$out: $!\n"; } } 1; % \end{macrocode} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*makeglos.bat> % \end{macrocode} % \begin{macrocode} @rem = '-*- Perl -*- @echo off perl -S %0.pl %1 %2 %3 %4 %5 %6 %7 %8 %9 % \end{macrocode} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*glossary.perl> % \end{macrocode} % \begin{macrocode} # File : glossary.perl # Author : Nicola Talbot # Date : 8 July 2005 # Version : 1.02 # Description : LaTeX2HTML implementation of glossary package. package main; # These are the only package options implemented. sub do_glossary_style_altlist{ } sub do_glossary_style_hyper{ } sub do_glossary_style_hyper_true{ } sub do_glossary_style_hyperacronym{ } sub do_glossary_style_hyperacronym_true{ } sub do_glossary_toc{ } sub do_glossary_toc_true{ } $acronymtype = 'glossary'; sub do_glossary_acronym{ &do_glossary_acronym_true } sub do_glossary_acronym_true{ $gls_mark{'acronym'} = ""; $gls_file_mark{'acronym'} = ""; $gls_title{'acronym'} = "\\acronymname"; $delimN{'acronym'} = ", "; $glodelim{'acronym'} = " "; $glsnumformat{'acronym'} = "textrm"; $acronymtype = 'acronym'; } sub do_glossary_acronym_false{ $acronymtype = 'glossary'; } sub do_cmd_acronymname{ join('', 'List of Acronyms', $_[0]); } # modify set_depth_levels so that glossary is added $gls_mark{'glossary'} = ""; $gls_file_mark{'glossary'} = ""; $gls_title{'glossary'} = "Glossary"; $delimN{'glossary'} = ", "; $glodelim{'glossary'} = " "; $glsnumformat{'glossary'} = "textrm"; sub replace_glossary_markers{ foreach $type (keys %gls_mark) { if (defined &add_gls_hook) {&add_gls_hook if (/$gls_mark{$type}/);} else {&add_gls($type) if (/$gls_mark{$type}/);} s/$gls_file_mark{$type}/$glsfile{$type}/g; } } # there must be a better way of doing this # other than copying the orginal code and adding to it. sub replace_general_markers { if (defined &replace_infopage_hook) {&replace_infopage_hook if (/$info_page_mark/);} else { &replace_infopage if (/$info_page_mark/); } if (defined &add_idx_hook) {&add_idx_hook if (/$idx_mark/);} else {&add_idx if (/$idx_mark/);} &replace_glossary_markers; if ($segment_figure_captions) { s/$lof_mark/$segment_figure_captions/o } else { s/$lof_mark/$figure_captions/o } if ($segment_table_captions) { s/$lot_mark/$segment_table_captions/o } else { s/$lot_mark/$table_captions/o } &replace_morelinks(); if (defined &replace_citations_hook) {&replace_citations_hook if /$bbl_mark/;} else {&replace_bbl_marks if /$bbl_mark/;} if (defined &add_toc_hook) {&add_toc_hook if (/$toc_mark/);} else {&add_toc if (/$toc_mark/);} if (defined &add_childs_hook) {&add_childs_hook if (/$childlinks_on_mark/);} else {&add_childlinks if (/$childlinks_on_mark/);} &remove_child_marks; if (defined &replace_cross_references_hook) {&replace_cross_references_hook;} else {&replace_cross_ref_marks if /$cross_ref_mark||$cross_ref_visible_mark/;} if (defined &replace_external_references_hook) {&replace_external_references_hook;} else {&replace_external_ref_marks if /$external_ref_mark/;} if (defined &replace_cite_references_hook) {&replace_cite_references_hook;} else { &replace_cite_marks if /$cite_mark/; } if (defined &replace_user_references) { &replace_user_references if /$user_ref_mark/; } } sub add_gls{ local($sidx_style, $eidx_style) =('',''); if ($INDEX_STYLES) { if ($INDEX_STYLES =~/,/) { local(@styles) = split(/\s*,\s*/,$INDEX_STYLES); $sidx_style = join('','<', join('><',@styles) ,'>'); $eidx_style = join('',''); } else { $sidx_style = join('','<', $INDEX_STYLES,'>'); $eidx_style = join('',''); } } &add_real_gls } sub gloskeysort{ local($x, $y) = ($a, $b); $x=~s/^(.*)###(\d+)$/\l\1/; local($x_id) = $2; $y=~s/^(.*)###(\d+)$/\l\1/; local($y_id) = $2; local($n) = ($x cmp $y); if ($n == 0) { $n = ($x_id <=> $y_id); } $n; } sub add_real_gls{ local($type) = @_; print "\nDoing the $type ..."; local($key, $str, @keys, $glossary, $level, $count, @previous, @current, $id, $linktext, $delimN); @keys = keys %{$glossary{$type}}; @keys = sort gloskeysort @keys; $level = 0; $delimN = $delimN{$type}; foreach $key (@keys) { $current = $key; $str = $current; $str =~ s/\#\#\#\d+$//o; # Remove the unique id's #$linktext = $cross_ref_visible_mark; $id = ++$global{'max_id'}; $linktext = "\\$glossary_format{$type}{$key}${OP}$id${CP}$glossary_linktext{$type}{$key}${OP}$id${CP}"; $linktext = &translate_commands($linktext); $glossary .= # If it's the same string don't start a new line (&index_key_eq($current, $previous) ? $delimN . $glossary{$type}{$key} . $linktext . "\n" : "
" . $glossary_name{$type}{$key} . "
". $glossary_desc{$type}{$key} . $glodelim{$type} . $glossary{$type}{$key} . $linktext. "\n"); $previous = $current; } $glossary = '
'.$glossary unless ($glossary =~ /^\s*/); $glossary =~ s/(]*>)()/$2$1/g; $str = &translate_commands("\\glossarypostamble"); s/$gls_mark{$type}/$preglossary\n
\n$glossary<\/DL>$str\n/s; } sub set_depth_levels { # Sets $outermost_level local($level); # scan the document body, not the preamble, for use of sectioning commands my ($contents) = $_; if ($contents =~ /\\begin\s*((?:$O|$OP)\d+(?:$C|$CP))document\1|\\startdocument/s) { $contents = $'; } foreach $level ("part", "chapter", "section", "subsection", "subsubsection", "paragraph") { last if (($outermost_level) = $contents =~ /\\($level)$delimiter_rx/); last if (($outermost_level) = $contents =~ /\\endsegment\s*\[\s*($level)\s*\]/s); if ($contents =~ /\\segment\s*($O\d+$C)[^<]+\1\s*($O\d+$C)\s*($level)\s*\2/s) { $outermost_level = $3; last }; } $level = ($outermost_level ? $section_commands{$outermost_level} : do {$outermost_level = 'section'; 3;}); if ($REL_DEPTH && $MAX_SPLIT_DEPTH) { $MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH; } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 }; %unnumbered_section_commands = ( 'tableofcontents', $level , 'listoffigures', $level , 'listoftables', $level , 'bibliography', $level , 'textohtmlindex', $level , 'textohtmlglossary', $level , %unnumbered_section_commands ); %section_commands = ( %unnumbered_section_commands , %section_commands ); } sub add_bbl_and_idx_dummy_commands { local($id) = $global{'max_id'}; s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg; ## if ($bbl_cnt == 1) { s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo; #} $global{'max_id'} = $id; s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o; s/[\\]printindex/\\textohtmlindex /o; &add_gls_dummy_commands; &lib_add_bbl_and_idx_dummy_commands() if defined(&lib_add_bbl_and_idx_dummy_commands); } # this gets called before do_cmd_newglossarytype # so currently only substitutes \\printglossary and \\printacronym sub add_gls_dummy_commands{ #foreach $type (keys %gls_mark) #{ # #$id = ++$global{'max_id'}; # s/[\\]print$type/\\textohtmlglossary[$type]/sg; #} s/[\\]printglossary/\\textohtmlglossary/sg; s/[\\]printacronym/\\textohtmlglossary[$acronymtype]/sg; } # This is modified from do_cmd_textohtmlindex sub do_cmd_textohtmlglossary{ local($_) = @_; local($type); $_[0]=~s/^\s*\[([^]]*)\]//; $type = $1; if ($type eq '') {$type = 'glossary';} unless (defined $gls_mark{$type}) { &write_warnings("glossary type '$type' not implemented"); } if (eval "(defined \&do_cmd_${type}name) ||\$new_command{\"${type}name\"}") { local($br_id)=++$global{'max_id'}; $TITLE = &translate_environments("$O$br_id$C\\${type}name$O$br_id$C"); } else { $TITLE = $gls_title{$type} } $toc_sec_title = $TITLE; $glsfile{$type} = $CURRENT_FILE; if (%glossary_labels) { &make_glossary_labels(); } if (($SHORT_INDEX) && (%glossary_segment)) { &make_preglossary(); } else { $preglossary = &translate_commands("\\glossarypreamble"); } local $idx_head = $section_headings{'textohtmlindex'}; local($heading) = join('' , &make_section_heading($TITLE, $idx_head) , $gls_mark{$type} ); local($pre,$post) = &minimize_open_tags($heading); join('',"
\n" , $pre, $_[0]); } sub make_glossary_labels { local($key, @keys); @keys = keys %glossary_labels; foreach $key (@keys) { if (($ref_files{$key}) && !($ref_files{$key} eq "$glsfile{'glossary'}")) { local($tmp) = $ref_files{$key}; &write_warnings("\nmultiple label $key , target in $glsfile{'glossary'} masks $tmp "); } $ref_files{$key} .= $glsfile{'glossary'}; } } sub make_preglossary{ &make_real_preglossary } sub make_real_preglossary{ local($key, @keys, $head, $body); $head = "
\n

Legend:

\n
"; @keys = keys %glossary_segment; foreach $key (@keys) { local($tmp) = "segment$key"; $tmp = $ref_files{$tmp}; $body .= "\n
$key
".&make_named_href('',$tmp,$glossary_segment{$key}); } $preglossary = join('', $head, $body, "\n
") if ($body); } sub do_cmd_glossary { &do_real_glossary(@_) } sub do_real_glossary { local($_) = @_; local($br_id, $str); local($type) = "glossary"; local($anchor); if (s/^\S*$OP(\d+)${CP}type=(.+)$OP\1$CP//) { $type = $2; } local($idx_option,$pat) = &get_next_optional_argument; $str = &missing_braces unless ( (s/$next_pair_pr_rx/($br_id, $str) = ($1, $2);''/eo) ||(s/$next_pair_rx/($br_id, $str) = ($1, $2);''/eo)); # the maths gets processed before being passed # to do_cmd_glossary. How can I do this # substitution before it gets converted to an image? $str=~s/\"\"/\"/gs; $str=~s/\"\|/\|/gs; $str=~s/\"@/@/gs; $str=~s/\"!/!/gs; $str=~s/;SPMquot;;SPMquot;/;SPMquot;/gs; $str=~s/;SPMquot;\|/\|/gs; $str=~s/;SPMquot;\@/\@/gs; $str=~s/;SPMquot;!/!/gs; $anchor = &make_glossary_entry($br_id,$str,$anchor_invisible_mark,$type); join('', $anchor, $_); } sub make_glossary_entry { &make_real_glossary_entry(@_) } sub make_real_glossary_entry { local($br_id,$str,$text,$type) = @_; local($this_file) = $CURRENT_FILE; $TITLE = $saved_title if (($saved_title)&&(!($TITLE)||($TITLE eq $default_title))); #extract name, sort, description and format data from $str local($name,$sort,$description,$format); unless (($str=~/name\s*=\s*${OP}(\d+)${CP}(.+)${OP}\1${CP}\s*,?/s && ($name=$2)) || ($str=~/name\s*=\s*([^,]+)\s*,?/s && ($name=$1))) { &write_warnings("can't determine name key from $str"); } unless (($str=~/sort\s*=\s*${OP}(\d+)${CP}(.+)${OP}\1${CP}\s*,?/s && ($sort=$2)) || ($str=~/sort\s*=\s*([^,]+)\s*,?/s && ($sort=$1))) { $sort = $name; } unless (($str=~/description\s*=\s*${OP}(\d+)${CP}(.+)${OP}\1${CP}\s*,?/s && ($description=$2)) || ($str=~/description\s*=\s*([^,]+)\s*,?/s && ($description=$1))) { &write_warnings("can't determine description key from $str"); } unless (($str=~/format\s*=\s*${OP}(\d+)${CP}(.+)${OP}\1${CP}\s*,?/s && ($format=$2)) || ($str=~/format\s*=\s*([^,]+)\s*,?/s && ($format=$1))) { $format = "glsnumformat[$type]"; } # Save the reference $str = "$sort$description###" . ++$global{'max_id'}; # Make unique # concatenate multiple spaces into a single space # otherwise keys won't sort properly $str=~s/\s+/ /gs; $glossary{$type}{$str} .= &make_half_href($this_file."#$br_id"); $glossary_name{$type}{$str} = $name; $glossary_format{$type}{$str} = $format; $glossary_desc{$type}{$str} = $description; $glossary_linktext{$type}{$str} = $TITLE; "
$text<\/A>"; } sub do_cmd_xglossary{ local($_) = @_; local($entry,$text); local($type) = "glossary"; if (s/^$OP(\d+)${CP}type=(.+)$OP\1$CP//) { $type = $2; } $entry = &missing_braces unless s/$next_pair_pr_rx/$entry=$2;''/eo; $text = &missing_braces unless s/$next_pair_pr_rx/$text=$2;''/eo; $entry=~s/\"\"/\"/gs; $entry=~s/\"\|/\|/gs; $entry=~s/\"\@/\@/gs; $entry=~s/\"!/!/gs; $entry=~s/;SPMquot;;SPMquot;/;SPMquot;/gs; $entry=~s/;SPMquot;\|/\|/gs; $entry=~s/;SPMquot;\@/\@/gs; $entry=~s/;SPMquot;!/!/gs; $br_id = ++$global{'max_id'}; join('', &make_glossary_entry($br_id,$entry,$text,$type), $_); } sub do_cmd_newglossarytype{ local($type,$out,$in); $type = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($type=$2)); $out = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($out=$2)); $in = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($in=$2)); &make_newglossarytype($type); $_[0]; } sub make_newglossarytype{ local($type) = @_; eval ("sub do_cmd_make$type\{\}"); $gls_mark{$type} = ""; $gls_file_mark{$type} = ""; $gls_title{$type} = "\\glossaryname"; local($tmp) = 'sub do_cmd_' . $type. '{'; $tmp .= 'local($id) = ++$global{\'max_id\'};'; $tmp .= '"\\\\glossary$OP$id${CP}type=' . $type . '$OP$id$CP".$_[0];'; $tmp .= '}'; eval($tmp); $tmp = 'sub do_cmd_x' . $type. '{'; $tmp .= 'local($id) = ++$global{\'max_id\'};'; $tmp .= '"\\\\xglossary$OP$id${CP}type=' . $type . '$OP$id$CP".$_[0];'; $tmp .= '}'; eval($tmp); $tmp = 'sub do_cmd_print' . $type. '{'; #$tmp .= 'local($id)=++$global{\'max_id\'};'; $tmp .= '"\\\\textohtmlglossary[' . $type . ']" . $_[0]'; $tmp .= '}'; eval($tmp); $delimN{$type} = ", "; $glodelim{$type} = ""; $glsnumformat{$type} = ""; } sub do_cmd_gloshort{ local($_) = @_; join('', "", $_); } sub do_cmd_glolong{ local($_) = @_; join('', "", $_); } $acronymnamefmt = " ()"; sub do_cmd_setacronymnamefmt{ local($_) = @_; $acronymnamefmt = &missing_braces unless s/$next_pair_pr_rx/$acronymnamefmt=$2;''/eo; $_; } sub do_cmd_acronymfont{ local($_) = @_; local($text) = &missing_braces unless s/$next_pair_pr_rx/$text=$2;''/eo; $text . $_; } %acronym = (); sub do_cmd_newacronym{ local($_) = @_; local($cmdname,$pat,$abbrv,$long,$glsentry,$name); ($cmdname,$pat) = &get_next_optional_argument; $abbrv = &missing_braces unless (s/$next_pair_pr_rx/$abbrv=$2;''/eo); $long = &missing_braces unless (s/$next_pair_pr_rx/$long=$2;''/eo); $glsentry = &missing_braces unless (s/$next_pair_pr_rx/$glsentry=$2;''/eo); if ($cmdname eq '') { $cmdname = $abbrv; } local($id); $id = ++$global{'max_id'}; local($fmtedabbrv) = &translate_commands("\\acronymfont$OP$id$CP$abbrv$OP$id$CP"); unless ($glsentry=~/name=/) { $name = $acronymnamefmt; $name=~s//$fmtedabbrv/egs; $name=~s//$long/egs; $id = ++$global{'max_id'}; $glsentry .= ",name=$OP$id$CP$name$OP$id$CP"; } $global{"${cmdname}first"} = 1; $acronym{$cmdname}{'abbrv'} = $abbrv; $acronym{$cmdname}{'long'} = $long; $acronym{$cmdname}{'entry'} = $glsentry; local($tmp); unless ($cmdname=~/[^a-zA-Z]/) { $tmp = 'sub do_cmd_' . $cmdname . '{'; $tmp .= 'local($_)=@_;'; $tmp .= 'local($id)=++$global{\'max_id\'};'; $tmp .= 'local($str);'; $tmp .= '$str="${OP}$id${CP}' . $cmdname . '${OP}$id${CP}";'; $tmp .= '&do_cmd_useacronym($str . $_[0])'; $tmp .= '}'; eval($tmp); $tmp = 'sub do_cmd_' . $cmdname . 'star{'; $tmp .= 'local($_)=@_;'; $tmp .= 'local($id)=++$global{\'max_id\'};'; $tmp .= 'local($str);'; $tmp .= '$str="${OP}$id${CP}' . $cmdname . '${OP}$id${CP}";'; $tmp .= '&do_cmd_useacronymstar($str . $_[0])'; $tmp .= '}'; eval($tmp); $tmp = 'sub do_cmd_' . $cmdname . 'long{'; $tmp .= 'local($_)=@_;'; $tmp .= 'join("", \'' . $long . '\', $_[0])'; $tmp .= '}'; eval($tmp); $tmp = 'sub do_cmd_' . $cmdname . 'short{'; $tmp .= 'local($_)=@_;'; $tmp .= 'join("", \'' . $fmtedabbrv . '\', $_[0])'; $tmp .= '}'; eval($tmp); } $_; } sub do_cmd_acrsh{ local($_) = @_; local($cmdname,$text,$id); $cmdname = &missing_braces unless (s/$next_pair_pr_rx/$id=$1;$cmdname=$2;''/eo); $text = &translate_commands("\\${cmdname}short"); $text . $_; } sub do_cmd_acrshstar{ local($_) = @_; local($cmdname,$text,$id); $cmdname = &missing_braces unless (s/$next_pair_pr_rx/$id=$1;$cmdname=$2;''/eo); $text = &translate_commands("\\${cmdname}short"); $text=~s/(<.*>)?(\w)/\1\u\2/; $text . $_; } sub do_cmd_acrln{ local($_) = @_; local($cmdname,$text,$id); $cmdname = &missing_braces unless (s/$next_pair_pr_rx/$id=$1;$cmdname=$2;''/eo); $text = &translate_commands("\\${cmdname}long"); $text . $_; } sub do_cmd_acrlnstar{ local($_) = @_; local($cmdname,$text,$id); $cmdname = &missing_braces unless (s/$next_pair_pr_rx/$id=$1;$cmdname=$2;''/eo); $text = &translate_commands("\\${cmdname}long"); $text=~s/(\w)/\u\1/; $text . $_; } sub do_cmd_useacronym{ local($_)=@_; local($str,$abbrv,$long,$entry,$id); local($optarg,$pat)=&get_next_optional_argument; $cmdname = &missing_braces unless (s/$next_pair_pr_rx/$cmdname=$2;''/eo); if (defined %{$acronym{$cmdname}}) { $abbrv = $acronym{$cmdname}{'abbrv'}; $long = $acronym{$cmdname}{'long'}; $entry = $acronym{$cmdname}{'entry'}; $id = ++$global{'max_id'}; $abbrv = "\\acronymfont$OP$id$CP$abbrv$OP$id$CP"; $id = ++$global{'max_id'}; $str = "\\xglossary${OP}$id${CP}type=" . $acronymtype. "${OP}$id${CP}"; $id = ++$global{'max_id'}; $str .= "${OP}$id${CP}" . $entry . "${OP}$id${CP}"; $id = ++$global{'max_id'}; $str .= "${OP}$id${CP}"; $str .= ($global{"${cmdname}first"} ? "$long$optarg ($abbrv)" : "$abbrv$optarg"); $str .= "${OP}$id${CP}"; $global{"${cmdname}first"} = 0; } else { &write_warnings("acronym '$cmdname' not defined"); } $str . $_ } sub do_cmd_useacronymstar{ local($_)=@_; local($str,$abbrv,$long,$entry,$id); local($optarg,$pat)=&get_next_optional_argument; $cmdname = &missing_braces unless (s/$next_pair_pr_rx/$cmdname=$2;''/eo); if (defined %{$acronym{$cmdname}}) { $abbrv = $acronym{$cmdname}{'abbrv'}; $long = $acronym{$cmdname}{'long'}; $entry = $acronym{$cmdname}{'entry'}; if ($global{"${cmdname}first"}) { $long=~s/^([^a-zA-Z]*)([a-zA-Z])/\1\u\2/; } else { $abbrv=~s/^([^a-zA-Z]*)([a-zA-Z])/\1\u\2/; } $id = ++$global{'max_id'}; $abbrv = "\\acronymfont$OP$id$CP$abbrv$OP$id$CP"; $name = ($global{"${cmdname}first"} ? "$long$optarg ($abbrv)" : "$abbrv$optarg"); $id = ++$global{'max_id'}; $str = "\\xglossary${OP}$id${CP}type=" . $acronymtype . "${OP}$id${CP}"; $id = ++$global{'max_id'}; $str .= "${OP}$id${CP}" . $entry . "${OP}$id${CP}"; $id = ++$global{'max_id'}; $str .= "${OP}$id${CP}"; $str .= $name; $str .= "${OP}$id${CP}"; $global{"${cmdname}first"} = 0; } else { &write_warnings("acronym '$cmdname' not defined"); } $str . $_ } sub do_cmd_ifacronymfirstuse{ local($_) = @_; local($acronym,$truebit,$falsebit,$str); $acronym = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($acronym=$2)); $truebit = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($truebit=$2)); $falsebit = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($falsebit=$2)); $str = ($global{"${acronym}true"} ? $truebit : $falsebit); $str . $_[0]; } sub do_cmd_resetacronym{ local($_) = @_; local($cmdname); $cmdname = &missing_braces unless (s/$next_pair_pr_rx/$cmdname=$2;''/eo); if (defined %{$acronym{$cmdname}}) { $global{"${cmdname}first"} = 1; } else { &write_warnings("acronym '$cmdname' not defined"); } $_; } sub do_cmd_resetallacronyms{ local($_) = @_; foreach $key (keys %acronym) { $global{"${key}first"} = 1; } $_; } %savedglosentry = (); # This command is deprecated sub do_cmd_saveglosentry{ local($_) = @_; local($name,$desc,$type,$pat); ($type,$pat) = &get_next_optional_argument; $name = &missing_braces unless s/$next_pair_pr_rx/$name=$2;''/eo; $desc = &missing_braces unless s/$next_pair_pr_rx/$desc=$2;''/eo; $savedglosentry{$name}{'entry'} = "name=$name,description=$desc"; $savedglosentry{$name}{'type'} = $type; $_; } sub do_cmd_storeglosentry{ local($_) = @_; local($type,$pat,$entry,$label); ($type,$pat) = &get_next_optional_argument; if ($type eq '') { $type = 'glossary'; } $label = &missing_braces unless s/$next_pair_pr_rx/$label=$2;''/eo; $entry = &missing_braces unless s/$next_pair_pr_rx/$entry=$2;''/eo; $savedglosentry{$label}{'entry'} = $entry; $savedglosentry{$label}{'type'} = $type; $_; } sub do_cmd_useglosentry{ local($_) = @_; local($optarg,$pat,$name,$str,$id); ($optarg,$pat) = &get_next_optional_argument; $name = &missing_braces unless (s/$next_pair_pr_rx/$name=$2;''/eo); if (defined $savedglosentry{$name}{type}) { $id = ++$global{'max_id'}; $str = "\\$savedglosentry{$name}{type}${OP}$id${CP}$savedglosentry{$name}{entry}"; unless ($optarg eq "") { $str .= ",$optarg"; } $str .= "${OP}$id${CP}"; } else { &write_warnings("glossary entry '$name' undefined"); $str = ''; } $str . $_; } sub do_cmd_useGlosentry{ local($_) = @_; local($optarg,$pat,$name,$str,$id); ($optarg,$pat) = &get_next_optional_argument; $name = &missing_braces unless (s/$next_pair_pr_rx/$name=$2;''/eo); if (defined $savedglosentry{$name}{type}) { $id = ++$global{'max_id'}; $str = "\\x$savedglosentry{$name}{type}${OP}$id${CP}$savedglosentry{$name}{entry}"; unless ($optarg eq "") { $str .= ",$optarg"; } $str .= "${OP}$id${CP}"; } else { &write_warnings("glossary entry '$name' undefined"); $str = ''; } $str . $_; } sub do_cmd_gls{ local($_) = @_; local($optarg,$pat,$label,$str,$id,$name); ($optarg,$pat) = &get_next_optional_argument; $label = &missing_braces unless (s/$next_pair_pr_rx/$label=$2;''/eo); if (defined $savedglosentry{$label}{type}) { $str = $savedglosentry{$label}{'entry'}; if ($str=~/name=[ ]*${OP}(\d+)${CP}(.*)${OP}\1${CP}/s) { $name = $2; } elsif (($str=~/name=[ ]*([^,]+),/m) || ($str=~/name=[ ]*([^,]+)\Z(?!\n)/m)) { $name = $1; } $id = ++$global{'max_id'}; $str = "\\x$savedglosentry{$label}{type}${OP}$id${CP}$savedglosentry{$label}{entry}"; unless ($optarg eq "") { $str .= ",$optarg"; } $str .= "${OP}$id${CP}"; $id = ++$global{'max_id'}; $str .= "${OP}$id${CP}$name${OP}$id${CP}"; } else { &write_warnings("glossary entry '$label' undefined"); $str = ''; } $str . $_; } sub do_cmd_glossarypreamble{ local($_) = @_; $_[0]; } sub do_cmd_glossarypostamble{ local($_) = @_; $_[0]; } sub do_cmd_glsnumformat{ local($_) = @_; local($type,$pat) = &get_next_optional_argument; if ($type eq '') { $type = 'glossary'; } local($cmd) = ''; unless ($glsnumformat{$type} eq '') { $cmd = "\\$glsnumformat{$type}"; } $cmd . $_; } sub do_cmd_setglossary{ local($_) = @_; local($str,$type,$format,$delimN,$glodelim); $str = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($str=$2)); unless (($str=~/type=([^,]+),|$/&&($type=$1)) || ($str=~/type=${OP}(\d+)${CP}(.*)${OP}\1${CP}/&&($type=$2))) { $type = 'glossary'; } if ($str=~/glsnumformat=[ ]*${OP}(\d+)${CP}(.*)${OP}\1${CP}/s) { $format = $2; } elsif (($str=~/glsnumformat=[ ]*([^,]+),/m) || ($str=~/glsnumformat=[ ]*([^,]+)\Z(?!\n)/m)) { $format = $1; } if ($format ne '') { $glsnumformat{$type} = $format; if ($format eq 'ignore') { $delimN{$type} = ''; } } if (($str=~/delimN=([^,]+),|$/&&($delimN=$1)) || ($str=~/delimN=${OP}(\d+)${CP}(.*)${OP}\1${CP}/&&($delimN=$2))) { $delimN{$type} = $delimN; } if (($str=~/glodelim=([^,]+),|$/&&($glodelim=$1)) || ($str=~/glodelim=${OP}(\d+)${CP}(.*)${OP}\1${CP}/&&($glodelim=$2))) { $glodelim{$type} = $glodelim; } $_[0]; } sub do_cmd_ignore{ local($_) = @_; local($str); $str = &missing_braces unless ($_[0]=~s/$next_pair_pr_rx//o&&($str=$2)); $_[0]; } sub do_cmd_hyperit{ join('', "\\textit ", $_[0]); } sub do_cmd_hyperrm{ join('', "\\textrm ", $_[0]); } sub do_cmd_hypertt{ join('', "\\texttt ", $_[0]); } sub do_cmd_hypersf{ join('', "\\textsf ", $_[0]); } sub do_cmd_hyperbf{ join('', "\\textbf ", $_[0]); } &ignore_commands( <<_IGNORED_CMDS_ ); makeglossary makeacronym _IGNORED_CMDS_ 1; % \end{macrocode} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*sample.tex> % \end{macrocode} \documentclass[a4paper]{report} \usepackage[plainpages=false,colorlinks]{hyperref} \usepackage{glossary} \makeglossary \begin{document} \title{Sample Document Using glossary Package} \author{Nicola Talbot} \pagenumbering{alph}% prevent duplicate page link names if using PDF \maketitle \pagenumbering{roman} \tableofcontents \chapter{Introduction} \pagenumbering{arabic} A \xglossary{name=glossary,description=1) list of technical words}{glossary} is a very useful addition to any technical document, although a \xglossary{name=glossary, description=2) collection of glosses}{glossary} can also simply be a collection of glosses, which is another thing entirely. Once you have run your document through \LaTeX, you will then need to run the \texttt{.glo} file through \texttt{makeindex}. You will need to set the output file so that it creates a \texttt{.gls} file instead of an \texttt{.ind} file, and change the name of the log file so that it doesn't overwrite the index log file (if you have an index for your document). Rather than having to remember all the command line switches, you can call the \xglossary{name=\texttt{Perl}, sort=Perl,description=A scripting language}{Perl} script \texttt{makeglos.pl} which provides a convenient wrapper. If you have two terms with different meanings in your \xglossary{name=glossary,description=1) list of technical words}{glossary}, \texttt{makeindex} will of course treat them as two separate entries, however, some people prefer to merge them. This can be done using \texttt{makeglos.pl}, and passing the option \texttt{-m}. \printglossary \end{document} % \begin{macrocode} % % \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} \makeglossary \renewcommand{\acronymfont}[1]{\textmd{\scshape #1}} \setacronymnamefmt{\gloshort: \expandafter\MakeUppercase\glolong} \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)} \begin{document} \tableofcontents \printglossary \chapter{Support Vector Machines} The \svm is used widely in the area of pattern recognition. \useacronym*[s]{svm} are \ldots This is the long version: \svmlong or alternatively: \acrln*{svm}. Abbreviation: \svmshort or \acrsh*{svm}. \chapter{Kernel Support Vector Machines} The \ksvm\ is \ifacronymfirstuse{svm}{a}{an} \svm\ that uses the so called ``kernel trick''. %\resetacronym{ksvm} \resetallacronyms \useacronym*[s]{ksvm} \ldots \svm. \begin{thebibliography}{1} \bibitem{svm} \ldots \end{thebibliography} \end{document} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*sampleEq.tex> % \end{macrocode} \documentclass[a4paper,12pt]{report} \usepackage{amsmath} \usepackage[header,border=none,cols=3]{glossary} \newcommand{\erf}{\operatorname{erf}} \newcommand{\erfc}{\operatorname{erfc}} \renewcommand{\theglossarynum}{\theequation} \renewcommand{\pagecompositor}{.} \renewcommand{\glossaryname}{Index of Special Functions and Notations} \renewcommand{\glossaryheader}{\bfseries Notation & \multicolumn{2}{c}{\bfseries \begin{tabular}{c}Name of the Function and\\the number of the formula\end{tabular}}\\} \makeglossary \begin{document} \title{A Sample Document Using glossary.sty} \author{Nicola Talbot} \maketitle \begin{abstract} This is a sample document illustrating the use of the \textsf{glossary} package. The functions here have been taken from ``Tables of Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. The glossary is a list of special functions, so the equation number has been used rather than the page number. This can be done by defining \verb|\theglossarynum| to be \verb|\theequation|. The equation numbers are a composite number made up of the chapter number and number of equation within the chapter. The two parts of the page number are separated by a fullstop. The default compositor is a dash \verb|-|, so it needs to be set to a dot by redefining the command \verb|\pagecompositor|. (This needs to be done \emph{before} the command \verb|\makeglossary|.) \end{abstract} \printglossary \chapter{Gamma Functions} \begin{equation} \Gamma(z) = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt \end{equation} \glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma} \begin{equation} \Gamma(x+1) = x\Gamma(x) \end{equation} \glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma} \begin{equation} \gamma(\alpha, x) = \int_0^x e^{-t}t^{\alpha-1}\,dt \end{equation} \glossary{name={$\gamma(\alpha,x)$},description=Incomplete gamma function,sort=gamma} \begin{equation} \Gamma(\alpha, x) = \int_x^\infty e^{-t}t^{\alpha-1}\,dt \end{equation} \glossary{name={$\Gamma(\alpha,x)$},description=Incomplete gamma function,sort=Gamma} \newpage \begin{equation} \Gamma(\alpha) = \Gamma(\alpha, x) + \gamma(\alpha, x) \end{equation} \glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma} \begin{equation} \psi(x) = \frac{d}{dx}\ln\Gamma(x) \end{equation} \glossary{name=$\psi(x)$,description=Psi function,sort=psi} \chapter{Error Functions} \begin{equation} \erf(x) = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt \end{equation} \glossary{name=$\erf(x)$,description=Error function,sort=erf} \begin{equation} \erfc(x) = 1 - \erf(x) \end{equation} \glossary{name=$\erfc(x)$,description=Complementary error function,sort=erfc} \chapter{Beta Function} \begin{equation} B(x,y) = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt \end{equation} \glossary{name={$B(x,y)$},description=Beta function,sort=B} Alternatively: \begin{equation} B(x,y) = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi \end{equation} \glossary{name={$B(x,y)$},description=Beta function,sort=B} \begin{equation} B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) \end{equation} \glossary{name={$B(x,y)$},description=Beta function,sort=B} \begin{equation} B_x(p,q) = \int_0^x t^{p-1}(1-t)^{q-1}\,dt \end{equation} \glossary{name={$B_x(p,q)$},description=Incomplete beta function,sort=Bx} \chapter{Polynomials} \section{Chebyshev's polynomials} \begin{equation} T_n(x) = \cos(n\arccos x) \end{equation} \glossary{name=$T_n(x)$,description=Chebyshev's polynomials of the first kind,sort=Tn} \begin{equation} U_n(x) = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} \end{equation} \glossary{name=$U_n(x)$,description=Chebyshev's polynomials of the second kind,sort=Un} \section{Hermite polynomials} \begin{equation} H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) \end{equation} \glossary{name=$H_n(x)$,description=Hermite polynomials,sort=Hn} \section{Laguerre polynomials} \begin{equation} L_n^{\alpha} (x) = \frac{1}{n!}e^x x^{-\alpha} \frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) \end{equation} \glossary{name=$L_n^\alpha(x)$,description=Laguerre polynomials,sort=Lna} \chapter{Bessel Functions} Bessel functions $Z_\nu(z)$ are solutions of \begin{equation} \frac{d^2Z_\nu}{dz^2} + \frac{1}{z}\,\frac{dZ_\nu}{dz} + \left( 1-\frac{\nu^2}{z^2}Z_\nu = 0 \right) \end{equation} \glossary{name=$Z_\nu(z)$,description=Bessel functions,sort=Z} \chapter{Confluent hypergeometric function} \begin{equation} \Phi(\alpha,\gamma;z) = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} + \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} +\frac{\alpha(\alpha+1)(\alpha+2)}{\gamma(\gamma+1)(\gamma+2)}\,\frac{z^3}{3!} + \cdots \end{equation} \glossary{name={$\Phi(\alpha,\gamma;z)$},description=confluent hypergeometric function,sort=Pagz} \begin{equation} k_\nu(x) = \frac{2}{\pi}\int_0^{\pi/2}\cos(x \tan\theta - \nu\theta)\,d\theta \end{equation} \glossary{name=$k_\nu(x)$,description=Bateman's function,sort=kv} \chapter{Parabolic cylinder functions} \begin{equation} D_p(z) = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} \left\{ \frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} \Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) -\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} \Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) \right\} \end{equation} \glossary{name=$D_p(z)$,description=Parabolic cylinder functions,sort=Dp} \chapter{Elliptical Integral of the First Kind} \begin{equation} F(\phi, k) = \int_0^\phi \frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} \end{equation} \glossary{name={$F(\phi,k)$},description=Elliptical integral of the first kind,sort=Fpk} \chapter{Constants} \begin{equation} C = 0.577\,215\,664\,901\ldots \end{equation} \glossary{name=$C$,description=Euler's constant,sort=C} \begin{equation} G = 0.915\,965\,594\ldots \end{equation} \glossary{name=$G$,description=Catalan's constant,sort=G} \end{document} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*sampleEqPg.tex> % \end{macrocode} \documentclass[a4paper,12pt]{report} \usepackage{amsmath} \usepackage[header,toc,border=none,cols=3]{glossary} \newcommand{\erf}{\operatorname{erf}} \newcommand{\erfc}{\operatorname{erfc}} \renewcommand{\theglossarynum}{\theequation} \renewcommand{\pagecompositor}{.} \renewcommand{\glossaryname}{Index of Special Functions and Notations} \renewcommand{\glossarypreamble}{Numbers in italic indicate the equation number, numbers in bold indicate page numbers where the main definition occurs.\par} \setglossary{glsnumformat=textit} \renewcommand{\glossaryheader}{\bfseries Notation & \multicolumn{2}{c}{\bfseries \begin{tabular}{c}Name of the Function and\\the number of the formula\end{tabular}}\\} \renewcommand{\shortglossaryname}{Special Functions} \makeglossary \pagestyle{headings} \begin{document} \title{Sample Document Using Interchangable Numbering} \author{Nicola Talbot} \maketitle \begin{abstract} This is a sample document illustrating the use of the \textsf{glossary} package. The functions here have been taken from ``Tables of Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. The glossary lists both page number and equation numbers. Since the equation numbers depend on chapter numbers, the page compositor needs to be redefined. (Note that this example will only work where the page number and equation number compositor is the same. So it won't work if, say, the page numbers are of the form 2-4 and the equation numbers are of the form 4.6) As most of the glossary entries should have an italic format, it is easiest to set the default format to italic. \end{abstract} \tableofcontents \printglossary %It's a bit cumbersome having to keep redefining \theglossarynum. It %would probably be easier to define a new command which sets \theglossarynum %and then calls \glossary %For example: \newcommand{\myglossary}[2]{% \renewcommand{\theglossarynum}{#1}\glossary{#2}} %You can then do something like, say %\myglossary{\thepage}{name=$\Gamma(z)$,description=Gamma function,sort=Gamma,format=textbf} %or, alternatively, you could define \newcommand{\glossarypage}[1]{% \renewcommand{\theglossarynum}{\thepage}\glossary{#1,format=textbf}} %and \newcommand{\glossaryequation}[1]{% \renewcommand{\theglossarynum}{\theequation}\glossary{#1}} \chapter{Gamma Functions} The gamma function is defined as \renewcommand{\theglossarynum}{\thepage} \glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma,format=textbf} \renewcommand{\theglossarynum}{\theequation} \begin{equation} \Gamma(z) = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt \end{equation} \glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma} \begin{equation} \Gamma(x+1) = x\Gamma(x) \end{equation} \glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma} \begin{equation} \gamma(\alpha, x) = \int_0^x e^{-t}t^{\alpha-1}\,dt \end{equation} \glossary{name={$\gamma(\alpha,x)$},description=Incomplete gamma function,sort=gamma} \begin{equation} \Gamma(\alpha, x) = \int_x^\infty e^{-t}t^{\alpha-1}\,dt \end{equation} \glossary{name={$\Gamma(\alpha,x)$},description=Incomplete gamma function,sort=Gamma} \newpage \begin{equation} \Gamma(\alpha) = \Gamma(\alpha, x) + \gamma(\alpha, x) \end{equation} \glossary{name=$\Gamma(z)$,description=Gamma function,sort=Gamma} \begin{equation} \psi(x) = \frac{d}{dx}\ln\Gamma(x) \end{equation} \glossary{name=$\psi(x)$,description=Psi function,sort=psi} \chapter{Error Functions} The error function is defined as: \renewcommand{\theglossarynum}{\thepage} \glossary{name=$\erf(x)$,description=Error function,sort=erf,format=textbf} \renewcommand{\theglossarynum}{\theequation} \begin{equation} \erf(x) = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt \end{equation} \glossary{name=$\erf(x)$,description=Error function,sort=erf} \begin{equation} \erfc(x) = 1 - \erf(x) \end{equation} \glossary{name=$\erfc(x)$,description=Complementary error function,sort=erfc} \chapter{Beta Function} \begin{equation} B(x,y) = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt \end{equation} \glossary{name={$B(x,y)$},description=Beta function,sort=B} Alternatively: \begin{equation} B(x,y) = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi \end{equation} \glossary{name={$B(x,y)$},description=Beta function,sort=B} \begin{equation} B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) \end{equation} \glossary{name={$B(x,y)$},description=Beta function,sort=B} \begin{equation} B_x(p,q) = \int_0^x t^{p-1}(1-t)^{q-1}\,dt \end{equation} \glossary{name={$B_x(p,q)$},description=Incomplete beta function,sort=Bx} \chapter{Chebyshev's polynomials} \begin{equation} T_n(x) = \cos(n\arccos x) \end{equation} \glossary{name=$T_n(x)$,description=Chebyshev's polynomials of the first kind,sort=Tn} \begin{equation} U_n(x) = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} \end{equation} \glossary{name=$U_n(x)$,description=Chebyshev's polynomials of the second kind,sort=Un} \chapter{Hermite polynomials} \begin{equation} H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) \end{equation} \glossary{name=$H_n(x)$,description=Hermite polynomials,sort=Hn} \chapter{Laguerre polynomials} \begin{equation} L_n^{\alpha} (x) = \frac{1}{n!}e^x x^{-\alpha} \frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) \end{equation} \glossary{name=$L_n^\alpha(x)$,description=Laguerre polynomials,sort=Lna} \chapter{Bessel Functions} Bessel functions $Z_\nu(z)$ are solutions of \begin{equation} \frac{d^2Z_\nu}{dz^2} + \frac{1}{z}\,\frac{dZ_\nu}{dz} + \left( 1-\frac{\nu^2}{z^2}Z_\nu = 0 \right) \end{equation} \glossary{name=$Z_\nu(z)$,description=Bessel functions,sort=Z} \chapter{Confluent hypergeometric function} \begin{equation} \Phi(\alpha,\gamma;z) = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} + \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} +\frac{\alpha(\alpha+1)(\alpha+2)}{\gamma(\gamma+1)(\gamma+2)}\,\frac{z^3}{3!} + \cdots \end{equation} \glossary{name={$\Phi(\alpha,\gamma;z)$},description=confluent hypergeometric function,sort=Pagz} \begin{equation} k_\nu(x) = \frac{2}{\pi}\int_0^{\pi/2}\cos(x \tan\theta - \nu\theta)\,d\theta \end{equation} \glossary{name=$k_\nu(x)$,description=Bateman's function,sort=kv} \chapter{Parabolic cylinder functions} \begin{equation} D_p(z) = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} \left\{ \frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} \Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) -\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} \Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) \right\} \end{equation} \glossary{name=$D_p(z)$,description=Parabolic cylinder functions,sort=Dp} \chapter{Elliptical Integral of the First Kind} \begin{equation} F(\phi, k) = \int_0^\phi \frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} \end{equation} \glossary{name={$F(\phi,k)$},description=Elliptical integral of the first kind,sort=Fpk} \chapter{Constants} \begin{equation} C = 0.577\,215\,664\,901\ldots \end{equation} \glossary{name=$C$,description=Euler's constant,sort=C} \begin{equation} G = 0.915\,965\,594\ldots \end{equation} \glossary{name=$G$,description=Catalan's constant,sort=G} \end{document} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*sampleNtn.tex> % \end{macrocode} \documentclass{report} \usepackage[plainpages=false,colorlinks]{hyperref} \usepackage{html} \usepackage[toc]{glossary} \makeglossary \newglossarytype{notation}{not}{ntn} % 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={.}} \makenotation \begin{document} \title{Sample Document using glossary Package} \author{Nicola Talbot} \pagenumbering{alph} \maketitle \begin{abstract} \pagenumbering{Alph}%stop hyperref complaining about duplicate page identifiers This is a sample document illustrating the use of the \textsf{glossary} package. In this example, a new glossary type called \texttt{notation} is defined, so that the document can have a separate glossary of terms and index of notation. The index of notation doesn't have associated numbers. \end{abstract} \pagenumbering{roman} \tableofcontents \printglossary % Either of the following 2 commands will have % the same effect with LaTeX. Effect slightly % different with LaTeX2HTML. %\printnotation \printglossary[notation] \chapter{Introduction} \pagenumbering{arabic} Sets\glossary{name=set,description=A collection of distinct objects} are denoted by a caligraphic font e.g.\ $\mathcal{S}$% \notation{name=$\mathcal{S}$,description=A set,sort=S}. Let $\mathcal{U}$ denote the universal set\notation{name=$\mathcal{U}$,description={The universal set},sort=U}. The cardinality\glossary{name=cardinality,description=The number of elements in the specified set} of a set $\mathcal{S}$ is denoted $|\mathcal{S}|$% \notation{name=$\mid\mathcal{S}\mid$,description=cardinality of $\mathcal{S}$,sort=cardinality} \chapter{Next} Now for a hyperlink: \xnotation{name=$\mathcal{U}$,description={The universal set},sort=U}{$\mathcal{U}$}. \end{document} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*sampleNtn2.tex> % \end{macrocode} \documentclass{report} \usepackage[plainpages=false,colorlinks]{hyperref} \usepackage{html} \usepackage[toc]{glossary} \makeglossary \newglossarytype{notation}{not}{ntn} % 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={.}} \makenotation \begin{document} % Save details for later use (note the use of \protect): \storeglosentry[notation]{not:set}{name={$\protect\mathcal{S}$},description=A set,sort=S} \storeglosentry[notation]{not:U}{name=$\protect\mathcal{U}$,description={The universal set},sort=U} \storeglosentry[notation]{not:card}{name=$\mid\protect\mathcal{S}\mid$,description=cardinality of $\protect\mathcal{S}$,sort=cardinality} \storeglosentry{glos:set}{name=set,description=A collection of distinct objects} \storeglosentry{glos:card}{name=cardinality,description=The number of elements in the specified set} \title{Sample Document using glossary Package} \author{Nicola Talbot} \pagenumbering{alph} \maketitle \begin{abstract} \pagenumbering{Alph}%stop hyperref complaining about duplicate page identifiers This is a sample document illustrating the use of the \textsf{glossary} package. In this example, a new glossary type called \texttt{notation} is defined, so that the document can have a separate glossary of terms and index of notation. The index of notation doesn't have associated numbers. \end{abstract} \pagenumbering{roman} \tableofcontents \printglossary % Either of the following 2 commands will have % the same effect with LaTeX. Effect slightly % different with LaTeX2HTML. \printnotation %\printglossary[notation] \chapter{Introduction} \pagenumbering{arabic} Sets\useglosentry{glos:set} are denoted by a caligraphic font e.g.\ $\mathcal{S}$\useglosentry{not:set}. Let \gls{not:U} denote the universal set. The \gls{glos:card} of a set $\mathcal{S}$ is denoted \gls{not:card}. \end{document} % \begin{macrocode} % % \end{macrocode} % \begin{macrocode} %<*sampleSec.tex> % \end{macrocode} \documentclass{report} \usepackage[plainpages=false,colorlinks]{hyperref} \usepackage[style=altlist,toc,number=section]{glossary} \makeglossary % This just saves a bit of typing \storeglosentry{glos:I}{name=identity matrix,description=diagonal matrix with 1s along the leading diagonal} \begin{document} \pagenumbering{roman} \tableofcontents \printglossary \chapter{Introduction} \pagenumbering{arabic} This is a sample document illustrating the use of the \textsf{glossary} package. \chapter{Diagonal matrices} A diagonal matrix\glossary{name=diagonal matrix, description=matrix whose only non-zero entries are along the leading diagonal,format=hyperit} is a matrix where all elements not on the leading diagonal are zero. This is the primary definition, so an italic font is used for the page number. \newpage \section{Identity matrix} The identity matrix\glossary{name=identity matrix, description=diagonal matrix with 1s along the leading diagonal} \ldots Here is another entry for a diagonal matrix\glossary{name=diagonal matrix, description=matrix whose only non-zero entries are along the leading diagonal} \chapter{Singular Matrices} A singular matrix\glossary{name=singular matrix, description=matrix with zero determinant} \ldots Another \useGlosentry{glos:I}{identity matrix} entry. \end{document} % \begin{macrocode} % % \end{macrocode} %\Finale \endinput