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 | 149 |
1 files changed, 126 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty index c5500251e64..a4ac2be7ca5 100644 --- a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty +++ b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty @@ -7,7 +7,7 @@ %% glossaries.dtx (with options: `glossaries.sty,package') %% %% glossaries.dtx -%% Copyright 2019 Nicola Talbot +%% Copyright 2020 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries}[2019/12/06 v4.44 (NLCT)] +\ProvidesPackage{glossaries}[2020/02/13 v4.45 (NLCT)] \RequirePackage{ifthen} \RequirePackage{xkeyval}[2006/11/18] \RequirePackage{mfirstuc} @@ -71,8 +71,9 @@ \fi \newif\if@gls@debug \define@choicekey{glossaries.sty}{debug}[\gls@debug@val\gls@debug@nr]% - {true,false,showtargets}[true]{% + {true,false,showtargets,showaccsupp}[true]{% \ifcase\gls@debug@nr\relax + % debug=true \@gls@debugtrue \renewcommand*{\GlossariesWarning}[1]{% \PackageWarning{glossaries}{##1}% @@ -83,10 +84,13 @@ \let\@glsshowtarget\@gobble \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}% \or + % debug=false \@gls@debugfalse \let\@glsshowtarget\@gobble + \let\@glsshowaccsupp\@gobblethree \PackageInfo{glossaries}{debug mode OFF}% \or + % debug=showtargets \@gls@debugtrue \renewcommand*{\GlossariesWarning}[1]{% \PackageWarning{glossaries}{##1}% @@ -95,21 +99,49 @@ \PackageWarningNoLine{glossaries}{##1}% }% \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}% - \renewcommand{\@glsshowtarget}{\glsshowtarget}% + \renewcommand{\@glsshowtarget}{\@@glsshowtarget}% + \or + % debug=showaccsupp + \@gls@debugtrue + \renewcommand*{\GlossariesWarning}[1]{% + \PackageWarning{glossaries}{##1}% + }% + \renewcommand*{\GlossariesWarningNoLine}[1]{% + \PackageWarningNoLine{glossaries}{##1}% + }% + \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}% + \renewcommand{\@glsshowaccsupp}{\glsshowaccsupp}% \fi } \newcommand*{\glsshowtarget}[1]{% \ifmmode - \nfss@text{\ttfamily\small [#1]}% + \nfss@text{\glsshowtargetfont [#1]}% \else \ifinner - \texttt{\small [#1]}% + {\glsshowtargetfont [#1]}% \else - \marginpar{\texttt{\small #1}}% + \glsshowtargetouter{#1}% \fi \fi } +\newcommand*{\glsshowtargetouter}[1]{% + \glsshowtargetsymbol\marginpar{\glsshowtargetsymbol\glsshowtargetfont #1}} +\newcommand*{\glsshowtargetsymbol}{{\tiny$\triangleright$}} +\newcommand*{\glsshowtargetfont}{\ttfamily\footnotesize} \newcommand*{\@glsshowtarget}[1]{} +\newrobustcmd*{\@@glsshowtarget}[1]{% + \begingroup + \protected@edef\@gls@tmp{#1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\glsshowtarget\expandafter{\@gls@tmp}% + \endgroup +} +\newcommand*{\@glsshowaccsupp}[3]{} +\newrobustcmd*{\glsshowaccsupp}[3]{% + \ifstrempty{#1}% + {\@@glsshowtarget{/#2 (#3)}}% + {\@@glsshowtarget{/#2 (#3) [#1]}}% +} \newcommand*{\@gls@see@noindex}{% \PackageError{glossaries}% {`\gls@xr@key' key may only be used after \string\makeglossaries\space @@ -409,7 +441,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \newcommand*{\@gls@do@acronymsdef}{} \@gls@declareoption{acronyms}{% \glsacronymtrue - \renewcommand{\@gls@do@acronymsdef}{% + \def\@gls@do@acronymsdef{% \DeclareAcronymList{acronym}% \newglossary[alg]{acronym}{acr}{acn}{\acronymname}% \renewcommand*{\acronymtype}{acronym}% @@ -436,9 +468,9 @@ false,nolabel,autolabel,nameref}[nolabel]{% } \newcommand{\@gls@islistofacronyms}[4]{% \def\gls@islistofacronyms##1,#1,##2\end@gls@islistofacronyms{% - \def\@before{##1}\def\@after{##2}}% + \def\@gls@before{##1}\def\@gls@after{##2}}% \gls@islistofacronyms,#2,#1,\@nil\end@gls@islistofacronyms - \ifx\@after\@nnil + \ifx\@gls@after\@nnil #4% \else #3% @@ -826,6 +858,58 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsxindytrue \gls@xindy@glsnumbersfalse } +\providecommand{\@domakeglossaries}[1]{#1} +\@gls@declareoption{disablemakegloss}{% + \ifdefequal\makeglossaries\@no@makeglossaries + {% + \GlossariesWarning{Option `disablemakegloss' has no effect + (\string\makenoidxglossaries\space has already been used)}% + }% + {% + \ifdefequal\@makeglossary\@gobble + {% + \GlossariesWarning{Option `disablemakegloss' has no effect + (\string\makeglossaries\space has already been used)}% + }% + {% + \renewcommand{\@domakeglossaries}[1]{% + \PackageInfo{glossaries}{\string\makeglossaries\space and + \string\makenoidxglossaries\space have been disabled}% + }% + }% + }% +} +\@gls@declareoption{restoremakegloss}{% + \ifdefequal\makeglossaries\@no@makeglossaries + {% + \GlossariesWarning{Option `restoremakegloss' has no effect + (\string\makenoidxglossaries\space has already been used)}% + }% + {% + \ifdefequal\@makeglossary\@gobble + {% + \GlossariesWarning{Option `restoremakegloss' has no effect + (\string\makeglossaries\space has already been used)}% + }% + {% + \PackageInfo{glossaries}{\string\makeglossaries\space and + \string\makenoidxglossaries\space have been restored}% + \let\@domakeglossaries\@firstofone + }% + }% +} +\newcommand*{\@do@write@glslabels}{% + \AtEndDocument{\@@do@write@glslabels}% + \let\@do@write@glslabels\relax +} +\newcommand*{\@@do@write@glslabels}{% + \newwrite\@gls@labelsfile + \immediate\openout\@gls@labelsfile=\jobname.glslabels + \forallglsentries[\@glo@types,\@ignored@glossaries]{\@glsentry}% + {\ifdefempty{\@glsentry}{}{\immediate\write\@gls@labelsfile{\@glsentry}}}% + \immediate\closeout\@gls@labelsfile +} +\@gls@declareoption{writeglslabels}{\@do@write@glslabels} \newif\ifglsautomake \newcommand{\gls@automake@nr}{1} \define@choicekey{glossaries.sty}{automake}% @@ -1671,7 +1755,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% {#2}% } -\newcommand{\ifglshaschildren}[3]{% +\newrobustcmd{\ifglshaschildren}[3]{% \glsdoifexists{#1}% {% \def\do@glshaschildren{#3}% @@ -1707,7 +1791,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {#2}% {#3}% } -\newcommand*{\ifglshassymbol}[3]{% +\newrobustcmd*{\ifglshassymbol}[3]{% \letcs{\@glo@symbol}{glo@\glsdetoklabel{#1}@symbol}% \ifdefempty\@glo@symbol {#3}% @@ -1717,7 +1801,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {#2}% }% } -\newcommand*{\ifglshaslong}[3]{% +\newrobustcmd*{\ifglshaslong}[3]{% \letcs{\@glo@long}{glo@\glsdetoklabel{#1}@long}% \ifdefempty\@glo@long {#3}% @@ -1727,7 +1811,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {#2}% }% } -\newcommand*{\ifglshasshort}[3]{% +\newrobustcmd*{\ifglshasshort}[3]{% \letcs{\@glo@short}{glo@\glsdetoklabel{#1}@short}% \ifdefempty\@glo@short {#3}% @@ -1737,7 +1821,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {#2}% }% } -\newcommand*{\ifglshasfield}[4]{% +\newrobustcmd*{\ifglshasfield}[4]{% \glsdoifexists{#2}% {% \letcs{\@glo@thisvalue}{glo@\glsdetoklabel{#2}@#1}% @@ -4560,7 +4644,14 @@ false,nolabel,autolabel,nameref}[nolabel]{% \@glo@text }% \else - \xmakefirstuc{\@glo@text}% + \expandafter\ifx\@gls@body\glsshortaccessdisplay\relax + {% + \let\glsentryshort\Glsentryshort + \@glo@text + }% + \else + \xmakefirstuc{\@glo@text}% + \fi \fi \fi \fi @@ -4614,8 +4705,11 @@ false,nolabel,autolabel,nameref}[nolabel]{% \@Gls@entry@field{#1}{firstpl}% } \newrobustcmd*{\@glsentrytitlecase}[2]{% - \glsfieldfetch{#1}{#2}{\@gls@value}% - \xcapitalisewords{\@gls@value}% + \glsdoifexists{#1}% + {% + \glsfieldfetch{#1}{#2}{\@gls@value}% + \xcapitalisewords{\@gls@value}% + }% } \ifdef\texorpdfstring { @@ -4632,6 +4726,9 @@ false,nolabel,autolabel,nameref}[nolabel]{% \newcommand*{\glsentrysort}[1]{% \@gls@entry@field{#1}{sort}% } +\newcommand*{\glsentryparent}[1]{% + \@gls@entry@field{#1}{parent}% +} \newcommand*{\glsentryuseri}[1]{% \@gls@entry@field{#1}{useri}% } @@ -5334,6 +5431,8 @@ false,nolabel,autolabel,nameref}[nolabel]{% \fi } \newcommand*{\makeglossaries}{% + \@domakeglossaries + {% \@gls@@automake@immediate \ifundef{\glswrite}{\newwrite\glswrite}{}% \protected@write\@auxout{}{\string\providecommand\string\@glsorder[1]{}} @@ -5357,7 +5456,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% 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\@gobble \let\makeglossaries\relax \@disable@onlypremakeg \let\gls@checkseeallowed\relax @@ -5393,6 +5492,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% \fi \@glo@check@sortallowed\makeglossaries + }% } \@onlypreamble{\makeglossaries} \AtEndDocument{% @@ -5400,6 +5500,8 @@ false,nolabel,autolabel,nameref}[nolabel]{% \warn@noprintglossary } \newcommand*{\makenoidxglossaries}{% + \@domakeglossaries + {% \renewcommand{\@gls@noref@warn}[1]{% \GlossariesWarning{Empty glossary for \string\printnoidxglossary[type={##1}]. @@ -5509,6 +5611,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \let\@@gls@nosanitizesort\@@gls@noidx@nosanitizesort \@gls@noidx@setsanitizesort \@glo@check@sortallowed\makenoidxglossaries + }% } \@onlypreamble{\makenoidxglossaries} \newcommand*{\glsnumberlistloop}[2]{% @@ -5792,13 +5895,13 @@ you \def\@@gls@fixbraces#1[#2]#3\@end@fixbraces{% \def#1{[#2]{#3}}% } -\DeclareRobustCommand*{\glssee}[3][\seename]{% +\newrobustcmd*{\glssee}[3][\seename]{% \@do@seeglossary{#2}{[#1]{#3}}} \newcommand*{\@glssee}[3][\seename]{% \glssee[#1]{#3}{#2}} -\DeclareRobustCommand*{\glsseeformat}[3][\seename]{% +\newrobustcmd*{\glsseeformat}[3][\seename]{% \emph{#1} \glsseelist{#2}} -\DeclareRobustCommand*{\glsseelist}[1]{% +\newrobustcmd*{\glsseelist}[1]{% \let\@gls@dolast\relax \let\@gls@donext\relax \@for\@gls@thislabel:=#1\do{% @@ -5814,7 +5917,7 @@ you } \newcommand*{\glsseelastsep}{\space\andname\space} \newcommand*{\glsseesep}{, } -\DeclareRobustCommand*{\glsseeitem}[1]{\glshyperlink[\glsseeitemformat{#1}]{#1}} +\newrobustcmd*{\glsseeitem}[1]{\glshyperlink[\glsseeitemformat{#1}]{#1}} \newcommand*{\glsseeitemformat}[1]{\glsentrytext{#1}} \newcommand*{\gls@save@numberlist}[1]{% \ifglssavenumberlist |