diff options
author | Karl Berry <karl@freefriends.org> | 2006-07-10 22:34:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-07-10 22:34:51 +0000 |
commit | 102bce50404c6f184c8dcea9c9f3910081cd5589 (patch) | |
tree | 0884f04c8f57ebb931ec49dc171a8b2ed4983617 /Master/texmf-dist/tex | |
parent | 8abaae73c1bd5624110e77ebafcfba25e7d0694e (diff) |
glossary update (11jul06)
git-svn-id: svn://tug.org/texlive/trunk@1811 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/glossary/glossary.sty | 497 |
1 files changed, 331 insertions, 166 deletions
diff --git a/Master/texmf-dist/tex/latex/glossary/glossary.sty b/Master/texmf-dist/tex/latex/glossary/glossary.sty index b1fa2e9fd8b..828fab35f26 100644 --- a/Master/texmf-dist/tex/latex/glossary/glossary.sty +++ b/Master/texmf-dist/tex/latex/glossary/glossary.sty @@ -5,7 +5,7 @@ %% The original source files were: %% %% glossary.dtx (with options: `glossary.sty,package') -%% Copyright (C) 2005 Nicola Talbot, all rights reserved. +%% Copyright (C) 2006 Nicola Talbot, all rights reserved. %% If you modify this file, you must change its name first. %% You are NOT ALLOWED to distribute this file alone. You are NOT %% ALLOWED to take money for the distribution or use of either this @@ -27,7 +27,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossary}[2005/09/27 2.24 (NLCT)] +\ProvidesPackage{glossary}[2006/07/09 2.38 (NLCT)] \RequirePackage{ifthen} \RequirePackage{keyval} \define@key{gloss} @@ -100,7 +100,14 @@ \newif\ifglsacronym \define@key{gloss}{acronym}[true]{\ifthenelse{\equal{#1}{true} \or \equal{#1}{false}}{\setboolean{glsacronym}{#1}}{% -\PackageError{glossary}{Glossary option 'acronym' is boolean}{The value of 'acronym' canonly be set to 'true' or 'false'}}} +\PackageError{glossary}{Glossary option 'acronym' is boolean}{The +value of 'acronym' can only be set to 'true' or 'false'}}} + +\newif\ifglsglobal +\define@key{gloss}{global}[true]{\ifthenelse{\equal{#1}{true}\or +\equal{#1}{false}}{\setboolean{glsglobal}{#1}}{% +\PackageError{glossary}{Glossary option 'global' is boolean}{The +value of 'global' can only be set to 'true' or 'false'}}} \def\gls@style{long} \def\gls@header{none} \def\gls@border{none} @@ -119,7 +126,7 @@ \@ifundefined{xspace}{% \let\glsxspace\relax}{% \let\glsxspace\xspace} -\newcommand{\gls@noxspace}[1]{{\let\glsxspace\relax#1}} +\let\glossaryalignment\relax \newcommand{\glossarypackageoptions}[1]{\setkeys{gloss}{#1}} \InputIfFileExists{glossary.cfg}{% \typeout{Glossary configuration file loaded}}{% @@ -131,8 +138,13 @@ \ifthenelse{\equal{\CurrentOption}{}}{}{\@pkg@ptions}} \ProcessOptions -\ifthenelse{\(\equal{\gls@style}{list} \or \equal{\gls@style}{altlist}\) \and \(\not\equal{\gls@header}{none} \or \not\equal{\gls@border}{none} \or \gls@cols=3\)} -{\PackageError{glossary}{You can't have option 'style=list' or 'style=altlist' in combination with any of the other options} +\ifthenelse{\(\equal{\gls@style}{list} \or +\equal{\gls@style}{altlist}\) \and +\(\not\equal{\gls@header}{none} \or \not\equal{\gls@border}{none} +\or \gls@cols=3\)} +{\PackageError{glossary}{You can't have option 'style=list' or +'style=altlist' in combination with any of the other style +options} {The 'list' and 'altlist' options don't have a header, border or number of columns option.}} {} \ifthenelse{\boolean{gls@hypertoc} \and \boolean{gls@toc}}{% @@ -166,25 +178,42 @@ \newcommand{\@gls@getn@me}[1]{\@bsphack\begingroup\@sanitize \gdef\@glo@n@me{}\setkeys{wrgloss}{#1}\relax \endgroup\@esphack} +\newcommand{\@gls@getdescr}[1]{% +\@bsphack\begingroup\@sanitize +\protected@edef\@gls@dos@tk@y{\noexpand\setkeys{wrgloss}{#1}}% +\def\@descr{}\@gls@dos@tk@y\relax +\global\let\@glo@desc\@descr +\endgroup\@esphack +} \newcommand{\xglossary}{\renewcommand{\@@wrglossary}[1]{% \glossref{\@glo@l@bel}{##1}\renewcommand{\@@wrglossary}{}}% \glossary} +\newcommand*{\@glo@label@list}{} +\toksdef\gls@ta=0 \toksdef\gls@tb=2 +\newcommand{\@glo@label@addtolist}[1]{% +\gls@ta={{#1}}\gls@tb=\expandafter{\@glo@label@list}% +\xdef\@glo@label@list{\the\gls@ta,\the\gls@tb}} \newcommand*{\storeglosentry}[3][glossary]{% +\ifthenelse{\equal{#2}{*}}{% +\PackageError{glossary}{Glossary label '*' invalid}{You can't have +a glossary entry with a * as the label}}{% \@ifundefined{glo@#2@entry}{% +\@glo@label@addtolist{#2}% \expandafter\def\csname glo@#2@type\endcsname{#1}% \expandafter\def\csname glo@#2@entry\endcsname{#3}% \@gls@getn@me{#3}% \expandafter\protected@edef\csname glo@#2@name\endcsname{\@glo@n@me}% }{% \PackageError{glossary}{Glossary entry '#2' already -defined}{There already exists a glossary entry with the label '#2'}}% +defined}{There already exists a glossary entry with the label '#2'}}}% } - \providecommand{\useglosentry}[2][\relax]{% +\ifthenelse{\equal{#2}{*}}{\@for\@glolab:=\@glo@label@list\do{% +\ifthenelse{\equal{\@glolab}{}}{}{\useglosentry[#1]{\@glolab}}}}{% \@ifundefined{glo@#2@type}{% \PackageError{glossary}{Glossary entry '#2' undefined}{You need to define the entry using \string\storeglosentry\space before -using it.}}{% +using it.}}{{% \edef\@glostype{\csname glo@#2@type\endcsname}% \ifx#1\relax \protected@edef\@glo@cmd{\expandafter\noexpand\csname \@glostype\endcsname{\csname glo@#2@entry\endcsname}}% @@ -192,13 +221,12 @@ using it.}}{% \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.}}{% +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}}% @@ -206,8 +234,7 @@ using it.}}{% \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}} \providecommand{\saveglosentry}[3][glossary]{% \expandafter\def\csname glo@#2@type\endcsname{#1}% @@ -247,12 +274,19 @@ using it.}}{% \def\@glostype{glossary} \newcommand{\delimN}{\csname @\@glostype @delimN\endcsname} \newcommand{\delimR}{\csname @\@glostype @delimR\endcsname} -\newcommand{\glodelim}{\csname @\@glostype @glodelim\endcsname} +\newcommand{\gloitem}{\csname @\@glostype @gloitem\endcsname} +\newcommand{\gloskip}{\csname @\@glostype @gloskip\endcsname} +\newcommand{\delimT}{\glsafternum +\csname @\@glostype @delimT\endcsname} +\newcommand{\glodelim}{\csname @\@glostype @glodelim\endcsname +\glsbeforenum} \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}{delimT}{\def\@delimT{#1}} +\define@key{glossnum}{gloskip}{\def\@gloskip{#1}} \define@key{glossnum}{glodelim}{\def\@glodelim{#1}} \providecommand{\ignore}[1]{} @@ -261,6 +295,8 @@ using it.}}{% \def\@glsnumtype{glossary}% \def\@delimN{@dontchange@}% \def\@delimR{@dontchange@}% +\def\@delimT{@dontchange@}% +\def\@gloskip{@dontchange@}% \def\@glodelim{@dontchange@}% \setkeys{glossnum}{#1}\relax \@ifundefined{print\@glsnumtype}{% @@ -275,19 +311,22 @@ Glossary type '\@glsnumtype' has not been defined} \expandafter\xdef\csname @\@glsnumtype @delimR\endcsname{}% }{}% }% - \ifthenelse{\equal{\@delimN}{@dontchange@}}{}{% \expandafter\xdef\csname @\@glsnumtype @delimN\endcsname{% -\@delimN}} - +\@delimN}}% \ifthenelse{\equal{\@delimR}{@dontchange@}}{}{% \expandafter\xdef\csname @\@glsnumtype @delimR\endcsname{% -\@delimR}} - +\@delimR}}% +\ifthenelse{\equal{\@delimT}{@dontchange@}}{}{% +\expandafter\xdef\csname @\@glsnumtype @delimT\endcsname{% +\@delimT}}% +\ifthenelse{\equal{\@gloskip}{@dontchange@}}{}{% +\expandafter\xdef\csname @\@glsnumtype @gloskip\endcsname{% +\@gloskip}}% \ifthenelse{\equal{\@glodelim}{@dontchange@}}{}{% \expandafter\xdef\csname @\@glsnumtype @glodelim\endcsname{% -\@glodelim} -} +\@glodelim}% +}% }} \newcommand{\@gls@glossary@inext}{gls} \newcommand\printglossary[1][glossary]{% @@ -307,30 +346,49 @@ Glossary type '\@glsnumtype' has not been defined} \def\@glossaryname{\glossaryname} \def\@shortglossaryname{\shortglossaryname} \providecommand{\glossarytitle}{% -\@ifundefined{chapter} -{\section*{\@glossaryname}\relax - \ifgls@toc\@glosaddtoc{section}\fi} -{\ifthenelse{\boolean{gls@section}} - {\section*{\@glossaryname}\relax - \ifgls@toc\@glosaddtoc{section}\fi} - {\ifgls@hypertoc\@ifundefined{if@twoside}{\clearpage}{% - \if@twoside\@ifundefined{cleardoublepage}{\cleardoublepage}{\clearpage}\else - \clearpage\fi}\phantomsection\@glosaddtoc{chapter}\fi\chapter*{\@glossaryname}\relax - \ifgls@toc\@glosaddtoc{chapter}\fi}} +\@ifundefined{chapter}% +{% +\ifgls@hypertoc +\phantomsection% add anchor before \section* +\@glosaddtoc{section}% +\section*{\@glossaryname}\relax +\else +\section*{\@glossaryname}\relax +\ifgls@toc\@glosaddtoc{section}\fi +\fi}% +{% \chapter defined +\ifthenelse{\boolean{gls@section}}% +{% user requested \section +\ifgls@hypertoc +\phantomsection% add anchor before \section* +\@glosaddtoc{section}% +\section*{\@glossaryname}\relax +\else +\section*{\@glossaryname}\relax +\ifgls@toc\@glosaddtoc{section}\fi +\fi}% +{% use \chapter +\ifgls@hypertoc +\@ifundefined{if@twoside}{% +\clearpage}{% +\if@twoside +\@ifundefined{cleardoublepage}{\clearpage}{\cleardoublepage}% +\else +\clearpage +\fi}% +\phantomsection% add anchor before \chapter +\@glosaddtoc{chapter}% +\fi +\chapter*{\@glossaryname}\relax +\ifgls@toc\@glosaddtoc{chapter}\fi}} \markboth{\@shortglossaryname}{\@shortglossaryname}% } -\@ifundefined{theglossary}{ -\newenvironment{theglossary} -{\glossarytitle - \glossarypreamble\@bef@reglos} - {\@ftergl@s\glossarypostamble} -}{% -\PackageWarning{glossary}{Redefining 'theglossary' environment} -\renewenvironment{theglossary} -{\glossarytitle - \glossarypreamble\@bef@reglos} - {\@ftergl@s\glossarypostamble} -} +\@ifundefined{theglossary}{% +\newenvironment{theglossary}{}{}}{% +\PackageWarning{glossary}{Redefining 'theglossary' environment}} +\renewenvironment{theglossary}{% +\glossarytitle +\glossarypreamble\@bef@reglos}{\@ftergl@s\glossarypostamble} \newcommand{\glossarypreamble}{} \newcommand{\glossarypostamble}{} \newcommand{\@glosaddtoc}[1]{% @@ -340,18 +398,53 @@ Glossary type '\@glsnumtype' has not been defined} \newif\ifgloitemfirst \newcommand{\@bef@reglos}{\global\gloitemfirsttrue\beforeglossary} \newcommand{\@ftergl@s}{\afterglossary\global\gloitemfirstfalse} - -\ifthenelse{\equal{\gls@style}{list} \or \equal{\gls@style}{altlist}} -{ -\newcommand{\beforeglossary}{\begin{description}} -\newcommand{\afterglossary}{\end{description}} -\newcommand{\gloskip}{\indexspace} -\ifthenelse{\equal{\gls@style}{list}} - {\newcommand{\gloitem}[1]{\item[#1]} - \newcommand{\@glossary@glodelim}{, }} - {\newcommand{\gloitem}[1]{\item[#1]\mbox{}\par} - \newcommand{\@glossary@glodelim}{ }} -}{ +\newcommand{\glossaryalignment}{\relax} +\newcommand{\@gls@align@glossary}{} +\newcommand{\glosstail}{% +\@ifundefined{@gls@tail@\@glostype}{% +\PackageError{glossary}{No glossary tail defined for glossary +type '\@glostype'}{}}{% +\csname @gls@tail@\@glostype\endcsname}} +\newcommand{\@gls@tail@glossary}{} +\newcommand{\afterglossary}{% +\@ifundefined{@gls@afterglos@\@glostype}{% +\PackageError{glossary}{No after glossary defined for glossary +type '\@glostype'}{}}{% +\csname @gls@afterglos@\@glostype\endcsname}} +\newcommand{\beforeglossary}{% +\@ifundefined{@gls@beforeglos@\@glostype}{% +\PackageError{glossary}{No before glossary defined for glossary +type '\@glostype'}{}}{% +\csname @gls@beforeglos@\@glostype\endcsname}} +\newcommand{\@gls@beforeglos@glossary}{} +\newcommand{\@gls@afterglos@glossary}{} +\newcommand{\@glossary@glodelim}{} +\newcommand{\@glossary@delimT}{} +\newcommand{\glsafternum}{} +\newcommand{\glsbeforenum}{} +\newcommand{\@glossary@gloskip}{} +\newcommand{\@glossary@gloitem}[1]{#1} +\newcommand{\gls@setlist}[1][glossary]{% +\expandafter\def\csname @gls@beforeglos@#1\endcsname{% +\begin{description}}% +\expandafter\def\csname @gls@afterglos@#1\endcsname{% +\end{description}}% +\expandafter\def\csname @#1@gloskip\endcsname{\indexspace}% +\expandafter\def\csname @#1@glodelim\endcsname{, }% +\expandafter\def\csname @#1@gloitem\endcsname##1{\item[##1]}% +\expandafter\def\csname @#1@glodelim\endcsname{, }% +\expandafter\def\csname @#1@delimT\endcsname{} +} +\newcommand{\gls@setaltlist}[1][glossary]{% +\expandafter\def\csname @gls@beforeglos@#1\endcsname{% +\begin{description}}% +\expandafter\def\csname @gls@afterglos@#1\endcsname{% +\end{description}}% +\expandafter\def\csname @#1@gloskip\endcsname{\indexspace}% +\expandafter\def\csname @#1@gloitem\endcsname##1{\item[##1]\mbox{}\nopagebreak\par\nopagebreak}% +\expandafter\def\csname @#1@glodelim\endcsname{ }% +\expandafter\def\csname @#1@delimT\endcsname{} +} \ifthenelse{\equal{\gls@style}{super}}{ \IfFileExists{supertab.sty}{\RequirePackage{supertab}} {\IfFileExists{supertabular.sty}{\RequirePackage{supertabular}} @@ -359,102 +452,147 @@ Glossary type '\@glsnumtype' has not been defined} {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 }} +\newcommand*{\glossaryheader}{\relax} +\newcommand{\@glossaryheader}{% +\ifx\glossaryheader\relax +\csname @\@glostype @header\endcsname +\else +\glossaryheader +\fi } -{ +\newcommand{\gls@setheader}[1][glossary]{% +\ifthenelse{\equal{\gls@header}{none}}% +{% +\ifthenelse{\equal{\gls@border}{none}} +{\expandafter\def\csname @#1@header\endcsname{}% +}{\expandafter\def\csname @#1@header\endcsname{\hline}}% +}{% \ifnum\gls@cols=2\relax - \ifthenelse{\equal{\gls@border}{none}} - {\newcommand{\glossaryheader} - {\bfseries\entryname & \bfseries \descriptionname\\}} - {\newcommand{\glossaryheader} - {\hline\bfseries\entryname & \bfseries\descriptionname - \\\hline\hline}} +\ifthenelse{\equal{\gls@border}{none}} +{% +\expandafter\def\csname @#1@header\endcsname{% +\bfseries\entryname & \bfseries \descriptionname\\}}% +{% +\expandafter\def\csname @#1@header\endcsname{% +\hline\bfseries\entryname & \bfseries\descriptionname +\\\hline\hline}}% \else - \ifthenelse{\equal{\gls@border}{none}} - {\newcommand{\glossaryheader} - {\bfseries\entryname & \bfseries \descriptionname & \\}} - {\newcommand{\glossaryheader} - {\hline\bfseries\entryname &\bfseries\descriptionname & - \\\hline\hline}} +\ifthenelse{\equal{\gls@border}{none}} +{% +\expandafter\def\csname @#1@header\endcsname{% +\bfseries\entryname & \bfseries \descriptionname & \\}}% +{% +\expandafter\def\csname @#1@header\endcsname{% +\hline\bfseries\entryname &\bfseries\descriptionname & +\\\hline\hline}}% \fi -} - +}} +\newcommand{\gls@setalignment}[1][glossary]{% \ifthenelse{\equal{\gls@border}{none}} { \ifnum\gls@cols=2\relax - \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}}}{ - \newcolumntype{G}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}}} +\expandafter\def\csname @gls@align@#1\endcsname{% +@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}} \else - \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l}}{ - \newcolumntype{G}{@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l}} +\expandafter\def\csname @gls@align@#1\endcsname{% +@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l} \fi - - \ifthenelse{\equal{\gls@style}{super}}{ - \newcommand{\afterglossary}{ \\\end{supertabular}} - } - { - \newcommand{\afterglossary}{ \\\end{longtable}} - } - - \newcommand{\glosstail}{} -} -{ +\expandafter\def\csname @gls@tail@#1\endcsname{}% +}{% \ifnum\gls@cols=2\relax - \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}}{ - \newcolumntype{G}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}|}} +\expandafter\def\csname @gls@align@#1\endcsname{% +|@{\hspace{\tabcolsep}\bfseries +}lp{\descriptionwidth}|} \else - \@ifundefined{newcolumntype}{\newcommand{\glossaryalignment}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l|}}{ - \newcolumntype{G}{|@{\hspace{\tabcolsep}\bfseries}lp{\descriptionwidth}l|}} +\expandafter\def\csname @gls@align@#1\endcsname{% +|@{\hspace{\tabcolsep}\bfseries +}lp{\descriptionwidth}l|} \fi - - \ifthenelse{\equal{\gls@style}{super}}{ - \newcommand{\afterglossary}{ \\\hline\end{supertabular}} - } - { - \newcommand{\afterglossary}{ \\\hline\end{longtable}} - } - - \newcommand{\glosstail}{\hline} -} - -\ifthenelse{\equal{\gls@style}{super}} -{ - \@ifundefined{newcolumntype}{ - \newcommand{\beforeglossary} - {\tablehead{\glossaryheader}\tabletail{\glosstail} - \begin{supertabular}{\glossaryalignment}}} - {\newcommand{\beforeglossary} - {\tablehead{\glossaryheader}\tabletail{\glosstail} - \begin{supertabular}{G}}} +\expandafter\def\csname @gls@tail@#1\endcsname{\hline}% +}% +\expandafter\def\csname @#1@delimT\endcsname{\\} +\ifnum\gls@cols=2\relax +\expandafter\def\csname @#1@gloskip\endcsname{& \\}% +\expandafter\def\csname @#1@glodelim\endcsname{, }% +\else +\expandafter\def\csname @#1@gloskip\endcsname{& & \\}% +\expandafter\def\csname @#1@glodelim\endcsname{& }% +\fi +\expandafter\def\csname @#1@gloitem\endcsname##1{##1 &}% } -{ - \@ifundefined{newcolumntype}{\newcommand{\beforeglossary} - {\begin{longtable}{\glossaryalignment} - \glossaryheader\endhead\glosstail\endfoot}} - {\newcommand{\beforeglossary} - {\begin{longtable}{G} - \glossaryheader\endhead\glosstail\endfoot}} +\newcommand{\@st@rtglostable}[2]{% +\gls@ta={\begin{#1}}\gls@tb=\expandafter{#2}% +\edef\@st@rtglost@ble{\the\gls@ta{\the\gls@tb}} +\@st@rtglost@ble} +\newcommand{\gls@setsuper}[1][glossary]{% +\gls@setalignment[#1]% +\gls@setheader[#1]% +\expandafter\def\csname @gls@beforeglos@#1\endcsname{% +\tablehead{\@glossaryheader}\tabletail{\glosstail}% +\if\glossaryalignment\relax +\expandafter\let\expandafter\@glossaryalignment\csname @gls@align@#1\endcsname +\else +\let\@glossaryalignment\glossaryalignment +\fi +\@st@rtglostable{supertabular}\@glossaryalignment} +\expandafter\def\csname @gls@afterglos@#1\endcsname{% +\end{supertabular}}% } - -\ifnum\gls@cols=2\relax -\newcommand{\gloskip}{\ifgloitemfirst\global\gloitemfirstfalse \else\\ \fi &} -\newcommand{\@glossary@glodelim}{, } +\newcommand{\gls@setlong}[1][glossary]{% +\gls@setalignment[#1]% +\gls@setheader[#1]% +\expandafter\def\csname @gls@beforeglos@#1\endcsname{% +\if\relax\glossaryalignment +\expandafter\let\expandafter\@glossaryalignment\csname @gls@align@#1\endcsname \else -\newcommand{\gloskip}{\ifgloitemfirst\global\gloitemfirstfalse \else\\ \fi & &} -\newcommand{\@glossary@glodelim}{& } +\let\@glossaryalignment\glossaryalignment \fi -\newcommand{\gloitem}[1]{\ifgloitemfirst\global\gloitemfirstfalse #1 \else \\#1 \fi &} +\@st@rtglostable{longtable}{\@glossaryalignment} +\@glossaryheader\endhead\glosstail\endfoot} + +\expandafter\def\csname @gls@afterglos@#1\endcsname{% +\end{longtable}}% } +\newcommand{\@setglossarystyle}[1][glossary]{% +\@ifundefined{gls@set\gls@style}{% +\PackageError{glossary}{Glossary style '\gls@style' undefined}{}}{% +\csname gls@set\gls@style\endcsname[#1]}} +\@setglossarystyle +\define@key{glosstyle} + {style} + {\ifthenelse{\equal{#1}{list} \or \equal{#1}{altlist} \or \equal{#1}{super} \or \equal{#1}{long}} + {\def\gls@style{#1}} + {\PackageError{glossary} + {Unknown glossary style '#1'} + {Available styles are: list, altlist, super and long}}} + +\define@key{glosstyle} + {header}[plain]{\ifthenelse{\equal{#1}{none} \or \equal{#1}{plain}} + {\def\gls@header{#1}} + {\PackageError{glossary} + {Unknown glossary style '#1'} + {Available styles are: none and plain}}} -\ifthenelse{\equal{\gls@number}{none} \and \gls@cols<3}{\renewcommand{\@glossary@glodelim}{}}{} +\define@key{glosstyle} + {border}[plain]{\ifthenelse{\equal{#1}{none} \or \equal{#1}{plain}} + {\def\gls@border{#1}} + {\PackageError{glossary} + {Unknown glossary border '#1'} + {Available styles are: none and plain}}} +\define@key{glosstyle}{cols}{\gls@cols=#1\relax +\ifthenelse{\gls@cols<2 \or \gls@cols>3} + {\PackageError{glossary} + {invalid number of columns} + {The cols option can only be 2 or 3}} + {}} +\newcommand{\setglossarystyle}[2][glossary]{% +\setkeys{glosstyle}{#2}% +\@setglossarystyle[#1]% +} +\ifthenelse{\equal{\gls@number}{none} \and \gls@cols<3}{% +\renewcommand{\@glossary@glodelim}{}}{} \newif\ifist \let\noist=\istfalse \if@filesw\isttrue\else\istfalse\fi @@ -473,6 +611,7 @@ Glossary type '\@glsnumtype' has not been defined} \write\istfile{page_compositor "\pagecompositor"} \write\istfile{delim_n "\string\\delimN "} \write\istfile{delim_r "\string\\delimR "} +\write\istfile{delim_t "\string\\delimT "} \closeout\istfile } \catcode`\%14\relax @@ -496,7 +635,6 @@ Glossary type '\@glsnumtype' has not been defined} \expandafter\gdef\csname glsX\@glstype Xnumformat\endcsname{\glsXglossaryXnumformat}% \expandafter\gdef\csname @\@glstype @delimN\endcsname{\@glossary@delimN}% \expandafter\gdef\csname @\@glstype @delimR\endcsname{\@glossary@delimR}% -\expandafter\gdef\csname @\@glstype @glodelim\endcsname{\@glossary@glodelim}% \expandafter\gdef\csname @gls@\@glstype @inext\endcsname{#4}% \expandafter\def\csname @gls@#2@type\endcsname{#4}% \expandafter\edef\csname make\@glstype\endcsname{% @@ -517,12 +655,14 @@ Glossary type '\@glsnumtype' has not been defined} }{% \noexpand\edef\noexpand\@shortglossaryname{% \noexpand\csname short\@glstype name\noexpand\endcsname}}% -\noexpand\@prntgl@ss@ry{\@glsin}} +\noexpand\@prntgl@ss@ry{\@glsin}}% }{\PackageError{glossary}{Command \expandafter\string\csname #2\endcsname \space already defined}{% You can't call your new glossary type '#2' because there already -exists a command with this name}} -} +exists a command with this name}}% +\@@n@wglostype} +\newcommand{\@@n@wglostype}[1][]{% +\setglossarystyle[\@glstype]{#1}} \newcommand\@m@kegl@ss[2]{ \expandafter\newwrite\csname @#1file\endcsname \expandafter\immediate\expandafter @@ -579,65 +719,72 @@ exists a command with this name}} \newcommand{\glsprimaryfmt}[1]{\textbf{\glsnumformat{#1}}} \newcommand{\@acronymnamefmt}{\glolong\ (\gloshort)} \newcommand{\setacronymnamefmt}[1]{\def\@acronymnamefmt{#1}} +\newcommand{\@acronymdescfmt}{\glodesc} +\newcommand{\setacronymdescfmt}[1]{\def\@acronymdescfmt{#1}} \newcommand{\acronymfont}[1]{#1} \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 @nx@short\endcsname{#2} \expandafter\newcommand\csname\@acrnmcmd long\endcsname{#3\protect\glsxspace} +\expandafter\newcommand\csname\@acrnmcmd @nx@long\endcsname{#3} \def\@acrn@entry{#4} { +\@gls@getdescr{\@acrn@entry}% +\let\glodesc\@glo@desc% \def\glolong{#3}% \def\gloshort{\noexpand\acronymfont{#2}}% \expandafter\protected@xdef\expandafter\@acrnamefmt{\@acronymnamefmt} +\expandafter\protected@xdef\expandafter\@acrdesc{\@acronymdescfmt} } \@acr@addtolist{\@acrnmcmd} -\protected@edef\@acr@glsentry{name=\@acrnamefmt,format=glsnumformat,sort=\@acrnmcmd,\@acrn@entry} +\protected@edef\@acr@glsentry{name={\@acrnamefmt},format=glsnumformat,sort={\@acrnmcmd},\@acrn@entry,description={\@acrdesc}} \newboolean{\@acrnmcmd first}\setboolean{\@acrnmcmd first}{true} \expandafter\protected@edef\csname \@acrnmcmd\endcsname{\noexpand\@ifstar{\csname @s@\@acrnmcmd\endcsname}{\csname @\@acrnmcmd\endcsname}} -\ifglshyperacronym +\ifglshyperacronym % hyperlinks \expandafter\protected@edef\csname @\@acrnmcmd\endcsname{% \noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{% -\noexpand\gls@noxspace{\csname\@acrnmcmd long\endcsname\noexpand\@acrnmins\ +\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\ (\noexpand\xacronym{\@acr@glsentry}{% -\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% -})}\noexpand\setboolean{\@acrnmcmd first}{false}% +\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}% +})\noexpand\unsetacronym{\@acrnmcmd}% }{\noexpand\xacronym{\@acr@glsentry}{% -\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}\noexpand\@acrnmins}}\noexpand\glsxspace} +\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}\noexpand\@acrnmins}}\noexpand\glsxspace} \expandafter\protected@edef\csname @s@\@acrnmcmd\endcsname{% \noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{% -\noexpand\gls@noxspace{\noexpand\expandafter\noexpand\MakeUppercase -\csname\@acrnmcmd long\endcsname\noexpand\@acrnmins\ +\noexpand\expandafter\noexpand\MakeUppercase +\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\ (\noexpand\xacronym{\@acr@glsentry}{% -\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% -})}% -\noexpand\setboolean{\@acrnmcmd first}{false}}{% +\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}% +})% +\noexpand\unsetacronym{\@acrnmcmd}}{% \noexpand\xacronym{\@acr@glsentry}{% \noexpand\acronymfont{\noexpand\expandafter\noexpand\MakeUppercase -\csname\@acrnmcmd short\endcsname}% +\csname\@acrnmcmd @nx@short\endcsname}% \noexpand\@acrnmins}}\noexpand\glsxspace} -\else +\else % no hyperlinks \expandafter\protected@edef\csname @\@acrnmcmd\endcsname{% \noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{% -\noexpand\gls@noxspace{\csname\@acrnmcmd long\endcsname\ +\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\ (\noexpand\acronym{\@acr@glsentry}{% -\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% -})}\noexpand\setboolean{\@acrnmcmd first}{false}% +\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}% +})\noexpand\unsetacronym{\@acrnmcmd}% }{\noexpand\acronym{\@acr@glsentry}{% -\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}}}% +\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}\noexpand\@acrnmins}}% \noexpand\glsxspace} \expandafter\protected@edef\csname @s@\@acrnmcmd\endcsname{% \noexpand\ifthenelse{\noexpand\boolean{\@acrnmcmd first}}{% -\noexpand\gls@noxspace{\noexpand\expandafter +\noexpand\expandafter \noexpand\MakeUppercase -\csname\@acrnmcmd long\endcsname\noexpand\@acrnmins\ +\csname\@acrnmcmd @nx@long\endcsname\noexpand\@acrnmins\ (\noexpand\acronym{\@acr@glsentry}{% -\noexpand\acronymfont{\csname\@acrnmcmd short\endcsname}% -})}% -\noexpand\setboolean{\@acrnmcmd first}{false}}{% +\noexpand\acronymfont{\csname\@acrnmcmd @nx@short\endcsname}% +})% +\noexpand\unsetacronym{\@acrnmcmd}}{% \noexpand\acronym{\@acr@glsentry}{% \noexpand\acronymfont{\noexpand\expandafter\noexpand\MakeUppercase -\csname\@acrnmcmd short\endcsname}% +\csname\@acrnmcmd @nx@short\endcsname}% \noexpand\@acrnmins}}\noexpand\glsxspace} \fi }{% @@ -656,21 +803,23 @@ The command name specified by \string\newacronym already exists.}}} \newcommand{\@acrln}[1]{\@ifundefined{#1long}{% \PackageError{glossary}{Acronym '#1' has not been defined}{}}{% -\gls@noxspace{\csname#1long\endcsname}}} +\csname#1@nx@long\endcsname}} \newcommand{\@sacrln}[1]{\@ifundefined{#1long}{% \PackageError{glossary}{Acronym '#1' has not been defined}{}}{% -\gls@noxspace{\expandafter\expandafter\expandafter -\MakeUppercase\csname#1long\endcsname}}} +\expandafter\expandafter\expandafter +\MakeUppercase\csname#1@nx@long\endcsname}} \newcommand{\acrsh}{\@ifstar\@sacrsh\@acrsh} \newcommand{\@acrsh}[1]{\@ifundefined{#1short}{% -\PackageError{glossary}{Acronym '#1' has not been defined}{}}{\acronymfont{\gls@noxspace{\csname#1short\endcsname}}}} +\PackageError{glossary}{Acronym '#1' has not been defined}{}}{% +\acronymfont{\csname#1@nx@short\endcsname}}} \newcommand{\@sacrsh}[1]{\@ifundefined{#1short}{% \PackageError{glossary}{Acronym '#1' has not been defined}{}}{% -\acronymfont{\gls@noxspace{\expandafter\expandafter\expandafter\MakeUppercase\csname#1short\endcsname}}}} +\acronymfont{\expandafter\expandafter\expandafter +\MakeUppercase\csname#1@nx@short\endcsname}}} \newcommand{\ifacronymfirstuse}[3]{% \@ifundefined{if#1first}{% @@ -680,10 +829,26 @@ The command name specified by \string\newacronym already exists.}}} \newcommand{\resetacronym}[1]{% \@ifundefined{if#1first}{% \PackageError{glossary}{Acronym '#1' not defined}{}}{% -\setboolean{#1first}{true}}} +\ifglsglobal +\expandafter\global\csname #1firsttrue\endcsname +\else +\setboolean{#1first}{true}% +\fi}} + +\newcommand{\unsetacronym}[1]{% +\@ifundefined{if#1first}{% +\PackageError{glossary}{Acronym '#1' not defined}{}}{% +\ifglsglobal +\expandafter\global\csname #1firstfalse\endcsname +\else +\setboolean{#1first}{false}% +\fi}} \newcommand{\resetallacronyms}{% \@for\@acr:=\@acr@list\do{\resetacronym{\@acr}}} + +\newcommand{\unsetallacronyms}{% +\@for\@acr:=\@acr@list\do{\unsetacronym{\@acr}}} \ifglshyper \def\glshyperpage#1{\@glshyperpage#1\delimR \delimR \\} \def\@glshyperpage#1\delimR #2\delimR #3\\{% @@ -751,7 +916,7 @@ The command name specified by \string\newacronym already exists.}}} \fi \ifglsacronym \newglossarytype[alg]{acronym}{acr}{acn} -\newcommand{\acronymname}{List of Acronyms} +\providecommand{\acronymname}{List of Acronyms} \else \let\acronym=\glossary \let\xacronym=\xglossary |