summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx')
-rw-r--r--Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx263
1 files changed, 232 insertions, 31 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 24521881771..1a337c6e135 100644
--- a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx
+++ b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx
@@ -1,22 +1,22 @@
%\iffalse
% glossaries-extra.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
-% -doc "glossaries-extra-codedoc.tex"
-% -macrocode ".*\.tex"
-% -macrocode ".*\.bib"
+% -author "Nicola Talbot"
% -src "glossaries-extra.sty\Z=>glossaries-extra.sty"
% -src "glossaries-extra-stylemods.sty\Z=>glossaries-extra-stylemods.sty"
% -src "glossary-bookindex.sty\Z=>glossary-bookindex.sty"
% -src "(example-glossaries-.+\.tex)\Z=>\1"
% -src "(example-glossaries-.+\.bib)\Z=>\1"
% -setambles ".*\.bib=>\nopreamble\nopostamble"
-% -section "chapter"
-% -author "Nicola Talbot"
-% -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})"
+% -macrocode ".*\.tex"
+% -macrocode ".*\.bib"
% -comment ".*\.tex"
% -comment ".*\.bib"
+% -doc "glossaries-extra-codedoc.tex"
+% -section "chapter"
+% -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})"
% glossaries-extra
-% Created on 2017/11/8 17:23
+% Created on 2017/11/12 16:15
%\fi
%\iffalse
%<*package>
@@ -126,7 +126,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of
\setcounter{IndexColumns}{2}
-\CheckSum{20050}
+\CheckSum{20189}
\newcommand*{\ifirstuse}{\iterm{first use}}
\newcommand*{\firstuse}{\gls{firstuse}}
@@ -166,13 +166,13 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of
\raggedright
}
-\title{glossaries-extra.sty v1.22:
+\title{glossaries-extra.sty v1.23:
documented code}
\author{Nicola L.C. Talbot\\[10pt]
Dickimaw Books\\
\url{http://www.dickimaw-books.com/}}
-\date{2017-11-08}
+\date{2017-11-12}
\begin{document}
\DocInput{glossaries-extra.dtx}
@@ -217,7 +217,7 @@ Dickimaw Books\\
%\section{Package Initialisation and Options}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossaries-extra}[2017/11/08 v1.22 (NLCT)]
+\ProvidesPackage{glossaries-extra}[2017/11/12 v1.23 (NLCT)]
% \end{macrocode}
% Requires \sty{xkeyval} to define package options.
% \begin{macrocode}
@@ -1096,7 +1096,8 @@ Dickimaw Books\\
%\begin{macro}{\GlsXtrDefineAbbreviationShortcuts}
% Enable shortcut commands for the abbreviations. Unlike the analogous
% command provided by \styfmt{glossaries}, this uses \cs{newcommand}
-% instead of \cs{let} as a safety feature.
+% instead of \cs{let} as a safety feature (except for \cs{newabbr}
+% which is also provided with \cs{GlsXtrDefineAcShortcuts}).
% \begin{macrocode}
\newcommand*{\GlsXtrDefineAbbreviationShortcuts}{%
\newcommand*{\ab}{\cgls}%
@@ -1123,7 +1124,10 @@ Dickimaw Books\\
\newcommand*{\ALP}{\GLSxtrlongpl}%
\newcommand*{\AF}{\GLSxtrfull}%
\newcommand*{\AFP}{\GLSxtrfullpl}%
- \newcommand*{\newabbr}{\newabbreviation}%
+% \end{macrocode}
+%\changes{1.23}{2017-11-12}{changed \cs{newabbr} definition to use \cs{providecommand}}
+% \begin{macrocode}
+ \providecommand*{\newabbr}{\newabbreviation}%
% \end{macrocode}
% Disable this command after it's been used.
% \begin{macrocode}
@@ -1162,7 +1166,10 @@ Dickimaw Books\\
\newcommand*{\ACLP}{\GLSxtrlongpl}%
\newcommand*{\ACF}{\GLSxtrfull}%
\newcommand*{\ACFP}{\GLSxtrfullpl}%
- \newcommand*{\newabbr}{\newabbreviation}%
+% \end{macrocode}
+%\changes{1.23}{2017-11-12}{changed \cs{newabbr} definition to use \cs{providecommand}}
+% \begin{macrocode}
+ \providecommand*{\newabbr}{\newabbreviation}%
% \end{macrocode}
% Disable this command after it's been used.
% \begin{macrocode}
@@ -1804,24 +1811,88 @@ Dickimaw Books\\
%
%\begin{macro}{\glsxtrfmt}
%\changes{1.12}{2017-02-03}{new}
-%The post-link hook isn't done.
+%The post-link hook isn't done. This now has a starred form
+%that checks for a final optional argument.
% \begin{macrocode}
-\newrobustcmd*{\glsxtrfmt}[3][]{%
- \glsdoifexistsordo{#2}%
- {%
- \ifglshasfield{\GlsXtrFmtField}{#2}%
+\newrobustcmd*{\glsxtrfmt}{\@ifstar\s@glsxtrfmt\@glsxtrfmt}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@glsxtrfmt}
+%\changes{1.23}{2017-11-12}{new}
+%Unstarred form.
+% \begin{macrocode}
+\newcommand*{\@glsxtrfmt}[3][]{\@@glsxtrfmt{#1}{#2}{#3}{}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\s@glsxtrfmt}
+%\changes{1.23}{2017-11-12}{new}
+%Starred form.
+% \begin{macrocode}
+\newcommand*{\s@glsxtrfmt}[3][]{%
+ \new@ifnextchar[{\s@@glsxtrfmt{#1}{#2}{#3}}%
+ {\@@glsxtrfmt{#1}{#2}{#3}{}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\s@@glsxtrfmt}
+%\changes{1.23}{2017-11-12}{new}
+%Pick up final optional argument.
+% \begin{macrocode}
+\def\s@@glsxtrfmt#1#2#3[#4]{\@@glsxtrfmt{#1}{#2}{#3}{#4}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@@glsxtrfmt}
+%\changes{1.23}{2017-11-12}{new}
+%Actual inner working.
+% \begin{macrocode}
+\newcommand*{\@@glsxtrfmt}[4]{%
+% \end{macrocode}
+%Since there's no post-link hook to worry about, grouping can be
+%added to provide some protection against nesting (but in general
+%nested link text should be avoided).
+%\changes{1.23}{2017-11-12}{added grouping}
+% \begin{macrocode}
+ \begingroup
+ \def\glslabel{#2}%
+ \glsdoifexistsordo{#2}%
+ {%
+ \ifglshasfield{\GlsXtrFmtField}{#2}%
+ {%
+ \let\do@gls@link@checkfirsthyper\relax
+ \expandafter\@gls@link\expandafter[\GlsXtrFmtDefaultOptions,#1]{#2}%
+ {\glsxtrfmtdisplay{\glscurrentfieldvalue}{#3}{#4}}%
+ }%
+ {\glsxtrfmtdisplay{@firstofone}{#3}{#4}}%
+ }%
{%
- \let\do@gls@link@checkfirsthyper\relax
- \expandafter\@gls@link\expandafter[\GlsXtrFmtDefaultOptions,#1]{#2}%
- {\csuse{\glscurrentfieldvalue}{#3}}%
+% \end{macrocode}
+%Has the default \verb|noindex| been counteracted? If so, this
+%needs \cs{glsadd} in case \app{bib2gls} needs to pick up the record.
+%\changes{1.23}{2017-11-12}{added check for indexing}
+% \begin{macrocode}
+ \begingroup
+ \@gls@setdefault@glslink@opts
+ \setkeys{glslink}{\GlsXtrFmtDefaultOptions,#1}%
+ \ifKV@glslink@noindex\else\glsadd{#2}\fi
+ \endgroup
+ \glsxtrfmtdisplay{@firstofone}{#3}{#4}%
}%
- {#3}%
- }%
- {#3}%
+ \endgroup
}
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\glsxtrfmtdisplay}
+%\changes{1.23}{2017-11-12}{new}
+%The command used internally by \cs{glsxtrfmt} to do the actual
+%formatting. The first argument is the control sequence name,
+%the second is the control sequence's argument, the third
+%is the inserted material (if starred form used).
+% \begin{macrocode}
+\newcommand{\glsxtrfmtdisplay}[3]{\csuse{#1}{#2}#3}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\glsxtrentryfmt}
%\changes{1.12}{2017-02-03}{new}
%No link or indexing.
@@ -1840,9 +1911,10 @@ Dickimaw Books\\
%
%\begin{macro}{\@glsxtrentryfmt}
%\changes{1.12}{2017-02-03}{new}
+%\changes{1.23}{2017-11-12}{fixed missing label argument}
% \begin{macrocode}
\newrobustcmd*{\@glsxtrentryfmt}[2]{%
- \glsdoifexistsordo
+ \glsdoifexistsordo{#1}%
{%
\ifglshasfield{\GlsXtrFmtField}{#1}%
{%
@@ -1978,6 +2050,19 @@ Dickimaw Books\\
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\GlsXtrIfFieldUndef}
+%\changes{1.23}{2017-11-12}{new}
+%\begin{definition}
+%\cs{GlsXtrIfFieldUndef}\marg{field}\marg{label}\marg{true}\marg{false}
+%\end{definition}
+%Just uses \cs{ifcsundef}.
+% \begin{macrocode}
+\newcommand{\GlsXtrIfFieldUndef}[2]{%
+ \ifcsundef{glo@\glsdetoklabel{#2}@#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\glsxtrusefield}
%\changes{1.12}{2017-02-03}{new}
%Provide a user-level alternative to \cs{@gls@entry@field}.
@@ -7502,17 +7587,49 @@ Dickimaw Books\\
\renewcommand{\glspostdescription}{%
\glsnopostdottrue
\let\glspostdescription\@@glsxtr@org@postdescription
- \glsxtrpostdescription}%
+ \let\glsxtrrestorepostpunc\@glsxtr@restore@postpunc
+ \glsxtrpostdescription
+ \@glsxtr@nopostpunc@postdesc}%
\else
\renewcommand{\glspostdescription}{%
\let\glspostdescription\@@glsxtr@org@postdescription
- \glsxtrpostdescription}%
+ \let\glsxtrrestorepostpunc\@glsxtr@restore@postpunc
+ \glsxtrpostdescription
+ \@glsxtr@nopostpunc@postdesc}%
\fi
\glsnopostdotfalse
}
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\@glsxtr@nopostpunc@postdesc}
+%\changes{1.23}{2017-11-12}{new}
+% \begin{macrocode}
+\newcommand*{\@glsxtr@nopostpunc@postdesc}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@glsxtr@restore@postpunc}
+%\changes{1.23}{2017-11-12}{new}
+% \begin{macrocode}
+\newcommand*{\@glsxtr@restore@postpunc}{%
+ \def\@glsxtr@nopostpunc@postdesc{%
+ \@glsxtr@org@postdescription
+ \let\@glsxtr@nopostpunc@postdesc\@empty
+ \let\glsxtrrestorepostpunc\@empty
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\glsxtrrestorepostpunc}
+%\changes{1.23}{2017-11-12}{new}
+%Does nothing outside of glossary.
+% \begin{macrocode}
+\newcommand*{\glsxtrrestorepostpunc}{}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\@printglossary}
%Redefine.
%\changes{1.09}{2016-12-16}{redefined to save options}
@@ -11897,11 +12014,23 @@ defined}{}%
\newcommand*{\glsxtrpostlinkhook}{%
\glsxtrdiscardperiod{\glslabel}%
{\glsxtrpostlinkendsentence}%
- {\glsxtrpostlink}%
+ {\glsxtrifcustomdiscardperiod
+ {\glsxtrifperiod{\glsxtrpostlinkendsentence}{\glsxtrpostlink}}%
+ {\glsxtrpostlink}%
+ }%
}
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\glsxtrifcustomdiscardperiod}
+%\changes{1.23}{2017-11-12}{new}
+%Allow user to provide a custom check. Should expand to \verb|#2| if
+%no check is required otherwise expand to \verb|#1|.
+% \begin{macrocode}
+\newcommand*{\glsxtrifcustomdiscardperiod}[2]{#2}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\glsxtrpostlink}
% \begin{macrocode}
\newcommand*{\glsxtrpostlink}{%
@@ -20666,7 +20795,7 @@ defined}{}%
% First identify package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossaries-extra-stylemods}[2017/11/08 v1.22 (NLCT)]
+\ProvidesPackage{glossaries-extra-stylemods}[2017/11/12 v1.23 (NLCT)]
% \end{macrocode}
% Provide package options to automatically load required predefined
% styles. The simplest method is to just test for the existence of
@@ -21736,6 +21865,78 @@ defined}{}%
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\glsupdatewidest}
+%\changes{1.23}{2017-11-12}{new}
+%Only sets if new value is wider than old value.
+% \begin{macrocode}
+ \newcommand*{\glsupdatewidest}[2][0]{%
+ \ifcsundef{@glswidestname\romannumeral#1}%
+ {\csdef{@glswidestname\romannumeral#1}{#2}}%
+ {%
+ \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
+ \settowidth{\dimen@ii}{#2}%
+ \ifdim\dimen@ii>\dimen@
+ \csdef{@glswidestname\romannumeral#1}{#2}%
+ \fi
+ }%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\gglsupdatewidest}
+%\changes{1.23}{2017-11-12}{new}
+%As above but global definition.
+% \begin{macrocode}
+ \newcommand*{\gglsupdatewidest}[2][0]{%
+ \ifcsundef{@glswidestname\romannumeral#1}%
+ {\csgdef{@glswidestname\romannumeral#1}{#2}}%
+ {%
+ \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
+ \settowidth{\dimen@ii}{#2}%
+ \ifdim\dimen@ii>\dimen@
+ \csgdef{@glswidestname\romannumeral#1}{#2}%
+ \fi
+ }%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\eglsupdatewidest}
+%\changes{1.23}{2017-11-12}{new}
+%As \cs{glsupdatewidest} but expands value.
+% \begin{macrocode}
+ \newcommand*{\eglsupdatewidest}[2][0]{%
+ \ifcsundef{@glswidestname\romannumeral#1}%
+ {\protected@csedef{@glswidestname\romannumeral#1}{#2}}%
+ {%
+ \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
+ \settowidth{\dimen@ii}{#2}%
+ \ifdim\dimen@ii>\dimen@
+ \protected@csedef{@glswidestname\romannumeral#1}{#2}%
+ \fi
+ }%
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\xglsupdatewidest}
+%\changes{1.23}{2017-11-12}{new}
+%As above but global.
+% \begin{macrocode}
+ \newcommand*{\xglsupdatewidest}[2][0]{%
+ \ifcsundef{@glswidestname\romannumeral#1}%
+ {\protected@csxdef{@glswidestname\romannumeral#1}{#2}}%
+ {%
+ \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}%
+ \settowidth{\dimen@ii}{#2}%
+ \ifdim\dimen@ii>\dimen@
+ \protected@csxdef{@glswidestname\romannumeral#1}{#2}%
+ \fi
+ }%
+ }
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\glsgetwidestname}
%\changes{1.05}{2016-06-10}{new}
% Provide a user-level macro to obtain the widest top-level name.
@@ -22651,7 +22852,7 @@ defined}{}%
%\section{Package Initialisation and Options}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossary-bookindex}[2017/11/08 v1.22 (NLCT)]
+\ProvidesPackage{glossary-bookindex}[2017/11/12 v1.23 (NLCT)]
% \end{macrocode}
%Load required packages.
% \begin{macrocode}