diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-09 21:18:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-09 21:18:22 +0000 |
commit | 11bd7c1043384daa09ab391cfbbc6c9b47514c9f (patch) | |
tree | e9c91f9d74c0f9fd7b8e9518b327a04ad83a3737 /Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty | |
parent | a20371822a110924cb6a42227a0611df4004eb05 (diff) |
glossaries-extra (9apr18)
git-svn-id: svn://tug.org/texlive/trunk@47410 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty | 255 |
1 files changed, 160 insertions, 95 deletions
diff --git a/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty b/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty index 4e62d174a71..fcbd5394ca4 100644 --- a/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty +++ b/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-extra}[2018/03/06 v1.28 (NLCT)] +\ProvidesPackage{glossaries-extra}[2018/04/09 v1.29 (NLCT)] \RequirePackage{xkeyval} \RequirePackage{etoolbox} \@ifpackageloaded{glossaries} @@ -147,6 +147,7 @@ \glsxtr@@do@wrglossary{#1}% \else \@@glsxtrwrglossmark + \glsxtr@inc@wrglossaryctr{#1}% \@@do@@wrglossary \fi }% @@ -161,6 +162,7 @@ \ifglsentryexists{#2}{}% {% \@@glsxtrwrglossmark + \glsxtr@inc@wrglossaryctr{#2}% \begingroup \edef\@gls@label{\glsdetoklabel{#2}}% \let\glslabel\@gls@label @@ -168,7 +170,7 @@ \def\@glsxtr@thevalue{}% \def\@glsxtr@theHvalue{\@glsxtr@thevalue}% \let\@glsxtr@org@theHvalue\@glsxtr@theHvalue - \def\@gls@counter{page}% + \let\@gls@counter\glscounter \@gls@setdefault@glslink@opts \setkeys{#3}{#1}% \ifKV@glslink@noindex @@ -210,9 +212,17 @@ }% \@do@gls@getcounterprefix \fi - \protected@write\@auxout{\let\@glsrecordlocref\relax}{\string\glsxtr@record - {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}% - {\@glsrecordlocref}}% + \ifdefstring\@gls@counter{page}% + {% + \protected@write\@auxout{\let\@glsrecordlocref\relax}{\string\glsxtr@record + {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}% + {\@glsrecordlocref}}% + }% + {% + \protected@write\@auxout{}{\string\glsxtr@record + {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}% + {\@glsrecordlocref}}% + }% \@glsxtr@counterrecordhook \let\@glo@counterprefix\@glsxtr@orgprefix } @@ -625,6 +635,34 @@ \setglossarystyle{#1}% }% } +\newcommand*{\glsxtr@inc@wrglossaryctr}[1]{} +\newcommand*{\GlsXtrInternalLocationHyperlink}[3]{% + \glsxtrhyperlink{#1#2#3}{#3}% +} +\newcommand*{\@glsxtr@wrglossary@locationhyperlink}[3]{% + \pageref{wrglossary.#3}% +} +\@glsxtr@declareoption{indexcounter}{% + \glsxtr@dooption{counter=wrglossary}% + \ifundef\c@wrglossary + {% + \newcounter{wrglossary}% + \renewcommand{\thewrglossary}{\arabic{wrglossary}}% + }% + {}% + \renewcommand*{\glsxtr@inc@wrglossaryctr}[1]{% + \refstepcounter{wrglossary}% + \label{wrglossary.\thewrglossary}% + }% + \renewcommand*{\GlsXtrInternalLocationHyperlink}[3]{% + \ifdefstring\glsentrycounter{wrglossary}% + {% + \@glsxtr@wrglossary@locationhyperlink{##1}{##2}{##3}% + }% + {\glsxtrhyperlink{##1##2##3}{##3}}% + }% +} + \newcommand*{\@glsxtrwrglossmark}{} \newcommand*{\@@glsxtrwrglossmark}{} \AtBeginDocument{\renewcommand*{\@@glsxtrwrglossmark}{\@glsxtrwrglossmark}} @@ -720,6 +758,7 @@ \let\glsxtr@org@@do@wrglossary\@@do@wrglossary \newcommand*{\glsxtr@@do@wrglossary}[1]{% \@@glsxtrwrglossmark + \glsxtr@inc@wrglossaryctr{#1}% \glsxtr@org@@do@wrglossary{#1}% } \let\glsxtr@saveentrycounter\@gls@saveentrycounter @@ -850,7 +889,7 @@ \dolistcsloop{glo@\glsdetoklabel{#1}@#2}% } \newcommand*{\glsxtrfieldforlistloop}[3]{% - \forlistcsloop{glo@\glsdetoklabel{#1}@#2}{#3}% + \forlistcsloop{#3}{glo@\glsdetoklabel{#1}@#2}% } \newcommand*{\glsxtrfieldifinlist}[5]{% \ifinlistcs{#3}{glo@\glsdetoklabel{#1}@#2}{#4}{#5}% @@ -1391,6 +1430,22 @@ }% } \newcommand*{\glsxtrunusedformat}[1]{\unskip} +\ifdef\gls@begindocdefs +{% + \renewcommand*{\gls@begindocdefs}{% + \ifnum\@glsxtr@docdefval=1\relax + \@gls@enablesavenonumberlist + \edef\@gls@restoreat{% + \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax}% + \makeatletter + \InputIfFileExists{\jobname.glsdefs}{}{}% + \@gls@restoreat + \undef\@gls@restoreat + \gls@defdocnewglossaryentry + \fi + } +} +{} \let\glsxtr@orgmakenoidxglossaries\makenoidxglossaries \renewcommand{\makenoidxglossaries}{% \ifdefequal\@glsxtr@record@setting\@glsxtr@record@setting@off @@ -3616,104 +3671,104 @@ \@disable@onlypremakeg \let\gls@checkseeallowed\relax \renewcommand*{\@do@seeglossary}[2]{% - \glsdoifexists{##1}% - {% - \edef\@gls@label{\glsdetoklabel{##1}}% - \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}% - \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% - {\@glsxtr@org@doseeglossary{##1}{##2}}% + \glsdoifexists{##1}% {% - \@@glsxtrwrglossmark - \protected@write\@auxout{}{% - \string\@gls@reference - {\gls@type}{\@gls@label}{\string\glsseeformat##2{}}% + \edef\@gls@label{\glsdetoklabel{##1}}% + \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}% + \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% + {\@glsxtr@org@doseeglossary{##1}{##2}}% + {% + \@@glsxtrwrglossmark + \protected@write\@auxout{}{% + \string\@gls@reference + {\gls@type}{\@gls@label}{\string\glsseeformat##2{}}% + }% }% }% }% - }% - \let\@glsxtr@@do@@wrglossary\@@do@@wrglossary - \def\@@do@@wrglossary{% - \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}% - \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% - {\@glsxtr@@do@@wrglossary}% - {\gls@noidxglossary}% - }% - \let\warn@nomakeglossaries\relax - \def\warn@noprintglossary{% - \GlossariesWarningNoLine{No \string\printglossary\space - or \string\printglossaries\space - found.^^J(Remove \string\makeglossaries\space if you don't want - any glossaries.)^^JThis document will not have a glossary}% - }% - \renewcommand{\@gls@noref@warn}[1]{% - \edef\@gls@type{##1}% - \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% - {% - \GlossariesExtraWarning{Can't use - \string\printnoidxglossary[type={\@gls@type}] - when `\@gls@type' is listed in the optional argument of - \string\makeglossaries}% + \let\@glsxtr@@do@@wrglossary\@@do@@wrglossary + \def\@@do@@wrglossary{% + \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}% + \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% + {\@glsxtr@@do@@wrglossary}% + {\gls@noidxglossary}% }% - {% - \GlossariesWarning{Empty glossary for - \string\printnoidxglossary[type={##1}]. - Rerun may be required (or you may have forgotten to use - commands like \string\gls)}% + \let\warn@nomakeglossaries\relax + \def\warn@noprintglossary{% + \GlossariesWarningNoLine{No \string\printglossary\space + or \string\printglossaries\space + found.^^J(Remove \string\makeglossaries\space if you don't want + any glossaries.)^^JThis document will not have a glossary}% }% - }% - \renewcommand*{\glsdisplaynumberlist}[1]{% - \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% - {\@glsxtr@idx@displaynumberlist{##1}}% - {\@glsxtr@noidx@displaynumberlist{##1}}% - }% - \renewcommand*{\glsentrynumberlist}[1]{% - \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% - {\@glsxtr@idx@entrynumberlist{##1}}% - {\@glsxtr@noidx@entrynumberlist{##1}}% - }% - \renewcommand*{\glsnumberlistloop}[2]{% - \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% - {% - \PackageError{glossaries-extra}{\string\glsnumberlistloop\space - not available for glossary `##1'}{}% + \renewcommand{\@gls@noref@warn}[1]{% + \edef\@gls@type{##1}% + \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% + {% + \GlossariesExtraWarning{Can't use + \string\printnoidxglossary[type={\@gls@type}] + when `\@gls@type' is listed in the optional argument of + \string\makeglossaries}% + }% + {% + \GlossariesWarning{Empty glossary for + \string\printnoidxglossary[type={##1}]. + Rerun may be required (or you may have forgotten to use + commands like \string\gls)}% + }% }% - {\@glsxtr@noidx@numberlistloop{##1}{##2}}% - }% - \renewcommand*{\glsprestandardsort}[3]{% - \expandafter\DTLifinlist\expandafter{##2}{\@glsxtr@reg@glosslist}% - {% - \glsdosanitizesort + \renewcommand*{\glsdisplaynumberlist}[1]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {\@glsxtr@idx@displaynumberlist{##1}}% + {\@glsxtr@noidx@displaynumberlist{##1}}% }% - {% - \ifglssanitizesort - \@gls@noidx@sanitizesort - \else - \@gls@noidx@nosanitizesort - \fi + \renewcommand*{\glsentrynumberlist}[1]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {\@glsxtr@idx@entrynumberlist{##1}}% + {\@glsxtr@noidx@entrynumberlist{##1}}% }% - }% - \renewcommand*\new@glossaryentry[2]{% - \PackageError{glossaries-extra}{Glossary entries must be defined - in the preamble\MessageBreak when you use the optional argument - of \string\makeglossaries}{Either move your definitions to the - preamble or don't use the optional argument of - \string\makeglossaries}% - }% - \let\@glo@assign@sortkey\@glsxtr@mixed@assign@sortkey - \renewcommand*{\@printgloss@setsort}{% - \expandafter\@glsxtr@gettype\expandafter,\@glsxtr@printglossopts,% - type=\glsdefaulttype,\@end@glsxtr@gettype - \def\@glo@sorttype{\@glo@default@sorttype}% - }% - \ifglsautomake - \renewcommand*{\@gls@doautomake}{% - \@for\@gls@type:=\@glsxtr@reg@glosslist\do{% - \ifdefempty{\@gls@type}{}{\@gls@automake{\@gls@type}}% + \renewcommand*{\glsnumberlistloop}[2]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {% + \PackageError{glossaries-extra}{\string\glsnumberlistloop\space + not available for glossary `##1'}{}% }% + {\@glsxtr@noidx@numberlistloop{##1}{##2}}% }% - \fi - \ifdef\@glo@check@sortallowed{\@glo@check@sortallowed\makeglossaries}{}% - \fi + \renewcommand*{\glsprestandardsort}[3]{% + \expandafter\DTLifinlist\expandafter{##2}{\@glsxtr@reg@glosslist}% + {% + \glsdosanitizesort + }% + {% + \ifglssanitizesort + \@gls@noidx@sanitizesort + \else + \@gls@noidx@nosanitizesort + \fi + }% + }% + \renewcommand*\new@glossaryentry[2]{% + \PackageError{glossaries-extra}{Glossary entries must be defined + in the preamble\MessageBreak when you use the optional argument + of \string\makeglossaries}{Either move your definitions to the + preamble or don't use the optional argument of + \string\makeglossaries}% + }% + \let\@glo@assign@sortkey\@glsxtr@mixed@assign@sortkey + \renewcommand*{\@printgloss@setsort}{% + \expandafter\@glsxtr@gettype\expandafter,\@glsxtr@printglossopts,% + type=\glsdefaulttype,\@end@glsxtr@gettype + \def\@glo@sorttype{\@glo@default@sorttype}% + }% + \ifglsautomake + \renewcommand*{\@gls@doautomake}{% + \@for\@gls@type:=\@glsxtr@reg@glosslist\do{% + \ifdefempty{\@gls@type}{}{\@gls@automake{\@gls@type}}% + }% + }% + \fi + \ifdef\@glo@check@sortallowed{\@glo@check@sortallowed\makeglossaries}{}% + \fi }% \fi } @@ -4032,13 +4087,23 @@ } \newcommand*{\glsxtrdisplayendlochook}[2]{} \newcommand*{\glsxtrlocrangefmt}{} +\renewcommand*{\setentrycounter}[2][]{% + \def\glsxtrcounterprefix{#1}% + \ifx\glsxtrcounterprefix\@empty + \def\@glo@counterprefix{.}% + \else + \def\@glo@counterprefix{.#1.}% + \fi + \def\glsentrycounter{#2}% +} \def\@gls@removespaces#1 #2\@nil{% \toks@=\expandafter{\the\toks@#1}% \ifx\\#2\\% \edef\x{\the\toks@}% \ifx\x\empty \else - \glsxtrlocationhyperlink{\glsentrycounter}{\@glo@counterprefix}{\the\toks@}% + \expandafter\glsxtrlocationhyperlink\expandafter + \glsentrycounter\expandafter\@glo@counterprefix\expandafter{\the\toks@}% \fi \else \@gls@ReturnAfterFi{% @@ -4049,7 +4114,7 @@ \newcommand*{\glsxtrlocationhyperlink}[3]{% \ifdefvoid\glsxtrsupplocationurl {% - \glsxtrhyperlink{#1#2#3}{#3}% + \GlsXtrInternalLocationHyperlink{#1}{#2}{#3}% }% {% \hyperref{\glsxtrsupplocationurl}{}{#1#2#3}{#3}% |