diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx | 503 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins | 2 |
2 files changed, 473 insertions, 32 deletions
diff --git a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx index 6da097fcf8f..1457cb7202d 100644 --- a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx +++ b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx @@ -1,14 +1,14 @@ %\iffalse % glossaries-extra.dtx generated using makedtx version 1.1 (c) Nicola Talbot % Command line args: +% -section "chapter" % -src "glossaries-extra.sty\Z=>glossaries-extra.sty" % -src "glossaries-extra-stylemods.sty\Z=>glossaries-extra-stylemods.sty" +% -doc "glossaries-extra-codedoc.tex" % -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})" -% -section "chapter" % -author "Nicola Talbot" -% -doc "glossaries-extra-codedoc.tex" % glossaries-extra -% Created on 2016/8/15 14:38 +% Created on 2016/12/13 13:52 %\fi %\iffalse %<*package> @@ -118,7 +118,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of \setcounter{IndexColumns}{2} -\CheckSum{9639} +\CheckSum{9923} \newcommand*{\ifirstuse}{\iterm{first use}} \newcommand*{\firstuse}{\gls{firstuse}} @@ -154,13 +154,13 @@ styles (glossaries):>#1={\protect\ttfamily#1}|main}} \raggedright } -\title{glossaries-extra.sty v1.07: +\title{glossaries-extra.sty v1.08: documented code} \author{Nicola L.C. Talbot\\[10pt] Dickimaw Books\\ \url{http://www.dickimaw-books.com/}} -\date{2016-08-15} +\date{2016-12-13} \begin{document} \DocInput{glossaries-extra.dtx} @@ -205,7 +205,7 @@ Dickimaw Books\\ %\section{Package Initialisation and Options} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-extra}[2016/08/15 v1.07 (NLCT)] +\ProvidesPackage{glossaries-extra}[2016/12/13 v1.08 (NLCT)] % \end{macrocode} % Requires \sty{xkeyval} to define package options. % \begin{macrocode} @@ -281,26 +281,214 @@ Dickimaw Books\\ % unwanted text inserted into the preamble if any tests are made % before the start of the document. %\end{macro} +% +%\begin{macro}{\@glsxtr@warn@undefaction} +%This is how \cs{glsxtrundefaction} should behave if +%\pkgopt[warn]{undefaction} is set. +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@warn@undefaction}[2]{% + \@glsxtrundeftag\GlossariesExtraWarning{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@err@undefaction} +%This is how \cs{glsxtrundefaction} should behave if +%\pkgopt[error]{undefaction} is set. +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@err@undefaction}[2]{% + \@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@warn@onexistsordo} +%This is how \cs{glsxtr@warnonexistsordo} should behave if +%\pkgopt[warn]{undefaction} is set. +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@warn@onexistsordo}[1]{% + \GlossariesExtraWarning{glossaries-extra}{% + \string#1\space hasn't been defined, so + some errors won't be converted to warnings. + (This most likely means your version of + glossaries.sty is below version 4.19.)}% +} +% \end{macrocode} +%\end{macro} +% % \begin{macrocode} \define@choicekey{glossaries-extra.sty}{undefaction}[\val\nr]% {warn,error}% {% \ifcase\nr\relax - \renewcommand*{\glsxtrundefaction}[2]{% - \@glsxtrundeftag\GlossariesExtraWarning{##1}% + \let\glsxtrundefaction\@glsxtr@warn@undefaction + \let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo + \or + \let\glsxtrundefaction\@glsxtr@err@undefaction + \let\glsxtr@warnonexistsordo\@gobble + \fi + } +% \end{macrocode} +% +%In the event that someone wants to develop a post-processor +%that needs to know what entries have been used in the document, +%v1.08 introduces the \pkgopt{record} option, which will write +%information to the aux file whenever an entry needs to be indexed. +% +%\begin{macro}{\@glsxtr@record} +%\changes{1.08}{2016-12-13}{new} +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\@glsxtr@record}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsxtr@record} +%\changes{1.08}{2016-12-13}{new} +%This is the actual code that does the recording +%The first argument is the option list (as passed in the first optional +%argument to commands like \cs{gls}). This allows the \gloskey[glslink]{noindex} +%setting to be picked up. +% \begin{macrocode} +\newcommand*{\@@glsxtr@record}[2]{% + \begingroup + \def\@glsnumberformat{glsnumberformat}% + \ifcsdef{glo@#2@counter}% + {% + \edef\@gls@counter{\csname glo@#2@counter\endcsname}% + }% + {% +% \end{macrocode} +%Entry hasn't been defined, so we'll have to assume the page number by +%default. +% \begin{macrocode} + \def\@gls@counter{page}% + }% + \setkeys{glslink}{#1}% + \ifKV@glslink@noindex + \else + \glswriteentry{#2}% + {% +% \end{macrocode} +%Save the entry counter. +% \begin{macrocode} + \glsxtr@saveentrycounter +% \end{macrocode} +%Temporarily redefine \cs{@@do@@wrglossary} so we can use +%\cs{glsxtr@@do@wrglossary}. +% \begin{macrocode} + \let\@@do@@wrglossary\@glsxtr@dorecord + \glsxtr@@do@wrglossary{#2}% + }% + \fi + \endgroup +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@dorecord} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*\@glsxtr@dorecord{% + \protected@write\@auxout{}{\string\glsxtr@record + {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}% + {\@glslocref}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@record} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@record}[5]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@setup@record} +%\changes{1.08}{2016-12-13}{new} +%Initialise. +% \begin{macrocode} +\newcommand*{\glsxtr@setup@record}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@indexonly@saveentrycounter} +%\changes{1.08}{2016-12-13}{new} +% Only store the entry counter information if the +%indexing is on. +% \begin{macrocode} +\newcommand*{\glsxtr@indexonly@saveentrycounter}{% + \ifKV@glslink@noindex + \else + \glsxtr@saveentrycounter + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@addloclistfield} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@addloclistfield}{% + \key@ifundefined{glossentry}{loclist}% + {% + \define@key{glossentry}{loclist}{\def\@glo@loclist{##1}}% + \appto\@gls@keymap{,{loclist}{loclist}}% + \appto\@newglossaryentryprehook{\def\@glo@loclist{}}% + \appto\@newglossaryentryposthook{% + \gls@assign@field{}{\@glo@label}{loclist}{\@glo@loclist}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%Now define the \pkgopt{record} package option. +%\changes{1.08}{2016-12-13}{added \pkgopt{record} package option} +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{record}[\val\nr]% + {off,only,alsoindex}% + [only]% + {% + \ifcase\nr\relax +% \end{macrocode} +%Don't record. +% \begin{macrocode} + \def\glsxtr@setup@record{% + \renewcommand*{\@glsxtr@record}[2]{}% + \let\@@do@wrglossary\glsxtr@@do@wrglossary + \let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter + \let\glsxtrundefaction\@glsxtr@err@undefaction + \let\glsxtr@warnonexistsordo\@gobble }% - \renewcommand*{\glsxtr@warnonexistsordo}[1]{% - \GlossariesExtraWarning{glossaries-extra}{% - \string##1\space hasn't been defined, so - some errors won't be converted to warnings. - (This most likely means your version of - glossaries.sty is below version 4.19.)}% + \or +% \end{macrocode} +%Only record (don't index). +% \begin{macrocode} + \def\glsxtr@setup@record{% + \let\@glsxtr@record\@@glsxtr@record + \let\@@do@wrglossary\@gobble + \let\@gls@saveentrycounter\relax + \let\glsxtrundefaction\@glsxtr@warn@undefaction + \let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo + \glsxtr@addloclistfield }% \or - \renewcommand*{\glsxtrundefaction}[2]{% - \@glsxtrundeftag\PackageError{glossaries-extra}{##1}{##2}% +% \end{macrocode} +%Record and index. +% \begin{macrocode} + \def\glsxtr@setup@record{% + \let\@glsxtr@record\@@glsxtr@record + \let\@@do@wrglossary\glsxtr@@do@wrglossary + \let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter + \let\glsxtrundefaction\@glsxtr@warn@undefaction + \let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo + \glsxtr@addloclistfield }% - \renewcommand*{\glsxtr@warnonexistsordo}[1]{}% \fi } % \end{macrocode} @@ -737,22 +925,54 @@ Dickimaw Books\\ % Now define the user command: % \begin{macrocode} \newcommand*{\glossariesextrasetup}[1]{% + \let\glsxtr@setup@record\relax \let\@glsxtr@setupshortcuts\relax \setkeys{glossaries-extra.sty}{#1}% \@glsxtr@abbreviationsdef \let\@glsxtr@abbreviationsdef\relax \@glsxtr@setupshortcuts + \glsxtr@setup@record } % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsxtr@@do@wrglossary} +%\changes{1.08}{2016-12-13}{new} +%Save original definition of \cs{@@do@wrglossary}. +% \begin{macrocode} +\let\glsxtr@@do@wrglossary\@@do@wrglossary +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@saveentrycounter} +%\changes{1.08}{2016-12-13}{new} +%Save original definition of \cs{@gls@saveentrycounter}. +% \begin{macrocode} +\let\glsxtr@saveentrycounter\@gls@saveentrycounter +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@saveentrycounter} +%\changes{1.08}{2016-12-13}{new} +%Change \cs{@gls@saveentrycounter} so that it only stores the entry +%counter information if the indexing is on. +% \begin{macrocode} +\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter +% \end{macrocode} +%\end{macro} +% +%Set up record option if required. +% \begin{macrocode} +\glsxtr@setup@record +% \end{macrocode} +% % Disable preamble-only options and switch on the undefined tag at % the start of the document. %\changes{1.06}{2016-06-18}{disabled docdef key at the start of the %document} % \begin{macrocode} \AtBeginDocument{% - \disable@keys{glossaries-extra.sty}{abbreviations,docdef}% + \disable@keys{glossaries-extra.sty}{abbreviations,docdef,record}% \def\@glsxtrundeftag{\glsxtrundeftag}% } % \end{macrocode} @@ -795,7 +1015,13 @@ Dickimaw Books\\ \renewcommand{\glsdoifexists}[2]{% \ifglsentryexists{#1}{#2}% {% - \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' +% \end{macrocode} +% Define \cs{glslabel} in case it's needed after this command (for +% example in the post-link hook). +%\changes{1.08}{2016-12-13}{now defines \cs{glslabel}} +% \begin{macrocode} + \edef\glslabel{\glsdetoklabel{#1}}% + \glsxtrundefaction{Glossary entry `\glslabel' has not been defined}{You need to define a glossary entry before you can reference it.}% }% @@ -1634,6 +1860,13 @@ Dickimaw Books\\ %\changes{0.3}{2015-12-02}{added optional argument} % \begin{macrocode} \renewcommand{\@gls@field@link}[4][]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the enter +%exists. +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#2}{#3}% \glsdoifexists{#3}% {% % \end{macrocode} @@ -1654,6 +1887,131 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%The commands \cs{gls}, \cs{Gls} etc don't use \cs{@gls@field@link}, +%so they need modifying as well to use \cs{@glsxtr@record}. +% +%\begin{macro}{\@gls@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@gls@\@gls@ +\def\@gls@#1#2{% + \@glsxtr@record{#1}{#2}% + \@glsxtr@org@gls@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glspl@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@glspl@\@glspl@ +\def\@glspl@#1#2{% + \@glsxtr@record{#1}{#2}% + \@glsxtr@org@glspl@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Gls@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@Gls@\@Gls@ +\def\@Gls@#1#2{% + \@glsxtr@record{#1}{#2}% + \@glsxtr@org@Gls@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glspl@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@Glspl@\@Glspl@ +\def\@Glspl@#1#2{% + \@glsxtr@record{#1}{#2}% + \@glsxtr@org@Glspl@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLS@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@GLS@\@GLS@ +\def\@GLS@#1#2{% + \@glsxtr@record{#1}{#2}% + \@glsxtr@org@GLS@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSpl@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@GLSpl@\@GLSpl@ +\def\@GLS@#1#2{% + \@glsxtr@record{#1}{#2}% + \@glsxtr@org@GLSpl@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdispl} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@glsdisp\@glsdisp +\renewcommand*{\@glsdisp}[3][]{% + \@glsxtr@record{#1}{#2}% + \@glsxtr@org@glsdisp[#1]{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@@link@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Redefine to include \cs{@glsxtr@record} +% \begin{macrocode} +\renewcommand*{\@gls@@link}[3][]{% + \@glsxtr@record{#1}{#2}% + \glsdoifexistsordo{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax + \@gls@link[#1]{#2}{#3}% + }% + {% + \glstextformat{#3}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsadd} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Redefine to include \cs{@glsxtr@record} +% \begin{macrocode} +\renewrobustcmd*{\glsadd}[2][]{% + \@gls@adjustmode + \@glsxtr@record{#1}{#2}% + \glsdoifexists{#2}% + {% + \def\@glsnumberformat{glsnumberformat}% + \edef\@gls@counter{\csname glo@\glsdetoklabel{#2}@counter\endcsname}% + \setkeys{glossadd}{#1}% + \@gls@saveentrycounter + \@@do@wrglossary{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@glsxtr@field@linkdefs} % Default settings for \cs{@gls@field@link} %\changes{0.3}{2015-12-02}{new} @@ -1672,19 +2030,26 @@ Dickimaw Books\\ %required. %\begin{macro}{\glsxtrassignfieldfont} %\changes{1.04}{2016-05-02}{new} +%\changes{1.08}{2016-12-13}{added check for existence} % \begin{macrocode} \newcommand*{\glsxtrassignfieldfont}[1]{% - \ifglshasshort{#1}% + \ifglsentryexists{#1}% {% - \glssetabbrvfmt{\glscategory{#1}}% - \glsifregular{#1}% - {\let\@gls@field@font\glsxtrregularfont}% - {\let\@gls@field@font\@firstofone}% + \ifglshasshort{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsifregular{#1}% + {\let\@gls@field@font\glsxtrregularfont}% + {\let\@gls@field@font\@firstofone}% + }% + {% + \glsifnotregular{#1}% + {\let\@gls@field@font\@firstofone}% + {\let\@gls@field@font\glsxtrregularfont}% + }% }% {% - \glsifnotregular{#1}% - {\let\@gls@field@font\@firstofone}% - {\let\@gls@field@font\glsxtrregularfont}% + \let\@gls@field@font\@gobble }% } % \end{macrocode} @@ -4686,8 +5051,7 @@ Dickimaw Books\\ \def\warn@noprintglossary{% \GlossariesWarningNoLine{No \string\printglossary\space or \string\printglossaries\space - found.^^J(Remove \string\makeglossaries\space if you don't -want + found.^^J(Remove \string\makeglossaries\space if you don't want any glossaries.)^^JThis document will not have a glossary}% }% % \end{macrocode} @@ -5143,6 +5507,83 @@ want % \end{macrocode} %\end{macro} % +%Provide some commands to accompany the \pkgopt{record} option. +%\begin{macro}{\glsxtrresourcefile} +%\changes{1.08}{2016-12-13}{new} +%This is provided for the benefit of any external helper +%application. +% \begin{macrocode} +\newcommand*{\glsxtrresourcefile}[2][]{% + \protected@write\@auxout{}{\string\glsxtr@resource{#1}{#2}}% + \InputIfFileExists{#2}{}% + {% + \GlossariesExtraWarning{No file `#2'}% + }% +} +\@onlypreamble\glsxtrresourcefile +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@resource} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@resource}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossary} +%\changes{1.08}{2016-12-13}{new} +%Similar to \cs{printnoidxglossary} but it displays all entries +%defined for the given glossary without sorting. +% \begin{macrocode} +\newcommand*{\printunsrtglossary}[1][type=\glsdefaulttype]{% + \@printglossary{#1}{\@print@unsrt@glossary}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaries} +%\changes{1.08}{2016-12-13}{new} +%Similar to \cs{printnoidxglossaries} but it displays all entries +%defined for the given glossary without sorting. +% \begin{macrocode} +\newcommand*{\printunsrtglossaries}{% + \forallglossaries{\@@glo@type}{\printunsrtglossary[type=\@@glo@type]}% +} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\@print@unsrt@glossary} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\@print@unsrt@glossary}{% + \glossarysection[\glossarytoctitle]{\glossarytitle}% + \glossarypreamble +% \end{macrocode} +%check for empty list +% \begin{macrocode} + \ifcsempty{glolist@\@glo@type} + {% + \GlossariesExtraWarning{No entries defined in glossary `\@glo@type'}% + }% + {% + \begin{theglossary}% + \glossaryheader + \glsresetentrylist + \def\@gls@currentlettergroup{}% + \expandafter\@for\expandafter\glscurrententrylabel\expandafter + :\expandafter=\csname glolist@\@glo@type\endcsname\do{% + \ifdefempty{\glscurrententrylabel} + {}% + {\@gls@noidx@do\glscurrententrylabel}% + }% + \end{theglossary}% + }% + \glossarypostamble +} +% \end{macrocode} +%\end{macro} +% %\section{Integration with glossaries-accsupp} % Provide better integration with the \sty{glossaries-accsupp} % package. (Must be loaded before the main code of @@ -12220,7 +12661,7 @@ want % First identify package: % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-extra-stylemods}[2016/08/15 v1.07 (NLCT)] +\ProvidesPackage{glossaries-extra-stylemods}[2016/12/13 v1.08 (NLCT)] % \end{macrocode} % Provide package options to automatically load required predefined % styles. The simplest method is to just test for the existence of diff --git a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins index 7af1d451334..293c09c34c3 100644 --- a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins +++ b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins @@ -1,4 +1,4 @@ -% glossaries-extra.ins generated using makedtx version 1.1 2016/8/15 14:38 +% glossaries-extra.ins generated using makedtx version 1.1 2016/12/13 13:52 \input docstrip \preamble |