diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty | 1023 |
1 files changed, 889 insertions, 134 deletions
diff --git a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty index 0209e843f0c..9c488642eef 100644 --- a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty +++ b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, mfirstuc.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossaries-babel.sty, glossaries-dictionary-Danish.dict, glossaries-dictionary-Dutch.dict, glossaries-dictionary-English.dict, glossaries-dictionary-French.dict, glossaries-dictionary-German.dict, glossaries-dictionary-Irish.dict, glossaries-dictionary-Italian.dict, glossaries-dictionary-Magyar.dict, glossaries-dictionary-Polish.dict, glossaries-dictionary-Spanish.dict, minimalgls.tex, sample.tex, sample4col.tex, sampleAcr.tex, sampleAcrDesc.tex, sampleDB.tex, sampleDesc.tex, sampleEq.tex, sampleEqPg.tex, sampleNtn.tex, sampleSec.tex, database1.tex, database2.tex, glossaries.perl. +%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, mfirstuc.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossary-tree.sty, glossaries-babel.sty, glossaries-dictionary-Brazil.dict, glossaries-dictionary-Danish.dict, glossaries-dictionary-Dutch.dict, glossaries-dictionary-English.dict, glossaries-dictionary-French.dict, glossaries-dictionary-German.dict, glossaries-dictionary-Irish.dict, glossaries-dictionary-Italian.dict, glossaries-dictionary-Magyar.dict, glossaries-dictionary-Polish.dict, glossaries-dictionary-Spanish.dict, minimalgls.tex, sample.tex, sample4col.tex, sampleAcr.tex, sampleAcrDesc.tex, sampleDB.tex, sampleDesc.tex, sampleEq.tex, sampleEqPg.tex, sampleNtn.tex, sampleSec.tex, sampletree.tex, sampleutf8.tex, samplexdy.tex, samplexdy-mc.xdy, database1.tex, database2.tex, glossaries.perl. %% %% \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 @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries}[2008/08/27 v1.16 (NLCT)] +\ProvidesPackage{glossaries}[2008/12/26 v1.17 (NLCT)] \RequirePackage{ifthen} \RequirePackage{xkeyval}[2006/11/18] \RequirePackage{mfirstuc} @@ -133,12 +133,49 @@ name=true]{% \renewcommand*{\@gls@sanitizesymbol}{}% } \define@boolkey{glossaries.sty}[glsacr]{shortcuts}[true]{} +\newcommand*{\glsorder}{word} +\newcommand*{\@glsorder}[1]{} +\define@choicekey{glossaries.sty}{order}{word,letter}{% + \def\glsorder{#1}} +\newif\ifglsxindy +\glsxindyfalse +\DeclareOptionX{makeindex}{\glsxindyfalse} +\define@boolkey[gls]{xindy}{glsnumbers}[true]{} +\gls@xindy@glsnumberstrue +\def\@xdy@main@language{\rootlanguagename}% +\define@key[gls]{xindy}{language}{\def\@xdy@main@language{#1}} +\@ifundefined{inputencodingname}{% + \def\gls@codepage{}}{% + \def\gls@codepage{\inputencodingname} +} +\define@key[gls]{xindy}{codepage}{\def\gls@codepage{#1}} +\define@key{glossaries.sty}{xindy}[]{% + \glsxindytrue + \setkeys[gls]{xindy}{#1}% +} \ProcessOptionsX \ifthenelse{\equal{\glscounter}{section}}{% \@ifundefined{chapter}{}{% \let\@gls@old@chapter\@chapter \def\@chapter[#1]#2{\@gls@old@chapter[{#1}]{#2}% \@ifundefined{hyperdef}{}{\hyperdef{section}{\thesection}{}}}}}{} +\newcommand*{\@gls@onlypremakeg}{} +\newcommand*{\@onlypremakeg}[1]{% +\ifx\@gls@onlypremakeg\@empty + \def\@gls@onlypremakeg{#1}% +\else + \expandafter\toks@\expandafter{\@gls@onlypremakeg}% + \edef\@gls@onlypremakeg{\the\toks@,\noexpand#1}% +\fi} +\newcommand*{\@disable@onlypremakeg}{% +\@for\@thiscs:=\@gls@onlypremakeg\do{% + \expandafter\@disable@premakecs\@thiscs% +}} +\newcommand*{\@disable@premakecs}[1]{% + \def#1{\PackageError{glossaries}{\string#1\space may only be + used before \string\makeglossaries}{You can't use + \string#1\space after \string\makeglossaries}}% +} \providecommand*{\glossaryname}{Glossary} \providecommand*{\acronymname}{Acronyms} \newcommand*{\glssettoctitle}[1]{% @@ -150,6 +187,8 @@ name=true]{% \providecommand*{\glssymbolsgroupname}{Symbols} \providecommand*{\glsnumbersgroupname}{Numbers} \newcommand*{\glspluralsuffix}{s} +\providecommand*{\seename}{see} +\providecommand*{\andname}{\&} \ifglstranslate \@ifpackageloaded{translator}{\usedictionary{glossaries-dictionary}% \renewcommand*{\glssettoctitle}[1]{% @@ -174,9 +213,47 @@ name=true]{% \@ifpackageloaded{babel}{\RequirePackage{glossaries-babel}}{}} \fi \newcommand*{\glspostdescription}{.} -\providecommand*{\istfilename}{\jobname.ist} +\newcommand*{\nopostdesc}{} +\newcommand*{\@nopostdesc}{% + \let\org@glspostdescription\glspostdescription + \def\glspostdescription{% + \let\glspostdescription\org@glspostdescription}% +} +\newcommand{\glspar}{\par} +\ifglsxindy + \newcommand{\setStyleFile}[1]{% + \renewcommand{\istfilename}{#1.xdy}} +\else + \newcommand{\setStyleFile}[1]{% + \renewcommand{\istfilename}{#1.ist}} +\fi +\@onlypremakeg\setStyleFile +\ifglsxindy + \def\istfilename{\jobname.xdy} +\else + \def\istfilename{\jobname.ist} +\fi \newcommand*{\@istfilename}[1]{} -\newcommand{\glscompositor}{.} +\newcommand*{\glscompositor}{.} +\newcommand*{\glsSetCompositor}[1]{% + \renewcommand*{\glscompositor}{#1}} +\@onlypremakeg\glsSetCompositor +\newcommand*{\@glsAlphacompositor}{\glscompositor} +\ifglsxindy + \newcommand*\glsSetAlphaCompositor[1]{% + \renewcommand*\@glsAlphacompositor{#1}} +\else + \newcommand*\glsSetAlphaCompositor[1]{% + \glsnoxindywarning\glsSetAlphaCompositor} +\fi +\@onlypremakeg\glsSetAlphaCompositor +\newcommand*{\gls@suffixF}{} +\newcommand*{\glsSetSuffixF}[1]{% + \renewcommand*{\gls@suffixF}{#1}} +\@onlypremakeg\glsSetSuffixF +\newcommand*{\gls@suffixFF}{} +\newcommand*{\glsSetSuffixFF}[1]{% + \renewcommand*{\gls@suffixFF}{#1}} \@ifundefined{hyperlink}{% \newcommand*{\glsnumberformat}[1]{#1}}{% \newcommand*{\glsnumberformat}[1]{\glshypernumber{#1}}} @@ -222,6 +299,204 @@ name=true]{% \addcontentsline{toc}{#2}{#1}% \fi \fi} +\newcommand*{\glsnoxindywarning}[1]{% + \PackageWarning{glossaries}{Not in xindy mode --- ignoring + \string#1}} +\ifglsxindy + \edef\@xdyattributes{\string"default\string"}% +\fi +\ifglsxindy + \def\@xdylocref{} +\fi +\ifglsxindy + \newcommand*\GlsAddXdyAttribute[1]{% + \edef\@xdyattributes{\@xdyattributes ^^J \string"#1\string"}% + \expandafter\toks@\expandafter{\@xdylocref}% + \edef\@xdylocref{\the\toks@ ^^J% + (markup-locref + :open \string"\string~n\string\setentrycounter + {\noexpand\glscounter}% + \expandafter\string\csname#1\endcsname + \expandafter\@gobble\string\{\string" ^^J + :close \string"\expandafter\@gobble\string\}\string" ^^J + :attr \string"#1\string")}} + \@onlypremakeg\GlsAddXdyAttribute +\else + \newcommand*\GlsAddXdyAttribute[1]{% + \glsnoxindywarning\GlsAddXdyAttribute} +\fi +\ifglsxindy + \GlsAddXdyAttribute{glsnumberformat} + \GlsAddXdyAttribute{textrm} + \GlsAddXdyAttribute{textsf} + \GlsAddXdyAttribute{texttt} + \GlsAddXdyAttribute{textbf} + \GlsAddXdyAttribute{textmd} + \GlsAddXdyAttribute{textit} + \GlsAddXdyAttribute{textup} + \GlsAddXdyAttribute{textsl} + \GlsAddXdyAttribute{textsc} + \GlsAddXdyAttribute{emph} + \GlsAddXdyAttribute{glshypernumber} + \GlsAddXdyAttribute{hyperrm} + \GlsAddXdyAttribute{hypersf} + \GlsAddXdyAttribute{hypertt} + \GlsAddXdyAttribute{hyperbf} + \GlsAddXdyAttribute{hypermd} + \GlsAddXdyAttribute{hyperit} + \GlsAddXdyAttribute{hyperup} + \GlsAddXdyAttribute{hypersl} + \GlsAddXdyAttribute{hypersc} + \GlsAddXdyAttribute{hyperemph} +\fi +\def\@xdyuseralphabets{} +\ifglsxindy + \newcommand*{\GlsAddXdyAlphabet}[2]{% + \edef\@xdyuseralphabets{% + \@xdyuseralphabets ^^J + (define-alphabet "#1" (#2))}} +\else + \newcommand*{\GlsAddXdyAlphabet}[2]{% + \glsnoxindywarning\GlsAddXdyAlphabet} +\fi +\def\@xdyuserlocationdefs{} +\def\@xdyuserlocationnames{} +\ifglsxindy + \newcommand*{\GlsAddXdyLocation}[2]{% + \edef\@xdyuserlocationdefs{% + \@xdyuserlocationdefs ^^J% + (define-location-class \string"#1\string"^^J\space\space + \space(#2)) + }% + \edef\@xdyuserlocationnames{% + \@xdyuserlocationnames^^J\space\space\space + \string"#1\string"}% + } + \@onlypremakeg\GlsAddXdyLocation +\else + \newcommand*{\GlsAddXdyLocation}[2]{% + \glsnoxindywarning\GlsAddXdyLocation} +\fi +\ifglsxindy + \edef\@xdylocationclassorder{^^J\space\space\space + \string"roman-page-numbers\string"^^J\space\space\space + \string"arabic-page-numbers\string"^^J\space\space\space + \string"arabic-section-numbers\string"^^J\space\space\space + \string"alpha-page-numbers\string"^^J\space\space\space + \string"Roman-page-numbers\string"^^J\space\space\space + \string"Alpha-page-numbers\string"^^J\space\space\space + \string"Appendix-page-numbers\string" + \@xdyuserlocationnames^^J\space\space\space + \string"see\string" + } +\fi +\ifglsxindy + \newcommand*\GlsSetXdyLocationClassOrder[1]{% + \def\@xdylocationclassorder{#1}} +\else + \newcommand*\GlsSetXdyLocationClassOrder[1]{% + \glsnoxindywarning\GlsSetXdyLocationClassOrder} +\fi +\ifglsxindy + \def\@xdysortrules{} +\fi +\ifglsxindy + \newcommand*\GlsAddSortRule[2]{% + \expandafter\toks@\expandafter{\@xdysortrules}% + \protected@edef\@xdysortrules{\the\toks@ ^^J + (sort-rule \string"#1\string" \string"#2\string")}% + } +\else + \newcommand*\GlsAddSortRule[2]{% + \glsnoxindywarning\GlsAddSortRule} +\fi +\ifglsxindy + \def\@xdyrequiredstyles{tex} +\fi +\ifglsxindy + \newcommand*\GlsAddXdyStyle[1]{% + \edef\@xdyrequiredstyles{\@xdyrequiredstyles,#1}}% +\else + \newcommand*\GlsAddXdyStyle[1]{% + \glsnoxindywarning\GlsAddXdyStyle} +\fi +\ifglsxindy + \newcommand*\GlsSetXdyStyles[1]{% + \edef\@xdyrequiredstyles{#1}} +\else + \newcommand*\GlsSetXdyStyles[1]{% + \glsnoxindywarning\GlsSetXdyStyles} +\fi +\ifglsxindy + \@ifpackageloaded{babel}{% + \def\findrootlanguage{\begingroup + \escapechar=-1\relax + \edef\languagename{% + \expandafter\string\csname\languagename\endcsname}% + \def\NeedsTeXFormat##1[##2]{}% + \def\ProvidesPackage##1[##2]{}% + \let\LdfInit\relax + \def\languageattribute##1##2{}% + \def\DeclareOption##1##2{% + \ifx##1*\expandafter\endinput\else + \edef\testlanguage{\expandafter\string\csname##1\endcsname}% + \ifx\testlanguage\languagename##2\fi + \fi} + \def\input##1{\stripldf##1}% + \def\stripldf##1.ldf{\gdef\rootlanguagename{##1}}% + \@@input babel.sty + \endgroup}% + }{% + \@ifpackageloaded{ngerman}{% + \def\findrootlanguage{% + \def\rootlanguagename{german}}% + }{% + \def\findrootlanguage{% + \def\rootlanguagename{english}}% + }% + }% +\fi +\def\rootlanguagename{english} +\def\@xdylanguage#1#2{} +\ifglsxindy + \newcommand*\GlsSetXdyLanguage[2][\glsdefaulttype]{% + \ifglossaryexists{#1}{% + \expandafter\def\csname @xdy@#1@language\endcsname{#2}% + }{% + \PackageError{glossaries}{Can't set language type for + glossary type `#1' --- no such glossary}{% + You have specified a glossary type that doesn't exist}}} +\else + \newcommand*\GlsSetXdyLanguage[2][]{% + \glsnoxindywarning\GlsSetXdyLanguage} +\fi +\def\@gls@codepage#1#2{} +\ifglsxindy + \newcommand*{\GlsSetXdyCodePage}[1]{% + \renewcommand*{\gls@codepage}{#1}% + } +\else + \newcommand*{\GlsSetXdyCodePage}[1]{% + \glsnoxindywarning\GlsSetXdyCodePage} +\fi +\ifglsxindy + \ifgls@xindy@glsnumbers + \def\@xdylettergroups{(define-letter-group + \string"glsnumbers\string"^^J\space\space\space + :prefixes (\string"0\string" \string"1\string" + \string"2\string" \string"3\string" \string"4\string" + \string"5\string" \string"6\string" \string"7\string" + \string"8\string" \string"9\string")^^J\space\space\space + :before \string"\@glsfirstletter\string")} + \else + \def\@xdylettergroups{} + \fi +\fi + \newcommand*\GlsAddLetterGroup[2]{% + \expandafter\toks@\expandafter{\@xdylettergroups}% + \protected@edef\@xdylettergroups{\the\toks@^^J% + (define-letter-group \string"#1\string"^^J\space\space\space#2)}% + }% \newcommand*{\forallglossaries}[3][\@glo@types]{% \@for#2:=#1\do{\ifthenelse{\equal{#2}{}}{}{#3}}} \newcommand*{\forglsentries}[3][\glsdefaulttype]{% @@ -262,6 +537,7 @@ exists}% \glsdisplayfirst}% \@ifnextchar[{\@gls@setcounter{#2}}{\@gls@setcounter{#2}[\glscounter]}}} \@onlypreamble{\newglossary} +\@onlypremakeg\newglossary \newcommand*{\@newglossary}[4]{} \def\@gls@setcounter#1[#2]{% \expandafter\def\csname @glotype@#1@counter\endcsname{#2}% @@ -306,10 +582,22 @@ exists}% called `#1'}{The counter key should have the name of a valid counter as its value}}{% \def\@glo@counter{#1}}} +\define@key{glossentry}{see}{% +\def\@glo@see{#1}} +\define@key{glossentry}{parent}{% +\def\@glo@parent{#1}} +\define@key{glossentry}{nonumberlist}[none]{% +\def\@glo@prefix{\glsnonextpages}} +\newcommand*{\@glsnoname}{% + \PackageError{glossaries}{name key required in + \string\newglossaryentry\space for entry `\@glo@label'}{You + haven't specified the entry name}} +\newcommand*{\@glsdefaultplural}{\@glo@text\glspluralsuffix} +\newcount\gls@level \DeclareRobustCommand{\newglossaryentry}[2]{% \glsdoifnoexists{#1}{% -\def\@glo@name{\PackageError{glossaries}{name key required in -\string\newglossaryentry}{You haven't specified the entry name}}% +\def\@glo@label{#1}% +\let\@glo@name\@glsnoname \def\@glo@desc{\PackageError{glossaries}{description key required in \string\newglossaryentry}{You haven't specified the entry description}}% \def\@glo@descplural{\@glo@desc}% @@ -317,11 +605,14 @@ counter as its value}}{% \def\@glo@symbol{\relax}% \def\@glo@symbolplural{\@glo@symbol}% \def\@glo@text{\@glo@name}% -\def\@glo@plural{\@glo@text\glspluralsuffix}% +\let\@glo@plural\@glsdefaultplural \let\@glo@first\relax \let\@glo@firstplural\relax \def\@glo@sort{\@glo@name}% \def\@glo@counter{\@gls@getcounter{\@glo@type}}% +\def\@glo@see{}% +\def\@glo@parent{}% +\def\@glo@prefix{}% \setkeys{glossentry}{#2}% \@ifundefined{glolist@\@glo@type}{\PackageError{glossaries}{% Glossary type '\@glo@type' has not been defined}{% @@ -330,6 +621,37 @@ in it}}{% \protected@edef\@glolist@{\csname glolist@\@glo@type\endcsname}% \expandafter\xdef\csname glolist@\@glo@type\endcsname{\@glolist@{#1},}% }% +\gls@level=0\relax +\ifx\@glo@parent\@empty + \expandafter\gdef\csname glo@#1@parent\endcsname{}% +\else + \ifthenelse{\equal{#1}{\@glo@parent}}{% + \PackageError{glossaries}{Entry `#1' can't be its own parent}{}% + \def\@glo@parent{}% + \expandafter\gdef\csname glo@#1@parent\endcsname{}% + }{% + \ifglsentryexists{\@glo@parent}{% + \expandafter\xdef\csname glo@#1@parent\endcsname{\@glo@parent}% + \gls@level=\csname glo@\@glo@parent @level\endcsname\relax + \advance\gls@level by 1\relax + \ifx\@glo@name\@glsnoname + \expandafter\let\expandafter\@glo@name + \csname glo@\@glo@parent @name\endcsname + \ifx\@glo@plural\@glsdefaultplural + \expandafter\let\expandafter\@glo@plural + \csname glo@\@glo@parent @plural\endcsname + \fi + \fi + }{% + \PackageError{glossaries}{Invalid parent `\@glo@parent' + for entry `#1' - parent doesn't exist}{Parent entries + must be defined before their children}% + \def\@glo@parent{}% + \expandafter\gdef\csname glo@#1@parent\endcsname{}% + }% + }% +\fi +\expandafter\xdef\csname glo@#1@level\endcsname{\number\gls@level}% \ifx\relax\@glo@firstplural \ifx\relax\@glo@first \def\@glo@firstplural{\@glo@plural}% @@ -372,7 +694,68 @@ in it}}{% \expandafter\global\expandafter \let\csname ifglo@#1@flag\endcsname\iftrue}% \csname glo@#1@flagfalse\endcsname -}} +\ifx\@glo@see\@empty +\else + \protected@edef\@do@glssee{% + \noexpand\@gls@fixbraces\noexpand\@glo@list\@glo@see + \noexpand\@nil + \noexpand\expandafter\noexpand\@glssee\noexpand\@glo@list{#1}}% + \@do@glssee +\fi +}% + \@glo@storeentry{#1}% +} +\newcommand{\@glo@storeentry}[1]{% +\protected@edef\@glo@sort{\csname glo@#1@sort\endcsname}% +\@gls@checkmkidxchars\@glo@sort +\protected@edef\@@glo@name{\csname glo@#1@name\endcsname}% +\@gls@checkmkidxchars\@@glo@name +\ifglsxindy + \protected@edef\@glo@name{\string\\glsnamefont{\@@glo@name}}% +\else + \protected@edef\@glo@name{\string\glsnamefont{\@@glo@name}}% +\fi +\protected@edef\@glo@desc{\csname glo@#1@desc\endcsname}% +\@gls@checkmkidxchars\@glo@desc +\protected@edef\@glo@symbol{\csname glo@#1@symbol\endcsname}% +\@gls@checkmkidxchars\@glo@symbol +\@gls@checkmkidxchars\@glo@prefix +\edef\@glo@parent{\csname glo@#1@parent\endcsname}% +\ifglsxindy + \ifx\@glo@parent\@empty + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + (\string"\@glo@sort\string" % + \string"\@glo@prefix\string\\glossaryentryfield{#1}{\@glo@name + }{\@glo@desc}{\@glo@symbol}\string") % + }% + \else + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + \csname glo@\@glo@parent @index\endcsname + (\string"\@glo@sort\string" % + \string"\@glo@prefix\string\\glossarysubentryfield% + {\csname glo@#1@level\endcsname}{#1}{\@glo@name + }{\@glo@desc}{\@glo@symbol}\string") % + }% + \fi +\else + \ifx\@glo@parent\@empty + \@onelevel@sanitize\@glo@prefix + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + \@glo@sort\@gls@actualchar\@glo@prefix + \string\glossaryentryfield{#1}{\@glo@name}{\@glo@desc + }{\@glo@symbol}% + }% + \else + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + \csname glo@\@glo@parent @index\endcsname\@gls@levelchar + \@glo@sort\@gls@actualchar\@glo@prefix + \string\glossarysubentryfield + {\csname glo@#1@level\endcsname}{#1}{\@glo@name}{\@glo@desc + }{\@glo@symbol}% + }% + \fi +\fi +} \newcommand*{\glsreset}[1]{% \glsdoifexists{#1}{% \expandafter\global\csname glo@#1@flagfalse\endcsname}} @@ -427,26 +810,14 @@ counter as its value}}{% \edef\@gls@counter{\csname glo@#2@counter\endcsname}% \KV@glslink@hypertrue \setkeys{glslink}{#1}% -\edef\theglsentrycounter{\expandafter\noexpand\csname the\@gls@counter\endcsname}% +\edef\theglsentrycounter{\expandafter\noexpand + \csname the\@gls@counter\endcsname}% \ifKV@glslink@hyper \@glslink{glo:#2}{\glstextformat{#3}}% \else \glstextformat{#3}\relax \fi -\protected@edef\@glo@sort{\csname glo@#2@sort\endcsname}% -\@gls@checkmkidxchars\@glo@sort -\protected@edef\@@glo@name{\csname glo@#2@name\endcsname}% -\@gls@checkmkidxchars\@@glo@name -\protected@edef\@glo@name{\string\glsnamefont{\@@glo@name}}% -\protected@edef\@glo@desc{\csname glo@#2@desc\endcsname}% -\@gls@checkmkidxchars\@glo@desc -\protected@edef\@glo@symbol{\csname glo@#2@symbol\endcsname}% -\@gls@checkmkidxchars\@glo@symbol -\@set@glo@numformat\@glo@numfmt\@gls@counter\@glsnumberformat -\glossary[\csname glo@#2@type\endcsname]{% -\@glo@sort\@gls@actualchar -\string\glossaryentryfield{#2}{\@glo@name}{\@glo@desc -}{\@glo@symbol}\@gls@encapchar\@glo@numfmt}% +\@do@wrglossary{#2}% }} \def\@set@glo@numformat#1#2#3{% \expandafter\@glo@check@mkidxrangechar#3\@nil @@ -473,35 +844,53 @@ counter as its value}}{% \def\@glo@prefix{}\def\@glo@suffix{#1#2}% \fi \fi} +\newcommand*{\@gls@escbsdq}[1]{% + \def\@gls@checkedmkidx{}% + \let\gls@xdystring=#1\relax + \@onelevel@sanitize\gls@xdystring + \edef\do@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash\gls@xdystring\noexpand\@nil + \@backslashchar\@backslashchar\noexpand\null}% + \do@gls@xdycheckbackslash + \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@xdycheckquote\gls@xdystring\@nil""\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}% + \let#1=\gls@xdystring +} \newcommand{\@gls@checkmkidxchars}[1]{% -\def\@gls@checkedmkidx{}% -\expandafter\@gls@checkquote#1\@nil""\null% -\expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% -\def\@gls@checkedmkidx{}% -\expandafter\@gls@checkescquote#1\@nil\"\"\null% -\expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% -\def\@gls@checkedmkidx{}% -\expandafter\@gls@checkescactual#1\@nil\?\?\null% -\expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% -\def\@gls@checkedmkidx{}% -\expandafter\@gls@checkactual#1\@nil??\null% -\expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% -\def\@gls@checkedmkidx{}% -\expandafter\@gls@checkbar#1\@nil||\null% -\expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% -\def\@gls@checkedmkidx{}% -\expandafter\@gls@checkescbar#1\@nil\|\|\null% -\expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% -\def\@gls@checkedmkidx{}% -\expandafter\@gls@checklevel#1\@nil!!\null% -\expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% +\ifglsxindy + \@gls@escbsdq{#1}% +\else + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkquote#1\@nil""\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkescquote#1\@nil\"\"\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkescactual#1\@nil\?\?\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkactual#1\@nil??\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkbar#1\@nil||\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkescbar#1\@nil\|\|\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checklevel#1\@nil!!\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% +\fi } \def\@gls@updatechecked#1\@nil#2{\def#2{#1}} \newtoks\@gls@tmpb \def\@gls@checkquote#1"#2"#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checkquote{\relax}% @@ -523,7 +912,7 @@ counter as its value}}{% \def\@gls@checkescquote#1\"#2\"#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checkescquote{\relax}% @@ -546,7 +935,7 @@ counter as its value}}{% \def\@gls@checkescactual#1\?#2\?#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checkescactual{\relax}% @@ -569,7 +958,7 @@ counter as its value}}{% \def\@gls@checkescbar#1\|#2\|#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checkescbar{\relax}% @@ -592,7 +981,7 @@ counter as its value}}{% \def\@gls@checkesclevel#1\!#2\!#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checkesclevel{\relax}% @@ -615,7 +1004,7 @@ counter as its value}}{% \def\@gls@checkbar#1|#2|#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checkbar{\relax}% @@ -637,7 +1026,7 @@ counter as its value}}{% \def\@gls@checklevel#1!#2!#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checklevel{\relax}% @@ -659,7 +1048,7 @@ counter as its value}}{% \def\@gls@checkactual#1?#2?#3\null{% \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% \toks@={#1}% -\ifx\null#2\null% +\ifx\null#2\null \ifx\null#3\null \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% \def\@@gls@checkactual{\relax}% @@ -678,6 +1067,65 @@ counter as its value}}{% \fi \fi \@@gls@checkactual} +\def\@gls@xdycheckquote#1"#2"#3\null{% +\@gls@tmpb=\expandafter{\@gls@checkedmkidx}% +\toks@={#1}% +\ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@xdycheckquote{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \string\"\string\"}% + \def\@@gls@xdycheckquote{\@gls@xdycheckquote#3\null}% + \fi +\else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \string\"}% + \ifx\null#3\null + \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2""\null}% + \else + \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2"#3\null}% + \fi +\fi +\@@gls@xdycheckquote +} +\edef\def@gls@xdycheckbackslash{% + \noexpand\def\noexpand\@gls@xdycheckbackslash##1\@backslashchar + ##2\@backslashchar##3\noexpand\null{% + \noexpand\@gls@tmpb=\noexpand\expandafter + {\noexpand\@gls@checkedmkidx}% + \noexpand\toks@={##1}% + \noexpand\ifx\noexpand\null##2\noexpand\null + \noexpand\ifx\noexpand\null##3\noexpand\null + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}% + \noexpand\def\noexpand\@@gls@xdycheckbackslash{\relax}% + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \@backslashchar\@backslashchar\@backslashchar\@backslashchar}% + \noexpand\def\noexpand\@@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash##3\noexpand\null}% + \noexpand\fi + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \@backslashchar\@backslashchar}% + \noexpand\ifx\noexpand\null##3\noexpand\null + \noexpand\def\noexpand\@@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash##2\@backslashchar + \@backslashchar\noexpand\null}% + \noexpand\else + \noexpand\def\noexpand\@@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash##2\@backslashchar + ##3\noexpand\null}% + \noexpand\fi + \noexpand\fi + \noexpand\@@gls@xdycheckbackslash + }% +} +\def@gls@xdycheckbackslash \@ifundefined{hyperlink}{% \gdef\@glslink#1#2{#2}% }{% @@ -1187,73 +1635,247 @@ counter as its value}}{% \expandafter\makefirstuc\expandafter{\@glo@text}} \newcommand*{\glsentrytype}[1]{\csname glo@#1@type\endcsname} \newcommand*{\glsentrysort}[1]{\csname glo@#1@sort\endcsname} +\newcommand*{\glshyperlink}[2][\glsentryname{\@glo@label}]{% +\def\@glo@label{#2}% +\@glslink{glo:#2}{#1}} \define@key{glossadd}{counter}{\def\@glo@counter{#1}} \define@key{glossadd}{format}{\def\@glo@format{#1}} \define@key{glossadd}{types}{\def\@glo@type{#1}} \newcommand*{\glsadd}[2][]{% \glsdoifexists{#2}{% -\def\@glo@format{glsnumberformat}% -\edef\@glo@counter{\csname glo@#2@counter\endcsname}% +\def\@glsnumberformat{glsnumberformat}% +\edef\@gls@counter{\csname glo@#2@counter\endcsname}% \setkeys{glossadd}{#1}% -\edef\theglsentrycounter{\expandafter\noexpand\csname the\@glo@counter\endcsname}% -\protected@edef\@glo@sort{\csname glo@#2@sort\endcsname}% -\@gls@checkmkidxchars\@glo@sort -\protected@edef\@@glo@name{\csname glo@#2@name\endcsname}% -\@gls@checkmkidxchars\@@glo@name -\protected@edef\@glo@name{\string\glsnamefont{\@@glo@name}}% -\protected@edef\@glo@desc{\csname glo@#2@desc\endcsname}% -\@gls@checkmkidxchars\@glo@desc -\protected@edef\@glo@symbol{\csname glo@#2@symbol\endcsname}% -\@gls@checkmkidxchars\@glo@symbol -\@set@glo@numformat\@glo@numfmt\@glo@counter\@glo@format -\glossary[\csname glo@#2@type\endcsname]{% -\@glo@sort\@gls@actualchar\string\glossaryentryfield -{#2}{\@glo@name}{\@glo@desc}{\@glo@symbol}\@gls@encapchar -\@glo@numfmt}% +\edef\theglsentrycounter{\expandafter\noexpand + \csname the\@gls@counter\endcsname}% +\@do@wrglossary{#2}% }} \newcommand*{\glsaddall}[1][]{% -\def\@glo@type{\@glo@types}% +\edef\@glo@type{\@glo@types}% \setkeys{glossadd}{#1}% \forallglsentries[\@glo@type]{\@glo@entry}{% \glsadd[#1]{\@glo@entry}}% } +\edef\glsopenbrace{\expandafter\@gobble\string\{} +\edef\glsclosebrace{\expandafter\@gobble\string\}} +\edef\glsquote#1{\string"#1\string"} +\ifglsxindy + \newcommand*{\@glsfirstletter}{A} +\fi +\ifglsxindy + \newcommand*{\GlsSetXdyFirstLetterAfterDigits}[1]{% + \renewcommand*{\@glsfirstletter}{#1}} +\else + \newcommand*{\GlsSetXdyFirstLetterAfterDigits}[1]{% + \glsnoxindywarning\GlsSetXdyFirstLetterAfterDigits} +\fi +\newcommand*{\@glsminrange}{2} +\ifglsxindy + \newcommand*{\GlsSetXdyMinRangeLength}[1]{% + \renewcommand*{\@glsminrange}{#1}} +\else + \newcommand*{\GlsSetXdyMinRangeLength}[1]{% + \glsnoxindywarning\GlsSetXdyMinRangeLength} +\fi \newwrite\istfile -\bgroup -\catcode`\%12\relax -\catcode`\"12\relax -\catcode`\|12\relax -\catcode`\!12\relax -\catcode`\?12\relax -\gdef\@gls@actualchar{?} -\gdef\@gls@encapchar{|} -\gdef\@gls@levelchar{!} -\gdef\@gls@quotechar{"} -\gdef\writeist{\relax -\protected@write\@auxout{}{\string\@istfilename{\istfilename}} -\openout\istfile=\istfilename -\write\istfile{% makeindex style file created by the glossaries package} -\write\istfile{% for document '\jobname' on \the\year-\the\month-\the\day} -\write\istfile{actual '\@gls@actualchar'} -\write\istfile{encap '\@gls@encapchar'} -\write\istfile{level '\@gls@levelchar'} -\write\istfile{quote '\@gls@quotechar'} -\write\istfile{keyword "\string\\glossaryentry"} -\write\istfile{preamble "\string\\glossarysection[\string\\glossarytoctitle]{\string\\glossarytitle}\string\\glossarypreamble\string\n\string\\begin{theglossary}\string\\glossaryheader\string\n"} -\write\istfile{postamble "\string\n\string\\end{theglossary}\string\n\string\\glossarypostamble\string\n"} -\write\istfile{group_skip "\string\\glsgroupskip\string\n"} -\write\istfile{item_0 "\string\n"} -\write\istfile{delim_0 "\{\string\\glossaryentrynumbers\{\string\\relax "} -\write\istfile{delim_t "\}\}"} -\write\istfile{delim_n "\string\\delimN "} -\write\istfile{delim_r "\string\\delimR "} -\write\istfile{headings_flag 1} -\write\istfile{heading_prefix "\string\\glsgroupheading\{"} -\write\istfile{heading_suffix "\}"} -\write\istfile{symhead_positive "glssymbols"} -\write\istfile{numhead_positive "glsnumbers"} -\write\istfile{page_compositor "\glscompositor"} -\noist} -\egroup +\ifglsxindy + \def\writeist{% + \openout\istfile=\istfilename + \write\istfile{;; xindy style file created by the glossaries + package}% + \write\istfile{;; for document '\jobname' on + \the\year-\the\month-\the\day}% + \write\istfile{^^J; required styles^^J} + \@for\@xdystyle:=\@xdyrequiredstyles\do{% + \ifx\@xdystyle\@empty + \else + \protected@write\istfile{}{(require + \string"\@xdystyle.xdy\string")}% + \fi + }% + \write\istfile{^^J% + ; list of allowed attributes (number formats)^^J}% + \write\istfile{(define-attributes ((\@xdyattributes)))}% + \write\istfile{^^J; user defined alphabets^^J}% + \write\istfile{\@xdyuseralphabets}% + \write\istfile{^^J; location class definitions^^J}% + \protected@edef\@gls@roman{\@roman{0\string" + \string"roman-numbers-lowercase\string" :sep \string"}}% + \@onelevel@sanitize\@gls@roman + \edef\@tmp{\string" \string"roman-numbers-lowercase\string" + :sep \string"}% + \@onelevel@sanitize\@tmp + \ifx\@tmp\@gls@roman + \write\istfile{(define-location-class + \string"roman-page-numbers\string"^^J\space\space\space + (\string"roman-numbers-lowercase\string") + :min-range-length \@glsminrange)}% + \else + \write\istfile{(define-location-class + \string"roman-page-numbers\string"^^J\space\space\space + (:sep "\@gls@roman") + :min-range-length \@glsminrange)}% + \fi + \write\istfile{(define-location-class + \string"Roman-page-numbers\string"^^J\space\space\space + (\string"roman-numbers-uppercase\string") + :min-range-length \@glsminrange)}% + \write\istfile{(define-location-class + \string"arabic-page-numbers\string"^^J\space\space\space + (\string"arabic-numbers\string") + :min-range-length \@glsminrange)}% + \write\istfile{(define-location-class + \string"alpha-page-numbers\string"^^J\space\space\space + (\string"alpha\string") + :min-range-length \@glsminrange)}% + \write\istfile{(define-location-class + \string"Alpha-page-numbers\string"^^J\space\space\space + (\string"ALPHA\string") + :min-range-length \@glsminrange)}% + \write\istfile{(define-location-class + \string"Appendix-page-numbers\string"^^J\space\space\space + (\string"ALPHA\string" + :sep \string"\@glsAlphacompositor\string" + \string"arabic-numbers\string") + :min-range-length \@glsminrange)}% + \write\istfile{(define-location-class + \string"arabic-section-numbers\string"^^J\space\space\space + (\string"arabic-numbers\string" + :sep \string"\glscompositor\string" + \string"arabic-numbers\string") + :min-range-length \@glsminrange)}% + \write\istfile{^^J; user defined location classes}% + \write\istfile{\@xdyuserlocationdefs}% + \write\istfile{^^J; define cross-reference class^^J}% + \write\istfile{(define-crossref-class \string"see\string" + :unverified )}% + \write\istfile{(markup-crossref-list + :class \string"see\string"^^J\space\space\space + :open \string"\string\glsseeformat\string" + :close \string"{}\string")}% + \write\istfile{^^J; define the order of the location classes}% + \write\istfile{(define-location-class-order + (\@xdylocationclassorder))}% + \write\istfile{^^J; define the glossary markup^^J}% + \write\istfile{(markup-index^^J\space\space\space + :open \string"\string + \glossarysection[\string\glossarytoctitle]{\string + \glossarytitle}\string\glossarypreamble\string~n\string\begin + {theglossary}\string\glossaryheader\string~n\string" ^^J\space + \space\space:close \string"\expandafter\@gobble + \string\%\string~n\string + \end{theglossary}\string\glossarypostamble + \string~n\string" ^^J\space\space\space + :tree)}% + \write\istfile{(markup-letter-group-list + :sep \string"\string\glsgroupskip\string~n\string")}% + \write\istfile{(markup-indexentry + :open \string"\string\relax \string\glsresetentrylist + \string~n\string")}% + \write\istfile{(markup-locclass-list :open + \string"\glsopenbrace\string\glossaryentrynumbers + \glsopenbrace\string\relax\space \string"^^J\space\space\space + :sep \string", \string" + :close \string"\glsclosebrace\glsclosebrace\string")}% + \write\istfile{(markup-locref-list + :sep \string"\string\delimN\space\string")}% + \write\istfile{(markup-range + :sep \string"\string\delimR\space\string")}% + \@onelevel@sanitize\gls@suffixF + \@onelevel@sanitize\gls@suffixFF + \ifx\gls@suffixF\@empty + \else + \write\istfile{(markup-range + :close "\gls@suffixF" :length 1 :ignore-end)}% + \fi + \ifx\gls@suffixFF\@empty + \else + \write\istfile{(markup-range + :close "\gls@suffixFF" :length 2 :ignore-end)}% + \fi + \write\istfile{^^J; define format to use for locations^^J}% + \write\istfile{\@xdylocref}% + \write\istfile{^^J; define letter group list format^^J}% + \write\istfile{(markup-letter-group-list + :sep \string"\string\glsgroupskip\string~n\string")}% + \write\istfile{^^J; letter group headings^^J}% + \write\istfile{(markup-letter-group + :open-head \string"\string\glsgroupheading + \glsopenbrace\string"^^J\space\space\space + :close-head \string"\glsclosebrace\string")}% + \write\istfile{^^J; additional letter groups^^J}% + \write\istfile{\@xdylettergroups}% + \write\istfile{^^J; additional sort rules^^J} + \write\istfile{\@xdysortrules}% + \noist} +\else + \edef\@gls@actualchar{\string?} + \edef\@gls@encapchar{\string|} + \edef\@gls@levelchar{\string!} + \edef\@gls@quotechar{\string"} + \def\writeist{\relax + \openout\istfile=\istfilename + \write\istfile{\expandafter\@gobble\string\% makeindex style file + created by the glossaries package} + \write\istfile{\expandafter\@gobble\string\% for document + '\jobname' on \the\year-\the\month-\the\day} + \write\istfile{actual '\@gls@actualchar'} + \write\istfile{encap '\@gls@encapchar'} + \write\istfile{level '\@gls@levelchar'} + \write\istfile{quote '\@gls@quotechar'} + \write\istfile{keyword \string"\string\\glossaryentry\string"} + \write\istfile{preamble \string"\string\\glossarysection[\string + \\glossarytoctitle]{\string\\glossarytitle}\string + \\glossarypreamble\string\n\string\\begin{theglossary}\string + \\glossaryheader\string\n\string"} + \write\istfile{postamble \string"\string\%\string\n\string + \\end{theglossary}\string\\glossarypostamble\string\n + \string"} + \write\istfile{group_skip \string"\string\\glsgroupskip\string\n + \string"} + \write\istfile{item_0 \string"\string\%\string\n\string"} + \write\istfile{item_1 \string"\string\%\string\n\string"} + \write\istfile{item_2 \string"\string\%\string\n\string"} + \write\istfile{item_01 \string"\string\%\string\n\string"} + \write\istfile{item_x1 + \string"\string\\relax \string\\glsresetentrylist\string\n + \string"} + \write\istfile{item_02 \string"\string\%\string\n\string"} + \write\istfile{item_12 \string"\string\%\string\n\string"} + \write\istfile{item_x2 + \string"\string\\relax \string\\glsresetentrylist\string\n + \string"} + \write\istfile{delim_0 \string"\{\string + \\glossaryentrynumbers\{\string\\relax \string"} + \write\istfile{delim_1 \string"\{\string + \\glossaryentrynumbers\{\string\\relax \string"} + \write\istfile{delim_2 \string"\{\string + \\glossaryentrynumbers\{\string\\relax \string"} + \write\istfile{delim_t \string"\}\}\string"} + \write\istfile{delim_n \string"\string\\delimN \string"} + \write\istfile{delim_r \string"\string\\delimR \string"} + \write\istfile{headings_flag 1} + \write\istfile{heading_prefix + \string"\string\\glsgroupheading\{\string"} + \write\istfile{heading_suffix + \string"\}\string\\relax + \string\\glsresetentrylist \string"} + \write\istfile{symhead_positive \string"glssymbols\string"} + \write\istfile{numhead_positive \string"glsnumbers\string"} + \write\istfile{page_compositor \string"\glscompositor\string"} + \@gls@escbsdq\gls@suffixF + \@gls@escbsdq\gls@suffixFF + \ifx\gls@suffixF\@empty + \else + \write\istfile{suffix_2p \string"\gls@suffixF\string"} + \fi + \ifx\gls@suffixFF\@empty + \else + \write\istfile{suffix_3p \string"\gls@suffixFF\string"} + \fi + \noist + } +\fi \newcommand{\noist}{\let\writeist\relax} \newcommand*{\@makeglossary}[1]{% \ifglossaryexists{#1}{% @@ -1268,39 +1890,148 @@ counter as its value}}{% Glossary type `#1' not defined}{New glossaries must be defined before using \string\makeglossary}}} \newcommand*{\makeglossaries}{% -\@for\@glo@type:=\@glo@types\do{% -\ifthenelse{\equal{\@glo@type}{}}{}{% -\@makeglossary{\@glo@type}}}% -\renewcommand*\newglossary[4][]{% -\PackageError{glossaries}{New glossaries -must be created before \string\makeglossaries}{You need -to move \string\makeglossaries\space after all your -\string\newglossary\space commands}}% -\let\@makeglossary\empty -\let\makeglossary\empty} + \protected@write\@auxout{}{\string\@istfilename{\istfilename}}% + \protected@write\@auxout{}{\string\@glsorder{\glsorder}} + \@for\@glo@type:=\@glo@types\do{% + \ifthenelse{\equal{\@glo@type}{}}{}{% + \@makeglossary{\@glo@type}}% + }% + \renewcommand*\newglossary[4][]{% + \PackageError{glossaries}{New glossaries + must be created before \string\makeglossaries}{You need + to move \string\makeglossaries\space after all your + \string\newglossary\space commands}}% + \let\@makeglossary\relax + \let\makeglossary\relax + \let\makeglossaries\relax + \@disable@onlypremakeg +} \let\makeglossary\makeglossaries +\AtEndDocument{\ifx\makeglossaries\relax +\else + \PackageWarningNoLine{glossaries}{\string\makeglossaries\space + hasn't been used,^^Jthe glossaries will not be updated}% +\fi +\warn@noprintglossary +} \renewcommand*{\glossary}[1][\glsdefaulttype]{% \@glossary[#1]} -\def\@glossary[#1]{\@bsphack\begingroup\@sanitize\@index} +\def\@glossary[#1]{\index} \newcommand{\@gls@renewglossary}{% \gdef\@glossary[##1]{\@bsphack\begingroup\@wrglossary{##1}}% \let\@gls@renewglossary\@empty } \renewcommand*{\@wrglossary}[2]{% -\expandafter\protected@write\csname glo@#1@file\endcsname{}{% -\string\glossaryentry{#2}{\theglsentrycounter}}\endgroup\@esphack} + \expandafter\protected@write\csname glo@#1@file\endcsname{}{#2}% + \endgroup\@esphack +} +\newcommand{\@do@wrglossary}[1]{% +\ifglsxindy + \expandafter\@glo@check@mkidxrangechar\@glsnumberformat\@nil + \def\@glo@range{}% + \expandafter\if\@glo@prefix(\relax + \def\@glo@range{:open-range}% + \else + \expandafter\if\@glo@prefix)\relax + \def\@glo@range{:close-range}% + \fi + \fi +\protected@edef\@glslocref{\theglsentrycounter}% +\@gls@checkmkidxchars\@glslocref + \glossary[\csname glo@#1@type\endcsname]{% + (indexentry :tkey (\csname glo@#1@index\endcsname) + :locref \string"\@glslocref\string" % + :attr \string"\@glo@suffix\string" \@glo@range + ) + }% +\else + \@set@glo@numformat\@glo@numfmt\@gls@counter\@glsnumberformat + \glossary[\csname glo@#1@type\endcsname]{% + \string\glossaryentry{\csname glo@#1@index\endcsname + \@gls@encapchar\@glo@numfmt}{\theglsentrycounter}}% +\fi +} +\newcommand{\@do@seeglossary}[2]{% +\ifglsxindy + \glossary[\csname glo@#1@type\endcsname]{% + (indexentry + :tkey (\csname glo@#1@index\endcsname) + :xref (\string"#2\string") + :attr \string"see\string" + ) + }% +\else + \glossary[\csname glo@#1@type\endcsname]{% + \string\glossaryentry{\csname glo@#1@index\endcsname + \@gls@encapchar glsseeformat#2}{Z}}% +\fi +} +\def\@gls@fixbraces#1#2#3\@nil{% + \ifx#2[\relax + \def#1{#2#3}% + \else + \def#1{{#2#3}}% + \fi +} +\newcommand*{\glssee}[3][\seename]{% + \@do@seeglossary{#2}{[#1]{#3}}} +\newcommand*{\@glssee}[3][\seename]{% + \glssee[#1]{#3}{#2}} +\newcommand*{\glsseeformat}[3][\seename]{\emph{#1} \glsseelist{#2}} +\newcommand*{\glsseelist}[1]{% + \let\@gls@dolast\relax + \let\@gls@donext\relax + \@for\@gls@thislabel:=#1\do{% + \ifx\@xfor@nextelement\@nnil + \@gls@dolast + \else + \@gls@donext + \fi + \glsseeitem{\@gls@thislabel}% + \let\@gls@dolast\glsseelastsep + \let\@gls@donext\glsseesep + }% +} +\newcommand*{\glsseelastsep}{\space\andname\space} +\newcommand*{\glsseesep}{, } +\newcommand*{\glsseeitem}[1]{\glshyperlink{#1}} +\def\warn@noprintglossary{\PackageWarningNoLine{glossaries}{No +\string\printglossary\space or \string\printglossaries\space +found.^^JThis document will not have a glossary.}} +\@ifundefined{printglossary}{}{% +\PackageWarning{glossaries}{Overriding \string\printglossary}% +\let\printglossary\undefined} \newcommand*{\printglossary}[1][type=\glsdefaulttype]{% -\def\@glo@type{\glsdefaulttype}% -\def\glossarytitle{\csname @glotype@\@glo@type @title\endcsname}% -\def\@glossarystyle{}% -\def\gls@dotoctitle{\glssettoctitle{\@glo@type}}% -\bgroup -\setkeys{printgloss}{#1}% -\gls@dotoctitle -\@glossarystyle -\makeatletter -\@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}% -\egroup + \ifglsxindy\findrootlanguage\fi + \def\@glo@type{\glsdefaulttype}% + \def\glossarytitle{\csname @glotype@\@glo@type @title\endcsname}% + \def\@glossarystyle{}% + \def\gls@dotoctitle{\glssettoctitle{\@glo@type}}% + \let\@org@glossaryentrynumbers\glossaryentrynumbers + \bgroup + \setkeys{printgloss}{#1}% + \let\org@glossaryentrynumbers\glossaryentrynumbers + \let\glsnonextpages\@glsnonextpages + \let\nopostdesc\@nopostdesc + \gls@dotoctitle + \@glossarystyle + \makeatletter + \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}% + \ifglsxindy + \@ifundefined{@xdy@\@glo@type @language}{% + \protected@write\@auxout{}{% + \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}% + }{% + \protected@write\@auxout{}{% + \string\@xdylanguage{\@glo@type}{\csname @xdy@\@glo@type + @language\endcsname}}% + }% + \protected@write\@auxout{}{% + \string\@gls@codepage{\@glo@type}{\gls@codepage}}% + \fi + \egroup + \global\let\glossaryentrynumbers\@org@glossaryentrynumbers +\let\warn@noprintglossary\relax } \newcommand*{\printglossaries}{% \forallglossaries{\@@glo@type}{\printglossary[type=\@@glo@type]}} @@ -1331,6 +2062,12 @@ false,nolabel,autolabel}[nolabel]{% \else \def\glossaryentrynumbers##1{##1}% \fi} +\newcommand*{\@glsnonextpages}{% + \gdef\glossaryentrynumbers##1{% + \glsresetentrylist}} +\newcommand*{\glsresetentrylist}{% + \global\let\glossaryentrynumbers\org@glossaryentrynumbers} +\newcommand*{\glsnonextpages}{} \@ifundefined{theglossary}{% \newenvironment{theglossary}{}{}}{% \PackageWarning{glossaries}{overriding `theglossary' environment}% @@ -1338,6 +2075,8 @@ false,nolabel,autolabel}[nolabel]{% \newcommand*{\glossaryheader}{} \newcommand*{\glossaryentryfield}[5]{% \@glstarget{glo:#1}{#2} #4 #3. #5\par} +\newcommand*{\glossarysubentryfield}[6]{% +\@glstarget{glo:#2}{}#4. #6\par} \newcommand*{\glsgroupskip}{} \newcommand*{\glsgroupheading}[1]{} \newcommand*{\glsgetgrouptitle}[1]{% @@ -1350,7 +2089,7 @@ false,nolabel,autolabel}[nolabel]{% \@ifundefined{@glsstyle@#1}{\PackageError{glossaries}{Glossary style `#1' undefined}{}}{% \csname @glsstyle@#1\endcsname}} -\newcommand*{\newglossarystyle}[2]{% +\newcommand{\newglossarystyle}[2]{% \@ifundefined{@glsstyle@#1}{% \expandafter\def\csname @glsstyle@#1\endcsname{#2}}{% \PackageError{glossaries}{Glossary style `#1' is already defined}{}}} @@ -1358,7 +2097,21 @@ style `#1' undefined}{}}{% \@ifundefined{hyperlink}{% \def\glshypernumber#1{#1}}{% \def\glshypernumber#1{% -\@delimR#1\delimR\delimR\\}} + \@glshypernumber#1\nohyperpage{}\@nil}} +\def\@glshypernumber#1\nohyperpage#2#3\@nil{% + \ifx\\#1\\% + \else + \@delimR#1\delimR\delimR\\% + \fi + \ifx\\#2\\% + \else + #2% + \fi + \ifx\\#3\\% + \else + \@glshypernumber#3\@nil + \fi +} \def\@delimR#1\delimR #2\delimR #3\\{% \ifx\\#2\\% \@delimN{#1}% @@ -1477,6 +2230,7 @@ firstplural={\@glo@descplural\space (\@glo@plural)},% \def\@ACRfullpl#1#2[#3]{\@GLSfirstplural@{#1}{#2}[#3]} \newcommand{\acronymfont}[1]{#1} \newcommand{\firstacronymfont}[1]{\acronymfont{#1}} +\newcommand*{\acrnameformat}[2]{\acronymfont{#1}} \ifglsacrdescription \ifglsacrfootnote \renewcommand{\newacronym}[4][]{% @@ -1547,7 +2301,7 @@ firstplural={\@glo@descplural\space (\@glo@plural)},% \fi \renewcommand{\newacronym}[4][]{% \newglossaryentry{#2}{type=\acronymtype,% - name={\acronymfont#4},% + name={#4},% sort={#4}, text={#4},% plural={#4\acrpluralsuffix},% @@ -1590,7 +2344,7 @@ firstplural={\@glo@descplural\space (\@glo@plural)},% \else \renewcommand{\newacronym}[4][]{% \newglossaryentry{#2}{type=\acronymtype,% - name={\acronymfont{#3}},% + name={\acrnameformat{#3}{#4}},% sort={#3},% first={#4},% firstplural={#4\acrpluralsuffix},% @@ -1825,6 +2579,7 @@ firstplural={\@glo@descplural\space (\@glo@plural)},% \RequirePackage{glossary-list} \RequirePackage{glossary-long} \RequirePackage{glossary-super} +\RequirePackage{glossary-tree} \glossarystyle{\@glossary@default@style} \endinput %% |