diff options
author | Karl Berry <karl@freefriends.org> | 2014-11-24 23:04:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-11-24 23:04:03 +0000 |
commit | f8afa087413b6c1c7901b309057f715e8f6dc12a (patch) | |
tree | 7774fcf0fe11e151874b45bcc01ab171dad4b44f /Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty | |
parent | 226ee7542cb7aebf33c102943c20102bca7e9db3 (diff) |
glossaries (24nov14)
git-svn-id: svn://tug.org/texlive/trunk@35657 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty | 245 |
1 files changed, 144 insertions, 101 deletions
diff --git a/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty b/Master/texmf-dist/tex/latex/glossaries/base/glossaries.sty index e4d3b618e06..4daea084152 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, glossaries-prefix.sty, mfirstuc.sty, mfirstuc-english.sty, glossary-hypernav.sty, glossary-inline.sty, glossary-list.sty, glossary-long.sty, glossary-longragged.sty, glossary-mcols.sty, glossary-super.sty, glossary-superragged.sty, glossary-tree.sty, glossaries-compatible-207.sty, glossaries-compatible-307.sty, glossaries-accsupp.sty, glossaries-babel.sty, glossaries-polyglossia.sty, glossaries-dictionary-Brazilian.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-Serbian.dict, glossaries-dictionary-Spanish.dict, minimalgls.tex, glossary-lipsum-examples.tex, example-glossaries-acronym-desc.tex, example-glossaries-acronym.tex, example-glossaries-acronyms-lang.tex, example-glossaries-brief.tex, example-glossaries-childnoname.tex, example-glossaries-cite.tex, example-glossaries-images.tex, example-glossaries-long.tex, example-glossaries-multipar.tex, example-glossaries-parent.tex, example-glossaries-symbols.tex, example-glossaries-url.tex, sample-crossref.tex, sample-custom-acronym.tex, sample-dual.tex, sample-entryfmt.tex, sample-FnDesc.tex, sample-ignored.tex, sample-index.tex, sample-inline.tex, sample-langdict.tex, sample-mfirstuc.tex, sample-newkeys.tex, sample-noidxapp-utf8.tex, sample-noidxapp.tex, sample-nomathhyper.tex, sample-numberlist.tex, sample-prefix.tex, sample-si.tex, sample.tex, sample4col.tex, sampleaccsupp.tex, sampleAcr.tex, sampleAcrDesc.tex, sampleacronyms.tex, sampleCustomAcr.tex, sampleDB.tex, sampleDesc.tex, sampleEq.tex, sampleEqPg.tex, sampleFnAcrDesc.tex, sampleNtn.tex, samplePeople.tex, sampleSec.tex, sampleSort.tex, sampletree.tex, sampleutf8.tex, samplexdy.tex, samplexdy2.tex, samplexdy-mc.xdy, samplexdy-mc207.xdy, database1.tex, database2.tex, glossaries.perl, mfirstuc.perl. +%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, glossaries-prefix.sty, mfirstuc.sty, mfirstuc-english.sty, glossary-hypernav.sty, glossary-inline.sty, glossary-list.sty, glossary-long.sty, glossary-longragged.sty, glossary-mcols.sty, glossary-super.sty, glossary-superragged.sty, glossary-tree.sty, glossaries-compatible-207.sty, glossaries-compatible-307.sty, glossaries-accsupp.sty, glossaries-babel.sty, glossaries-polyglossia.sty, minimalgls.tex, glossary-lipsum-examples.tex, example-glossaries-acronym-desc.tex, example-glossaries-acronym.tex, example-glossaries-acronyms-lang.tex, example-glossaries-brief.tex, example-glossaries-childnoname.tex, example-glossaries-cite.tex, example-glossaries-images.tex, example-glossaries-long.tex, example-glossaries-multipar.tex, example-glossaries-parent.tex, example-glossaries-symbols.tex, example-glossaries-url.tex, sample-crossref.tex, sample-custom-acronym.tex, sample-dual.tex, sample-entryfmt.tex, sample-FnDesc.tex, sample-ignored.tex, sample-index.tex, sample-inline.tex, sample-langdict.tex, sample-mfirstuc.tex, sample-newkeys.tex, sample-noidxapp-utf8.tex, sample-noidxapp.tex, sample-nomathhyper.tex, sample-numberlist.tex, sample-prefix.tex, sample-si.tex, sample.tex, sample4col.tex, sampleaccsupp.tex, sampleAcr.tex, sampleAcrDesc.tex, sampleacronyms.tex, sampleCustomAcr.tex, sampleDB.tex, sampleDesc.tex, sampleEq.tex, sampleEqPg.tex, sampleFnAcrDesc.tex, sampleNtn.tex, samplePeople.tex, sampleSec.tex, sampleSort.tex, sampletree.tex, sampleutf8.tex, samplexdy.tex, samplexdy2.tex, samplexdy-mc.xdy, samplexdy-mc207.xdy, database1.tex, database2.tex, glossaries.perl, mfirstuc.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}[2014/09/01 v4.11 (NLCT)] +\ProvidesPackage{glossaries}[2014/11/22 v4.12 (NLCT)] \RequirePackage{ifthen} \RequirePackage{xkeyval}[2006/11/18] \RequirePackage{mfirstuc} @@ -519,33 +519,84 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% } \newif\ifglstranslate -\newcommand*\@gls@notranslatorhook{} +\newcommand*\@gls@usetranslator{% + \@ifpackageloaded{polyglossia}% + {% + \let\glsifusetranslator\@secondoftwo + }% + {% + \@ifpackageloaded{babel}% + {% + \IfFileExists{translator.sty}% + {% + \RequirePackage{translator}% + \let\glsifusetranslator\@firstoftwo + }% + {}% + }% + {}% + }% +} +\newcommand{\glsifusedtranslatordict}[3]{% + \glsifusetranslator + {\ifcsdef{ver@glossaries-dictionary-#1.dict}{#2}{#3}}% + {#3}% +} \@gls@declareoption{notranslate}{% - \glstranslatefalse - \let\@gls@notranslatorhook\relax + \glstranslatefalse + \let\@gls@usetranslator\relax + \let\glsifusetranslator\@secondoftwo } \define@choicekey{glossaries.sty}{translate}[\val\nr]% {true,false,babel}[true]% {% \ifcase\nr\relax \glstranslatetrue + \renewcommand*\@gls@usetranslator{% + \@ifpackageloaded{polyglossia}% + {% + \let\glsifusetranslator\@secondoftwo + }% + {% + \@ifpackageloaded{babel}% + {% + \IfFileExists{translator.sty}% + {% + \RequirePackage{translator}% + \let\glsifusetranslator\@firstoftwo + }% + {}% + }% + {}% + }% + }% \or \glstranslatefalse - \let\@gls@notranslatorhook\relax + \let\@gls@usetranslator\relax + \let\glsifusetranslator\@secondoftwo \or - \glstranslatefalse - \def\@gls@notranslatorhook{\RequirePackage{glossaries-babel}}% + \glstranslatetrue + \let\@gls@usetranslator\relax + \let\glsifusetranslator\@secondoftwo \fi } \glstranslatefalse - \@ifpackageloaded{translator}% - {\glstranslatetrue}% +\let\glsifusetranslator\@secondoftwo +\@ifpackageloaded{translator}% +{% + \glstranslatetrue + \let\glsifusetranslator\@firstoftwo +}% +{% + \@for\gls@thissty:=tracklang,babel,ngerman,polyglossia\do + { + \@ifpackageloaded{\gls@thissty}% {% - \@ifpackageloaded{polyglossia}% - {\glstranslatetrue}% - {% - \@ifpackageloaded{babel}{\glstranslatetrue}{}% - }% + \glstranslatetrue + \@endfortrue + }% + {}% + } } \define@boolkey{glossaries.sty}[gls]{indexonlyfirst}[true]{} \glsindexonlyfirstfalse @@ -713,22 +764,6 @@ false,nolabel,autolabel,nameref}[nolabel]{% \@gls@do@symbolssdef \@gls@do@indexdef } -\ifglstranslate - \@ifpackageloaded{polyglossia}% - {% - }% - {% - \@ifpackageloaded{babel}% - {% - \IfFileExists{translator.sty}% - {% - \RequirePackage{translator}% - }% - {}% - }% - {} - } -\fi \ifthenelse{\equal{\glscounter}{section}}% {% \ifcsundef{chapter}{}% @@ -768,52 +803,67 @@ false,nolabel,autolabel,nameref}[nolabel]{% \providecommand*{\glssymbolsgroupname}{Symbols} \providecommand*{\glsnumbersgroupname}{Numbers} \newcommand*{\glspluralsuffix}{s} +\newcommand*{\glsacrpluralsuffix}{\glspluralsuffix} +\newcommand*{\glsupacrpluralsuffix}{\glstextup{\glsacrpluralsuffix}} \providecommand*{\seename}{see} \providecommand*{\andname}{\&} -\newcommand*{\addglossarytocaptions}[1]{% - \ifcsundef{captions#1}{}% +\newcommand*{\RequireGlossariesLang}[1]{% + \@ifundefined{ver@glossaries-#1.ldf}{\input{glossaries-#1.ldf}}{}% +} +\newcommand*{\ProvidesGlossariesLang}[1]{% + \ProvidesFile{glossaries-#1.ldf}% +} +\newcommand*{\addglossarytocaptions}[1]{} +\ifglstranslate + \RequirePackage{tracklang} + \@gls@usetranslator + \@ifpackageloaded{translator} + {% + \ifboolexpr + { + test {\ifdefstring{\trans@languages}{English}} + and not + test {\ifdefstring{bbl@loaded}{english}} + } + {% + \let\glsifusetranslator\@secondoftwo + }% + {% + \usedictionary{glossaries-dictionary}% + \renewcommand*{\addglossarytocaptions}[1]{% + \ifcsundef{captions#1}{}% + {% + \expandafter\let\expandafter\@gls@tmp\csname captions#1\endcsname + \expandafter\toks@\expandafter{\@gls@tmp + \renewcommand*{\glossaryname}{\translate{Glossary}}% + }% + \expandafter\edef\csname captions#1\endcsname{\the\toks@}% + }% + }% + }% + }% + {}% + \AnyTrackedLanguages {% - \expandafter\let\expandafter\@gls@tmp\csname captions#1\endcsname - \expandafter\toks@\expandafter{\@gls@tmp - \renewcommand*{\glossaryname}{\translate{Glossary}}% + \ForEachTrackedDialect{\this@dialect}{% + \IfTrackedLanguageFileExists{\this@dialect}% + {glossaries-}% prefix + {.ldf}% + {% + \RequireGlossariesLang{\CurrentTrackedTag}% + }% + {% + \PackageWarningNoLine{glossaries}% + {No language module detected for `\this@dialect'.\MessageBreak + Language modules need to be installed separately.\MessageBreak + Please check on CTAN for a bundle called\MessageBreak + `glossaries-\CurrentTrackedLanguage' or similar}% + }% }% - \expandafter\edef\csname captions#1\endcsname{\the\toks@}% }% -} -\ifglstranslate - \@ifpackageloaded{translator}{% - \usedictionary{glossaries-dictionary}% - \addglossarytocaptions{portuges}% - \addglossarytocaptions{portuguese}% - \addglossarytocaptions{brazil}% - \addglossarytocaptions{brazilian}% - \addglossarytocaptions{danish}% - \addglossarytocaptions{dutch}% - \addglossarytocaptions{afrikaans}% - \addglossarytocaptions{english}% - \addglossarytocaptions{UKenglish}% - \addglossarytocaptions{USenglish}% - \addglossarytocaptions{american}% - \addglossarytocaptions{australian}% - \addglossarytocaptions{british}% - \addglossarytocaptions{canadian}% - \addglossarytocaptions{newzealand}% - \addglossarytocaptions{french}% - \addglossarytocaptions{frenchb}% - \addglossarytocaptions{francais}% - \addglossarytocaptions{acadian}% - \addglossarytocaptions{canadien}% - \addglossarytocaptions{german}% - \addglossarytocaptions{germanb}% - \addglossarytocaptions{austrian}% - \addglossarytocaptions{naustrian}% - \addglossarytocaptions{ngerman}% - \addglossarytocaptions{irish}% - \addglossarytocaptions{italian}% - \addglossarytocaptions{magyar}% - \addglossarytocaptions{hungarian}% - \addglossarytocaptions{polish}% - \addglossarytocaptions{spanish}% + {}% + \glsifusetranslator + {% \renewcommand*{\glssettoctitle}[1]{% \ifcsdef{gls@tr@set@#1@toctitle}% {% @@ -835,15 +885,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \translate{Symbols (glossaries)}}% \renewcommand*{\glsnumbersgroupname}{% \translate{Numbers (glossaries)}}% - }{% - \@ifpackageloaded{polyglossia}% - {\RequirePackage{glossaries-polyglossia}}% - {% - \@ifpackageloaded{babel}{% - \RequirePackage{glossaries-babel}}{}% - }} -\else - \@gls@notranslatorhook + }{}% \fi \DeclareRobustCommand*{\nopostdesc}{} \newcommand*{\@nopostdesc}{% @@ -1008,7 +1050,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \newcommand*{\@gls@toc}[2]{% \ifglstoc \ifglsnumberline - \addcontentsline{toc}{#2}{\numberline{}#1}% + \addcontentsline{toc}{#2}{\protect\numberline{}#1}% \else \addcontentsline{toc}{#2}{#1}% \fi @@ -1122,6 +1164,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \GlsAddXdyAttribute{hypersl} \GlsAddXdyAttribute{hypersc} \GlsAddXdyAttribute{hyperemph} + \GlsAddXdyAttribute{glsignore} } \else \let\@gls@addpredefinedattributes\relax @@ -4034,6 +4077,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \define@key{glossadd}{format}{\def\@glsnumberformat{#1}} \define@key{glossadd}{types}{\def\@glo@type{#1}} \newrobustcmd*{\glsadd}[2][]{% + \@gls@adjustmode \glsdoifexists{#2}% {% \def\@glsnumberformat{glsnumberformat}% @@ -4043,6 +4087,8 @@ false,nolabel,autolabel,nameref}[nolabel]{% \@do@wrglossary{#2}% }% } +\newcommand*{\@gls@adjustmode}{} +\AtBeginDocument{\renewcommand*{\@gls@adjustmode}{\ifvmode\mbox{}\fi}} \newrobustcmd*{\glsaddall}[1][]{% \edef\@glo@type{\@glo@types}% \setkeys{glossadd}{#1}% @@ -4053,9 +4099,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \newrobustcmd*{\glsaddallunused}[1][\@glo@types]{% \forallglsentries[#1]{\@glo@entry}% {% - \ifglsused{\@glo@entry}{}{\glsadd[format=@gobble]{\@glo@entry}}% + \ifglsused{\@glo@entry}{}{\glsadd[format=glsignore]{\@glo@entry}}% }% } +\newcommand*{\glsignore}[1]{} \edef\glsopenbrace{\expandafter\@gobble\string\{} \edef\glsclosebrace{\expandafter\@gobble\string\}} \edef\glsbackslash{\expandafter\@gobble\string\\} @@ -5718,7 +5765,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% } \newcommand{\newacronym}[4][]{} -\newcommand*{\acrpluralsuffix}{\glspluralsuffix} +\newcommand*{\acrpluralsuffix}{\glsacrpluralsuffix} \newrobustcmd*{\glstextup}[1]{\ifdef\textulc{\textulc{#1}}{\textup{#1}}} \newcommand*{\glsshortkey}{short} \newcommand*{\glsshortpluralkey}{shortplural} @@ -5960,7 +6007,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {% \GlsUseAcrStyleDefs{long-short}% \renewcommand{\acronymfont}[1]{\textsc{##1}}% - \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% } \newacronymstyle{long-sm-short}% {% @@ -5969,7 +6016,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {% \GlsUseAcrStyleDefs{long-short}% \renewcommand{\acronymfont}[1]{\textsmaller{##1}}% - \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% } \newacronymstyle{sc-short-long}% {% @@ -5978,7 +6025,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {% \GlsUseAcrStyleDefs{short-long}% \renewcommand{\acronymfont}[1]{\textsc{##1}}% - \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% } \newacronymstyle{sm-short-long}% {% @@ -5987,7 +6034,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% {% \GlsUseAcrStyleDefs{short-long}% \renewcommand{\acronymfont}[1]{\textsmaller{##1}}% - \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% } \newacronymstyle{long-short-desc}% {% @@ -6132,7 +6179,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% \renewcommand*{\acronymsort}[2]{##1}% \renewcommand*{\acronymfont}[1]{##1}% - \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% } \newacronymstyle{dua-desc}% {% @@ -6170,7 +6217,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% \renewcommand*{\acronymsort}[2]{##1}% \renewcommand*{\acronymfont}[1]{##1}% - \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% \renewcommand*{\acrfullfmt}[3]{% \glslink[##1]{##2}{\acronymfont{\glsentryshort{##2}}##3\space (\glsentrylong{##2})}}% @@ -6208,7 +6255,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \GlsUseAcrStyleDefs{footnote}% \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}} \renewcommand{\acronymfont}[1]{\textsc{##1}}% - \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% }% \newacronymstyle{footnote-sm}% {% @@ -6218,7 +6265,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \GlsUseAcrStyleDefs{footnote}% \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}} \renewcommand{\acronymfont}[1]{\textsmaller{##1}}% - \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% }% \newacronymstyle{footnote-desc}% {% @@ -6333,7 +6380,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \newacronymhook \DefaultNewAcronymDef }% - \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% } \newcommand*{\acrfootnote}[3]{\acrlinkfootnote{#1}{#2}{#3}} \newcommand*{\acrlinkfootnote}[3]{% @@ -6424,8 +6471,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% \ifglsacrsmallcaps \renewcommand*{\acronymfont}[1]{\textsc{##1}}% - \renewcommand*{\acrpluralsuffix}{% - \glstextup{\glspluralsuffix}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% \else \ifglsacrsmaller \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}% @@ -6594,8 +6640,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% \ifglsacrsmallcaps \renewcommand{\acronymfont}[1]{\textsc{##1}} - \renewcommand*{\acrpluralsuffix}{% - \glstextup{\glspluralsuffix}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% \else \ifglsacrsmaller \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}% @@ -6687,8 +6732,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% \ifglsacrsmallcaps \renewcommand*{\acronymfont}[1]{\textsc{##1}}% - \renewcommand*{\acrpluralsuffix}{% - \glstextup{\glspluralsuffix}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% \else \ifglsacrsmaller \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}% @@ -6807,8 +6851,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% }% \ifglsacrsmallcaps \renewcommand*{\acronymfont}[1]{\textsc{##1}} - \renewcommand*{\acrpluralsuffix}{% - \glstextup{\glspluralsuffix}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% \else \renewcommand*{\acronymfont}[1]{\textsmaller{##1}} \fi |