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 | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty index 0ee779c837d..3cf9b5fac70 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}[2015/09/09 v4.18 (NLCT)] +\ProvidesPackage{glossaries}[2015/11/22 v4.19 (NLCT)] \RequirePackage{ifthen} \RequirePackage{xkeyval}[2006/11/18] \RequirePackage{mfirstuc} @@ -1403,6 +1403,22 @@ false,nolabel,autolabel,nameref}[nolabel]{% has not been defined}% }% } +\newcommand{\glsdoifexistsordo}[3]{% + \ifglsentryexists{#1}{#2}{% + \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}' + has not been defined}{You need to define a glossary entry before you + can use it.}% + #3% + }% +} +\newcommand{\doifglossarynoexistsordo}[3]{% + \ifglossaryexists{#1}% + {% + \PackageError{glossaries}{Glossary type `#1' already exists}{}% + #3% + }% + {#2}% +} \newcommand{\ifglshaschildren}[3]{% \glsdoifexists{#1}% {% @@ -1525,17 +1541,14 @@ false,nolabel,autolabel,nameref}[nolabel]{% {% }% } +\newcommand*{\gls@gobbleopt}{\new@ifnextchar[{\@gls@gobbleopt}{}} +\def\@gls@gobbleopt[#1]{} \newcommand*{\newglossary}{\@ifstar\s@newglossary\ns@newglossary} \newcommand*{\s@newglossary}[2]{% \ns@newglossary[#1-glg]{#1}{#1-gls}{#1-glo}{#2}% } \newcommand*{\ns@newglossary}[5][glg]{% - \ifglossaryexists{#2}% - {% - \PackageError{glossaries}{Glossary type `#2' already exists}{% - You can't define a new glossary called `#2' because it already - exists}% - }% + \doifglossarynoexistsordo{#2}% {% \ifundef\glsdefaulttype {% @@ -1559,7 +1572,11 @@ false,nolabel,autolabel,nameref}[nolabel]{% {}% \@gls@defsortcount{#2}% \@ifnextchar[{\@gls@setcounter{#2}}% - {\@gls@setcounter{#2}[\glscounter]}}% + {\@gls@setcounter{#2}[\glscounter]}% + }% + {% + \gls@gobbleopt + }% } \newcommand*{\altnewglossary}[3]{% \newglossary[#2-glg]{#1}{#2-gls}{#2-glo}{#3}% @@ -3048,14 +3065,11 @@ false,nolabel,autolabel,nameref}[nolabel]{% \@gls@hyp@opt\@gls@@link } \newcommand*{\@gls@@link}[3][]{% - \ifglsentryexists{#2}% + \glsdoifexistsordo{#2}% {% \let\do@gls@link@checkfirsthyper\relax \@gls@link[#1]{#2}{#3}% }{% - \PackageError{glossaries}{Glossary entry `#2' has not been - defined}{You need to define a glossary entry before you - can use it.}% \glstextformat{#3}% }% \glspostlinkhook @@ -3082,6 +3096,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \newcommand*{\glslinkcheckfirsthyperhook}{} \newcommand*{\glslinkpostsetkeys}{} \newcommand{\glsifhyperon}[2]{\ifKV@glslink@hyper#1\else#2\fi} +\newcommand*{\do@glsdisablehyperinlist}{% + \expandafter\DTLifinlist\expandafter{\glstype}{\@gls@nohyperlist}% + {\KV@glslink@hyperfalse}{}% +} \def\@gls@link[#1]#2#3{% \leavevmode \edef\glslabel{\glsdetoklabel{#2}}% @@ -3091,13 +3109,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}% \edef\glstype{\csname glo@\glslabel @type\endcsname}% \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper - \expandafter\DTLifinlist\expandafter - {\glstype}{\@gls@nohyperlist}% - {% - \KV@glslink@hyperfalse - }% - {% - }% + \do@glsdisablehyperinlist \do@gls@link@checkfirsthyper \setkeys{glslink}{#1}% \glslinkpostsetkeys @@ -3667,10 +3679,11 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% \glspostlinkhook } +\newcommand*{\@gls@link@nocheckfirsthyper}{} \newcommand{\@gls@field@link}[3]{% \glsdoifexists{#2}% {% - \let\do@gls@link@checkfirsthyper\relax + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper \@gls@link[#1]{#2}{#3}% }% \glspostlinkhook @@ -4179,16 +4192,21 @@ false,nolabel,autolabel,nameref}[nolabel]{% \letcs{#1}{glo@\glsdetoklabel{#2}@#3}% } \newcommand*{\@Gls@entry@field}[2]{% - \letcs\@glo@text{glo@\glsdetoklabel{#1}@#2}% - \ifdef\@glo@text + \glsdoifexistsordo{#1}% {% - \xmakefirstuc{\@glo@text}% + \letcs\@glo@text{glo@\glsdetoklabel{#1}@#2}% + \ifdef\@glo@text + {% + \xmakefirstuc{\@glo@text}% + }% + {% + ??\PackageError{glossaries}{The field `#2' doesn't exist for glossary + entry `\glsdetoklabel{#1}'}{Check you have correctly spelt the entry + label and the field name}% + }% }% {% - \PackageError{glossaries}{Either glossary entry - `\glsdetoklabel{#1}' doesn't exist or the field `#2' - doesn't exist}{Check you have correctly spelt the entry - label and the field name}% + ??% }% } \newcommand*{\glsentryname}[1]{\@gls@entry@field{#1}{name}} @@ -4838,15 +4856,11 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsnoidxloclist{\@gls@loclist}% }% {% - \ifglsentryexists{##1}% + ??\glsdoifexists{##1}% {% \GlossariesWarning{Missing location list for `##1'. Either a rerun is required or you haven't referenced the entry.}% }% - {% - \PackageError{glossaries}{Glossary entry `##1' has not been - defined.}{}% - }% }% }% \renewcommand*{\glsdisplaynumberlist}[1]{% @@ -4868,15 +4882,11 @@ false,nolabel,autolabel,nameref}[nolabel]{% \@gls@noidxloclist@prev }% {% - ??\ifglsentryexists{##1}% + ??\glsdoifexists{##1}% {% \GlossariesWarning{Missing location list for `##1'. Either a rerun is required or you haven't referenced the entry.}% }% - {% - \PackageError{glossaries}{Glossary entry `##1' has not been - defined.}{}% - }% }% }% \renewcommand*{\glsnumberlistloop}[3]{% @@ -4890,15 +4900,11 @@ false,nolabel,autolabel,nameref}[nolabel]{% \forlistloop{\glsnoidxnumberlistloophandler}{\@gls@loclist}% }% {% - \ifglsentryexists{##1}% + ??\glsdoifexists{##1}% {% \GlossariesWarning{Missing location list for `##1'. Either a rerun is required or you haven't referenced the entry.}% }% - {% - \PackageError{glossaries}{Glossary entry `##1' has not been - defined.}{}% - }% }% \let\glsnoidxdisplayloc\@gls@org@glsnoidxdisplayloc \let\glsseeformat\@gls@org@glsseeformat @@ -5212,6 +5218,7 @@ you \forallglossaries{\@@glo@type}{\printnoidxglossary[type=\@@glo@type]}% } \newcommand*{\@printgloss@setsort}{} +\newcommand*{\@gls@preglossaryhook}{} \newcommand{\@printglossary}[2]{% \def\@glo@type{\glsdefaulttype}% \def\glossarytitle{\csname @glotype@\@glo@type @title\endcsname}% @@ -5245,6 +5252,7 @@ you \xdef\glscurrententrylabel{\glsdetoklabel{##2}}% \gls@org@glossarysubentryfield{##1}{##2}% }% + \@gls@preglossaryhook #2% \egroup \global\let\glossaryentrynumbers\@org@glossaryentrynumbers |