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 | 218 |
1 files changed, 94 insertions, 124 deletions
diff --git a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty index f00204e5f06..2b72e43070f 100644 --- a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty +++ b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries}[2018/04/07 v4.37 (NLCT)] +\ProvidesPackage{glossaries}[2018/05/10 v4.38 (NLCT)] \RequirePackage{ifthen} \RequirePackage{xkeyval}[2006/11/18] \RequirePackage{mfirstuc} @@ -235,13 +235,42 @@ false,nolabel,autolabel,nameref}[nolabel]{% {% \glsucmarkfalse } +\newcommand*{\@gls@define@glossaryentrycounter}{% + \ifglsentrycounter + \ifundef\c@glossaryentry + {% + \ifx\@gls@counterwithin\@empty + \newcounter{glossaryentry}% + \else + \newcounter{glossaryentry}[\@gls@counterwithin]% + \fi + \def\theHglossaryentry{\currentglossary.\theglossaryentry}% + }% + {}% + \fi +} \define@boolkey{glossaries.sty}[gls]{entrycounter}[true]{} \glsentrycounterfalse \define@key{glossaries.sty}{counterwithin}{% \renewcommand*{\@gls@counterwithin}{#1}% \glsentrycountertrue + \@gls@define@glossaryentrycounter } \newcommand*{\@gls@counterwithin}{} +\newcommand{\@gls@define@glossarysubentrycounter}{% + \ifundef\c@glossarysubentry + {% + \ifglssubentrycounter + \ifglsentrycounter + \newcounter{glossarysubentry}[glossaryentry]% + \else + \newcounter{glossarysubentry}% + \fi + \def\theHglossarysubentry{\currentglossary.\currentglssubentry.\theglossarysubentry}% + \fi + }% + {}% +} \define@boolkey{glossaries.sty}[gls]{subentrycounter}[true]{} \glssubentrycounterfalse \newcommand*{\@glo@default@sorttype}{standard} @@ -882,6 +911,16 @@ false,nolabel,autolabel,nameref}[nolabel]{% \let\@gls@do@symbolssdef\relax \let\@gls@do@indexdef\relax \let\@gls@do@acronymsdef\relax + \ifglsentrycounter + \let\@gls@doentrycounterdef\relax + \else + \let\@gls@doentrycounterdef\@gls@define@glossaryentrycounter + \fi + \ifglssubentrycounter + \let\@gls@dosubentrycounterdef\relax + \else + \let\@gls@dosubentrycounterdef\@gls@define@glossarysubentrycounter + \fi \setkeys{glossaries.sty}{#1}% \@gls@setacrstyle \@gls@setupshortcuts @@ -889,6 +928,8 @@ false,nolabel,autolabel,nameref}[nolabel]{% \@gls@do@numbersdef \@gls@do@symbolssdef \@gls@do@indexdef + \@gls@doentrycounterdef + \@gls@dosubentrycounterdef } \ifthenelse{\equal{\glscounter}{section}}% {% @@ -6131,63 +6172,14 @@ false,nolabel,autolabel,nameref}[nolabel]{% \define@choicekey{printgloss}{nopostdot}{true,false}[true]{% \csuse{glsnopostdot#1}% } +\newcommand*{\GlsEntryCounterLabelPrefix}{glsentry-} \define@choicekey{printgloss}{entrycounter}{true,false}[true]{% \csuse{glsentrycounter#1}% - \ifglsentrycounter - \ifx\@gls@counterwithin\@empty - \newcounter{glossaryentry}% - \else - \newcounter{glossaryentry}[\@gls@counterwithin]% - \fi - \def\theHglossaryentry{\currentglossary.\theglossaryentry}% - \renewcommand*{\glsresetentrycounter}{% - \setcounter{glossaryentry}{0}% - }% - \renewcommand*{\glsstepentry}[1]{% - \refstepcounter{glossaryentry}% - \label{glsentry-\glsdetoklabel{##1}}% - }% - \renewcommand*{\glsentrycounterlabel}{\theglossaryentry.\space}% - \renewcommand*{\glsentryitem}[1]{% - \glsstepentry{##1}\glsentrycounterlabel - }% - \else - \renewcommand*{\glsresetentrycounter}{}% - \renewcommand*{\glsstepentry}[1]{}% - \renewcommand*{\glsentrycounterlabel}{}% - \renewcommand*{\glsentryitem}[1]{\glsresetsubentrycounter} - \fi + \@gls@define@glossaryentrycounter } \define@choicekey{printgloss}{subentrycounter}{true,false}[true]{% \csuse{glssubentrycounter#1}% - \ifglssubentrycounter - \ifundef\c@glossarysubentry - {% - \ifglsentrycounter - \newcounter{glossarysubentry}[glossaryentry]% - \else - \newcounter{glossarysubentry} - \fi - }{}% - \renewcommand*{\glsstepsubentry}[1]{% - \edef\currentglssubentry{\glsdetoklabel{##1}}% - \refstepcounter{glossarysubentry}% - \label{glsentry-\currentglssubentry}% - }% - \renewcommand*{\glsresetsubentrycounter}{% - \setcounter{glossarysubentry}{0}% - }% - \renewcommand*{\glssubentryitem}[1]{% - \glsstepsubentry{##1}\glssubentrycounterlabel - }% - \renewcommand*{\glssubentrycounterlabel}{\theglossarysubentry)\space}% - \def\theHglossarysubentry{\currentglssubentry.\theglossarysubentry} - \else - \renewcommand*{\glssubentryitem}[1]{}% - \renewcommand*{\glsstepsubentry}[1]{}% - \renewcommand*{\glsresetsubentrycounter}{}% - \renewcommand*{\glssubentrycounterlabel}{}% - \fi + \@gls@define@glossarysubentrycounter } \define@boolkey{printgloss}[gls]{nonumberlist}[true]{% \ifglsnonumberlist @@ -6216,86 +6208,64 @@ false,nolabel,autolabel,nameref}[nolabel]{% \global\let\glossaryentrynumbers\org@glossaryentrynumbers} \newcommand*{\glsnonextpages}{} \newcommand*{\glsnextpages}{} -\ifglsentrycounter - \ifx\@gls@counterwithin\@empty - \newcounter{glossaryentry} - \else - \newcounter{glossaryentry}[\@gls@counterwithin] +\@gls@define@glossaryentrycounter +\@gls@define@glossarysubentrycounter +\newcommand*{\glsresetsubentrycounter}{% + \ifglssubentrycounter + \setcounter{glossarysubentry}{0}% \fi - \def\theHglossaryentry{\currentglossary.\theglossaryentry} -\fi -\ifglssubentrycounter +} +\newcommand*{\glsresetentrycounter}{% \ifglsentrycounter - \newcounter{glossarysubentry}[glossaryentry] - \else - \newcounter{glossarysubentry} - \fi - \def\theHglossarysubentry{\currentglssubentry.\theglossarysubentry} -\fi -\ifglssubentrycounter - \newcommand*{\glsresetsubentrycounter}{% - \setcounter{glossarysubentry}{0}% - } -\else - \newcommand*{\glsresetsubentrycounter}{} -\fi -\ifglsentrycounter - \newcommand*{\glsresetentrycounter}{% \setcounter{glossaryentry}{0}% - } -\else - \newcommand*{\glsresetentrycounter}{} -\fi -\ifglsentrycounter - \newcommand*{\glsstepentry}[1]{% + \fi +} +\newcommand*{\glsstepentry}[1]{% + \ifglsentrycounter \refstepcounter{glossaryentry}% - \label{glsentry-\glsdetoklabel{#1}}% - } -\else - \newcommand*{\glsstepentry}[1]{} -\fi -\ifglssubentrycounter - \newcommand*{\glsstepsubentry}[1]{% + \label{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \fi +} +\newcommand*{\glsstepsubentry}[1]{% + \ifglssubentrycounter \edef\currentglssubentry{\glsdetoklabel{#1}}% \refstepcounter{glossarysubentry}% - \label{glsentry-\currentglssubentry}% - } -\else - \newcommand*{\glsstepsubentry}[1]{} -\fi -\ifglsentrycounter - \newcommand*{\glsrefentry}[1]{\ref{glsentry-\glsdetoklabel{#1}}} -\else - \ifglssubentrycounter - \newcommand*{\glsrefentry}[1]{\ref{glsentry-\glsdetoklabel{#1}}} - \else - \newcommand*{\glsrefentry}[1]{\gls{#1}} + \label{\GlsEntryCounterLabelPrefix\currentglssubentry}% \fi -\fi -\ifglsentrycounter - \newcommand*{\glsentrycounterlabel}{\theglossaryentry.\space} -\else - \newcommand*{\glsentrycounterlabel}{} -\fi -\ifglssubentrycounter - \newcommand*{\glssubentrycounterlabel}{\theglossarysubentry)\space} -\else - \newcommand*{\glssubentrycounterlabel}{} -\fi -\ifglsentrycounter - \newcommand*{\glsentryitem}[1]{% +} +\newcommand*{\glsrefentry}[1]{% + \ifglsentrycounter + \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \ifglssubentrycounter + \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \gls{#1}% + \fi + \fi +} +\newcommand*{\glsentrycounterlabel}{% + \ifglsentrycounter + \theglossaryentry.\space + \fi +} +\newcommand*{\glssubentrycounterlabel}{% + \ifglssubentrycounter + \theglossarysubentry)\space + \fi +} +\newcommand*{\glsentryitem}[1]{% + \ifglsentrycounter \glsstepentry{#1}\glsentrycounterlabel - } -\else - \newcommand*{\glsentryitem}[1]{\glsresetsubentrycounter} -\fi -\ifglssubentrycounter - \newcommand*{\glssubentryitem}[1]{% + \else + \glsresetsubentrycounter + \fi +} +\newcommand*{\glssubentryitem}[1]{% + \ifglssubentrycounter \glsstepsubentry{#1}\glssubentrycounterlabel - } -\else - \newcommand*{\glssubentryitem}[1]{} -\fi + \fi +} \ifcsundef{theglossary}% {% \newenvironment{theglossary}{}{}% |