From 0dd6631d97c3dfb673037310f137101006db1151 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 10 May 2018 21:38:06 +0000 Subject: glossaries-extra (10may18) git-svn-id: svn://tug.org/texlive/trunk@47666 c570f23f-e606-0410-a88d-b1316a301751 --- .../latex/glossaries-extra/glossaries-extra.dtx | 812 +++++++++++++++++++-- .../latex/glossaries-extra/glossaries-extra.ins | 2 +- 2 files changed, 765 insertions(+), 49 deletions(-) (limited to 'Master/texmf-dist/source/latex') 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 429217ad269..6a62b1dee1e 100644 --- a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx +++ b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx @@ -1,23 +1,23 @@ %\iffalse % glossaries-extra.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: -% -section "chapter" -% -macrocode ".*\.tex" -% -macrocode ".*\.bib" -% -author "Nicola Talbot" -% -setambles ".*\.bib=>\nopreamble\nopostamble" +% -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})" % -comment ".*\.tex" % -comment ".*\.bib" -% -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})" +% -setambles ".*\.bib=>\nopreamble\nopostamble" +% -author "Nicola Talbot" % -src "glossaries-extra.sty\Z=>glossaries-extra.sty" % -src "glossaries-extra-bib2gls.sty\Z=>glossaries-extra-bib2gls.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" +% -macrocode ".*\.tex" +% -macrocode ".*\.bib" % -doc "glossaries-extra-codedoc.tex" +% -section "chapter" % glossaries-extra -% Created on 2018/4/25 15:12 +% Created on 2018/5/9 22:46 %\fi %\iffalse %<*package> @@ -127,7 +127,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of \setcounter{IndexColumns}{2} -\CheckSum{22769} +\CheckSum{23123} \newcommand*{\ifirstuse}{\iterm{first use}} \newcommand*{\firstuse}{\gls{firstuse}} @@ -167,13 +167,13 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of \raggedright } -\title{glossaries-extra.sty v1.30: +\title{glossaries-extra.sty v1.31: documented code} \author{Nicola L.C. Talbot\\[10pt] Dickimaw Books\\ \url{http://www.dickimaw-books.com/}} -\date{2018-04-25} +\date{2018-05-09} \begin{document} \DocInput{glossaries-extra.dtx} @@ -218,7 +218,7 @@ Dickimaw Books\\ %\section{Package Initialisation and Options} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-extra}[2018/04/25 v1.30 (NLCT)] +\ProvidesPackage{glossaries-extra}[2018/05/09 v1.31 (NLCT)] % \end{macrocode} % Requires \sty{xkeyval} to define package options. % \begin{macrocode} @@ -890,6 +890,10 @@ Dickimaw Books\\ % \begin{macrocode} \ifdef\@gls@setupsort@none{\@gls@setupsort@none}{}% % \end{macrocode} +% Warn about using \cs{printglossary}: +% \begin{macrocode} + \def\glsxtrNoGlossaryWarning{\@glsxtr@record@noglossarywarning}% +% \end{macrocode} %Load \sty{glossaries-extra-bib2gls}: % \begin{macrocode} \RequirePackage{glossaries-extra-bib2gls}% @@ -2232,6 +2236,52 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\GlsXtrIfFieldNonZero} +%\changes{1.31}{2018-05-09}{new} +%Designed for numeric fields. +% \begin{macrocode} +\newcommand{\GlsXtrIfFieldNonZero}[4]{% + \GlsXtrIfFieldCmpNum{#1}{#2}{=}{0}{#4}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldEqNum} +%\changes{1.31}{2018-05-09}{new} +%\begin{definition} +%\cs{GlsXtrIfFieldEqNum}\marg{field}\marg{label}\marg{value}\marg{true}\marg{false} +%\end{definition} +%Designed for numeric fields. +% \begin{macrocode} +\newcommand{\GlsXtrIfFieldEqNum}[5]{% + \GlsXtrIfFieldCmpNum{#1}{#2}{=}{#3}{#4}{#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldCmpNum} +%\changes{1.31}{2018-05-09}{new} +%\begin{definition} +%\cs{GlsXtrIfFieldCmpNum}\marg{field}\marg{label}\marg{comparison}\marg{value}\marg{true}\marg{false} +%\end{definition} +%Designed for numeric fields. +% \begin{macrocode} +\newcommand{\GlsXtrIfFieldCmpNum}[6]{% + {% + \letcs{\glscurrentfieldvalue}{glo@\glsdetoklabel{#2}@#1}% + \ifundef\glscurrentfieldvalue + {\def\glscurrentfieldvalue{0}}% + {% + \ifdefempty\glscurrentfieldvalue + {\def\glscurrentfieldvalue{0}}% + {}% + }% + \ifnum\glscurrentfieldvalue#3#4\relax #5\else #6\fi + }% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\GlsXtrIfFieldUndef} %\changes{1.23}{2017-11-12}{new} %\begin{definition} @@ -2385,20 +2435,72 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\GlsXtrIfFieldEqXpStr} +%\changes{1.31}{2018-05-09}{new} +%Like the above but first expands the string. +% \begin{macrocode} +\newrobustcmd*{\GlsXtrIfFieldEqXpStr}[5]{% + \glsxtrifhasfield{#1}{#2}% + {% + \protected@edef\@gls@tmp{#3}% + \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfXpFieldEqXpStr} +%\changes{1.31}{2018-05-09}{new} +%Like the above but also expands the field value. +% \begin{macrocode} +\newrobustcmd*{\GlsXtrIfXpFieldEqXpStr}[5]{% + \glsxtrifhasfield{#1}{#2}% + {% + \protected@edef\@gls@tmp{\glscurrentfieldvalue}% + \let\glscurrentfieldvalue\@gls@tmp + \protected@edef\@gls@tmp{#3}% + \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsxtrpageref} %\changes{1.11}{2017-01-19}{new} % Like \cs{glsrefentry} but references the page number instead (if -% entry counting is on). +% entry counting is on). The base \sty{glossaries} package only +% introduced \cs{GlsEntryCounterLabelPrefix} in version 4.38, so it +% may not be defined. % \begin{macrocode} -\ifglsentrycounter - \newcommand*{\glsxtrpageref}[1]{\pageref{glsentry-\glsdetoklabel{#1}}} -\else - \ifglssubentrycounter - \newcommand*{\glsxtrpageref}[1]{\pageref{glsentry-\glsdetoklabel{#1}}} - \else - \newcommand*{\glsxtrpageref}[1]{\gls{#1}} - \fi -\fi +\ifdef\GlsEntryCounterLabelPrefix +{% + \newcommand*{\glsxtrpageref}[1]{% + \ifglsentrycounter + \pageref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \ifglssubentrycounter + \pageref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \gls{#1}% + \fi + \fi + } +}% +{% + \newcommand*{\glsxtrpageref}[1]{% + \ifglsentrycounter + \pageref{glsentry-\glsdetoklabel{#1}}% + \else + \ifglssubentrycounter + \pageref{glsentry-\glsdetoklabel{#1}}% + \else + \gls{#1}% + \fi + \fi + } +}% % \end{macrocode} %\end{macro} % @@ -4149,6 +4251,11 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\changes{1.31}{2018-05-09}{added \texttt{prefix} key for \texttt{glslink}} +% \begin{macrocode} +\define@key{glslink}{prefix}{\def\glolinkprefix{#1}} +% \end{macrocode} +% %\begin{macro}{\glsxtrinithyperoutside} %\changes{1.21}{2017-11-03}{new} %Set the default if the \gloskey[glslink]{hyperoutside} is omitted. @@ -4213,6 +4320,10 @@ Dickimaw Books\\ \edef\glstype{\csname glo@\glslabel @type\endcsname}% \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper % \end{macrocode} +%Save current value of \cs{glolinkprefix}: +% \begin{macrocode} + \let\@glsxtr@org@glolinkprefix\glolinkprefix +% \end{macrocode} %Initialise \cs{@glsxtr@local@textformat} % \begin{macrocode} \let\@glsxtr@local@textformat\relax @@ -4326,6 +4437,10 @@ Dickimaw Books\\ \@do@wrglossary{#2}% \fi % \end{macrocode} +%Restore original value of \cs{glolinkprefix}: +% \begin{macrocode} + \let\glolinkprefix\@glsxtr@org@glolinkprefix +% \end{macrocode} % As the original definition: % \begin{macrocode} \let\ifKV@glslink@hyper\org@ifKV@glslink@hyper @@ -4404,6 +4519,17 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsaddeach} +%\changes{1.31}{2018-05-09}{new} +%Performs \cs{glsadd} for each entry listed in the mandatory +%argument. +% \begin{macrocode} +\newrobustcmd{\glsaddeach}[2][]{% + \@for\@gls@thislabel:=#2\do{\glsadd[#1]{\@gls@thislabel}}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@glsxtr@field@linkdefs} % Default settings for \cs{@gls@field@link} %\changes{0.3}{2015-12-02}{new} @@ -5919,7 +6045,9 @@ Dickimaw Books\\ % This command was only introduced in \styfmt{glossaries} v4.20, so it may % not be defined (therefore use \cs{def}). For older \styfmt{glossaries} versions, this won't be % used if \sty{hyperref} hasn't been loaded, which means the -% indexing will still take place. The generated text is scoped. +% indexing will still take place. The generated text is scoped +% (the link text in \cs{hyperlink} is also scoped, so it's +% consistent). %\changes{0.5.4}{2015-12-15}{added} % \begin{macrocode} \def\glsdonohyperlink#1#2{{\glsxtrprotectlinks #2}} @@ -6593,6 +6721,16 @@ Dickimaw Books\\ %\changes{1.30}{2018-04-25}{new} % \begin{macrocode} \newcommand*{\GlsXtrStartUnsetBuffering}{% + \@ifstar\s@GlsXtrStartUnsetBuffering\@GlsXtrStartUnsetBuffering +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrStartUnsetBuffering} +%\changes{1.31}{2018-05-09}{new} +%Unstarred version doesn't check for duplicates. +% \begin{macrocode} +\newcommand*{\@GlsXtrStartUnsetBuffering}{% \let\@glsxtr@org@unset@buffer\@glsxtr@unset@buffer \def\@glsxtr@unset@buffer{}% \let\@glsunset\@glsxtrbuffer@unset @@ -6600,6 +6738,18 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\s@GlsXtrStartUnsetBuffering} +%\changes{1.31}{2018-05-09}{new} +%Starred version checks for duplicates. +% \begin{macrocode} +\newcommand*{\s@GlsXtrStartUnsetBuffering}{% + \let\@glsxtr@org@unset@buffer\@glsxtr@unset@buffer + \def\@glsxtr@unset@buffer{}% + \let\@glsunset\@glsxtrbuffer@nodup@unset +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@glsxtrbuffer@unset} %\changes{1.30}{2018-04-25}{new} %This must use a global change since \cs{gls} may have to be placed @@ -6611,6 +6761,21 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\@glsxtrbuffer@nodup@unset} +%\changes{1.31}{2018-05-09}{new} +%Alternative version that avoids duplicates. +%One level of expansion is performed on the argument in case it's a +%control sequence containing the label. (Not using \cs{xifinlist} as +%the added complexity might cause problems that the buffering is +%trying to overcome.) +% \begin{macrocode} +\newcommand*{\@glsxtrbuffer@nodup@unset}[1]{% + \expandafter\ifinlist\expandafter{#1}{\@glsxtr@unset@buffer}{}% + {\listxadd\@glsxtr@unset@buffer{#1}}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\GlsXtrStopUnsetBuffering} %\changes{1.30}{2018-04-25}{new} % \begin{macrocode} @@ -6643,6 +6808,17 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\GlsXtrForUnsetBufferedList} +%\changes{1.31}{2018-05-09}{new} +%Iterate over labels stored in the current buffer. +%The argument is the handler macro. +% \begin{macrocode} +\newcommand*{\GlsXtrForUnsetBufferedList}[1]{% + \forlistloop#1\@glsxtr@unset@buffer +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@glslocalunset} % Local unset. % \begin{macrocode} @@ -6691,6 +6867,42 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\glslocalreseteach} +%\changes{1.31}{2018-05-09}{new} +%Locally reset a list of entries. +% \begin{macrocode} +\newcommand*{\glslocalreseteach}[1]{% + \gls@ifnotmeasuring + {% + \@for\@gls@thislabel:=#1\do{% + \glsdoifexists{\@gls@thislabel}% + {% + \@glslocalreset{\@gls@thislabel}% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslocalunseteach} +%Locally unset a list of entries. +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand*{\glslocalunseteach}[1]{% + \gls@ifnotmeasuring + {% + \@for\@gls@thislabel:=#1\do{% + \glsdoifexists{\@gls@thislabel}% + {% + \@glslocalunset{\@gls@thislabel}% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\GlsXtrEnableEntryCounting} % The first argument is the list of categories and the second % argument is the value of the \catattr{entrycount} attribute. @@ -8050,7 +8262,10 @@ Dickimaw Books\\ {true,false}[true]% {% \ifcase\@glsxtr@printglossnr - \let\@glstarget\glsdohypertarget +% \end{macrocode} +%\changes{1.31}{2018-05-09}{changed \cs{let} to \cs{def}} +% \begin{macrocode} + \def\@glstarget{\glsdohypertarget}% \else \let\@glstarget\@secondoftwo \fi @@ -8070,6 +8285,13 @@ Dickimaw Books\\ } % \end{macrocode} % +%\changes{1.31}{2018-05-09}{added \texttt{prefix} key for \texttt{printgloss}} +% \begin{macrocode} +\define@key{printgloss}{prefix}{% + \renewcommand{\glolinkprefix}{#1}% +} +% \end{macrocode} +% %\begin{macro}{\glsdohypertarget} %\changes{1.20}{2017-09-11}{added redefinition} %Redefine to insert \cs{@glsxtrhypernameprefix} before the target @@ -8080,7 +8302,16 @@ Dickimaw Books\\ \@glsxtr@org@glsdohypertarget{\@glsxtrhypernameprefix#1}{#2}% } % \end{macrocode} +%\changes{1.31}{2018-05-09}{bug fix: ensure that new version is picked up} +%Update \cs{@glstarget} to use \cs{def} instead being assigned with +%\cs{let} so that it can pick up the new definition and allow any +%further redefinitions: +% \begin{macrocode} +\ifx\@glstarget\@glsxtr@org@glsdohypertarget + \def\@glstarget{\glsdohypertarget}% +\fi %\end{macro} +% \end{macrocode} %\begin{macro}{\glsxtr@makeglossaries} %For the benefit of \app{makeglossaries} %\changes{1.09}{2016-12-16}{new} @@ -8736,6 +8967,19 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\GlsXtrRecordWarning} +% Paragraph for \pkgopt[only]{record}. +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand{\GlsXtrRecordWarning}[1]{% + \texttt{\string\printglossary} doesn't work + with the \texttt{record=only} package option + use\par\texttt{\string\printunsrtglossary[type=#1]}\par + instead (or change the package option).% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\GlsXtrNoGlsWarningTail} % Final paragraph. % \begin{macrocode} @@ -8819,6 +9063,22 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\@glsxtr@record@noglossarywarning} +%\changes{1.31}{2018-05-09}{new} +%Warn about using \cs{printglossary} with \pkgopt{record} +% \begin{macrocode} +\newcommand*{\@glsxtr@record@noglossarywarning}[1]{% + \GlossariesExtraWarning{\string\printglossary\space doesn't work\MessageBreak + with record=only package option\MessageBreak(use + \string\printunsrtglossary[type=#1])\MessageBreak + instead (or change the package option)}% + \glossarysection[\glossarytoctitle]{\glossarytitle} + \GlsXtrRecordWarning{#1} + \GlsXtrNoGlsWarningTail +} +% \end{macrocode} +%\end{macro} +% %Provide some commands to accompany the \pkgopt{record} option %for use with \href{https://github.com/nlct/bib2gls}{bib2gls}. %\begin{macro}{\glsxtrresourcefile} @@ -9122,9 +9382,9 @@ Dickimaw Books\\ {% \begingroup \edef\glscurrententrylabel{\glsdetoklabel{#1}}% - \edef\currentglossary{\glsentrytype{\glscurrententrylabel}}% + \edef\currentglossary{\GlsXtrStandaloneGlossaryType}% \ifglshasparent{#1}% - {\glssubentryitem{#1}}% + {\GlsXtrStandaloneSubEntryItem{#1}}% {\glsentryitem{#1}}% \glstarget{#1}{\glossentryname{#1}}% \endgroup @@ -9136,10 +9396,32 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\GlsXtrStandaloneGlossaryType} +%\changes{1.31}{2018-05-09}{new} +%To make it easier to adjust the definition of \cs{currentglossary} +%within \cs{glsxtrglossentry}, this expands to the default +%definition. (If redefined, it must fully expand to the appropriate +%label.) +% \begin{macrocode} +\newcommand{\GlsXtrStandaloneGlossaryType}{\glsentrytype{\glscurrententrylabel}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrStandaloneSubEntryItem} +%\changes{1.31}{2018-05-09}{new} +%Used for sub-entries in standalone format. The argument is the +%entry's label. +% \begin{macrocode} +\newcommand*{\GlsXtrStandaloneSubEntryItem}[1]{% + \GlsXtrIfFieldEqNum{level}{#1}{1}{\glssubentryitem{#1}}{}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsxtrglossentryother} %\changes{1.22}{2017-11-08}{new} %As \cs{glsxtrglossentry} but uses a different field. -%First argument is command to use in the header. The second argument +%First argument is code to use in the header. The second argument %is the entry's label. The third argument is the internal field %label. This needs to be expandable in case it occurs in a %sectioning command so it can't have an optional argument. @@ -9181,9 +9463,9 @@ Dickimaw Books\\ {% \begingroup \edef\glscurrententrylabel{\glsdetoklabel{#1}}% - \edef\currentglossary{\glsentrytype{\glscurrententrylabel}}% + \edef\currentglossary{\GlsXtrStandaloneGlossaryType}% \ifglshasparent{#1}% - {\glssubentryitem{#1}}% + {\GlsXtrStandaloneSubEntryItem{#1}}% {\glsentryitem{#1}}% \glstarget{#1}{\glossentrynameother{#1}{#2}}% \endgroup @@ -9315,7 +9597,7 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % -%\begin{macro}{\printunsrtglossaryentryprocesshook} +%\begin{macro}{\printunsrtglossaryskipentry} %\changes{1.21}{2017-11-03}{new} % \begin{macrocode} \newcommand*{\printunsrtglossaryskipentry}{% @@ -9361,6 +9643,9 @@ can only be used within \string\printunsrtglossaryentryprocesshook}{}% %\end{macro} % %\begin{macro}{\glsxtriflabelinlist} +%\begin{definition} +%\cs{glsxtriflabelinlist}\marg{label}\marg{list}\marg{true}\marg{false} +%\end{definition} %\changes{1.21}{2017-11-03}{new} %Might be useful for the handler to check if an entry label %or category label is contained in a list, so provide a user-level @@ -10802,7 +11087,191 @@ defined}{}% % \end{macrocode} %\end{macro} % -% End of if part +% Keys for accessibility support. +% \begin{macrocode} + \define@key{glsxtrabbrv}{access}{% + \def\@gls@nameaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{textaccess}{% + \def\@gls@textaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{firstaccess}{% + \def\@gls@firstaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{shortaccess}{% + \def\@gls@shortaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{shortpluralaccess}{% + \def\@gls@shortaccesspl{#1}% + } +% \end{macrocode} +%\begin{macro}{\@gls@initaccesskeys} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand*{\@gls@initaccesskeys}{% + \def\@gls@nameaccess{}% + \def\@gls@textaccess{}% + \def\@gls@firstaccess{}% + \def\@gls@shortaccess{}% + \def\@gls@shortaccesspl{}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@ifaccessattribute@set} +%\begin{definition} +%\cs{\@gls@ifaccessattribute@set}\marg{attribute}\marg{true}\marg{false} +%\end{definition} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand*{\@gls@ifaccessattribute@set}[3]{% + \glsifcategoryattribute{\glscategorylabel}{access#1}{true}% + {#2}% + {% + \glsifcategoryattribute{\glscategorylabel}{access#1}{false}% + {#3}% + {% + \glsifcategoryattribute{\glscategorylabel}{#1}{true}% + {#2}% + {#3}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setup@default@short@access} +%\changes{1.31}{2018-05-09}{new} +%Assign the default value of the \gloskey{shortaccess} key. The +%argument is the short value passed to \cs{newabbreviation}. +% \begin{macrocode} + \newcommand{\@gls@setup@default@short@access}[1]{% +% \end{macrocode} +%Check if the \catattr{accessinsertdots} attribute has been set but +%only if \gloskey{shortaccess} hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {% + \glsifcategoryattribute{\glscategorylabel}{accessinsertdots}{true}% + {% + \@glsxtr@insertdots\@gls@shortaccess{#1}% + \eappto\ExtraCustomAbbreviationFields{% + shortaccess={\expandonce\@gls@shortaccess},}% + }% + {}% + }% + {}% +% \end{macrocode} +%If the \gloskey{shortaccess} field has been set but +%\gloskey{shortaccessplural} hasn't been set, assign plural form. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \ifdefempty\@gls@shortaccesspl + {% + \@gls@ifaccessattribute@set{aposplural}% + {% + \expandafter\def\expandafter\@gls@shortaccesspl\expandafter{% + \@gls@shortaccess'\abbrvpluralsuffix}% + }% + {% + \@gls@ifaccessattribute@set{noshortplural}% + {% + \let\@gls@shortaccesspl\@gls@shortaccess + }% + {% + \expandafter\def\expandafter\@gls@shortaccesspl\expandafter{% + \@gls@shortaccess\abbrvpluralsuffix}% + }% + }% + \eappto\ExtraCustomAbbreviationFields{% + shortpluralaccess={\expandonce\@gls@shortaccesspl},}% + }% + {}% + }% +% \end{macrocode} +%If \gloskey{access} key hasn't been set, check if the +%\catattr{nameshortaccess} attribute has been set. +% \begin{macrocode} + \ifdefempty\@gls@nameaccess + {% + \glsifcategoryattribute{\glscategorylabel}{nameshortaccess}{true}% + {% +% \end{macrocode} +%Do nothing if the \gloskey{shortaccess} key hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \eappto\ExtraCustomAbbreviationFields{% + access={\expandonce\@gls@shortaccess},% + }% + }% + }% + {}% + }% + {}% +% \end{macrocode} +%If \gloskey{textaccess} key hasn't been set, check if the +%\catattr{textshortaccess} attribute has been set. +% \begin{macrocode} + \ifdefempty\@gls@textaccess + {% + \glsifcategoryattribute{\glscategorylabel}{textshortaccess}{true}% + {% +% \end{macrocode} +%Do nothing if the \gloskey{shortaccess} key hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \eappto\ExtraCustomAbbreviationFields{% + textaccess={\expandonce\@gls@shortaccess},% + }% + }% + }% + {}% + }% + {}% +% \end{macrocode} +%If \gloskey{firstaccess} key hasn't been set, check if the +%\catattr{firstshortaccess} attribute has been set. +% \begin{macrocode} + \ifdefempty\@gls@firstaccess + {% + \glsifcategoryattribute{\glscategorylabel}{firstshortaccess}{true}% + {% +% \end{macrocode} +%Do nothing if the \gloskey{shortaccess} key hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \eappto\ExtraCustomAbbreviationFields{% + firstaccess={\expandonce\@gls@shortaccess},% + }% + }% + }% + {}% + }% + {}% + } +% \end{macrocode} +%\end{macro} +% End of if accsupp part % \begin{macrocode} } { @@ -11132,6 +11601,20 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\begin{macro}{\@gls@initaccesskeys} +%\changes{1.31}{2018-05-09}{new} +%This does nothing if there's no accessibility support. +% \begin{macrocode} + \newcommand*{\@gls@initaccesskeys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setup@default@short@access} +%\changes{1.31}{2018-05-09}{new} +%This does nothing if there's no accessibility support. +% \begin{macrocode} + \newcommand{\@gls@setup@default@short@access}[1]{}% +% \end{macrocode} % End of else part % \begin{macrocode} } @@ -11876,6 +12359,17 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsdefpostname} +%\changes{1.31}{2018-05-09}{new} +%Provide a convenient command for defining the post-name hook +%for the given category. +% \begin{macrocode} +\newcommand*{\glsdefpostname}[2]{% + \csdef{glsxtrpostname#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsxtr@setaccessdisplay} %\changes{1.22}{2017-11-08}{new} % \begin{macrocode} @@ -12569,6 +13063,17 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsdefpostdesc} +%\changes{1.31}{2018-05-09}{new} +%Provide a convenient command for defining the post-description hook +%for the given category. +% \begin{macrocode} +\newcommand*{\glsdefpostdesc}[2]{% + \csdef{glsxtrpostdesc#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glspostlinkhook} % Redefine the post link hook used by commands like \cs{gls} to % make it easier for categories or attributes to modify this action. @@ -12615,6 +13120,25 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsdefpostlink} +%\changes{1.31}{2018-05-09}{new} +%Provide a convenient command for defining the post-link hook +%for the given category. Doesn't allow an empty argument (which) +%would overwrite \cs{glsxtrpostlink}. +% \begin{macrocode} +\newcommand*{\glsdefpostlink}[2]{% +% \end{macrocode} +% \cs{ifthenelse} is used to ensure that the expanded value is +% tested. (The category label must be fully expandable.) +% \begin{macrocode} + \ifthenelse{\equal{#1}{}}% + {\PackageError{glossaries-extra} + {Invalid empty category label in \string\glsdefpostlink}{}}% + {\csdef{glsxtrpostlink#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsxtrpostlinkendsentence} %\changes{0.3}{2015-12-02}{new} % Done by \cs{glsxtrpostlinkhook} if a full stop is discarded. @@ -12671,6 +13195,29 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsxtrpostlinkAddSymbolDescOnFirstUse} +%\changes{1.31}{2018-05-09}{new} +% Provide a command for appending the symbol (if defined) and +% description in parentheses on +% first use, for the convenience of users wanting to add this to the +% post link hook. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkAddSymbolDescOnFirstUse}{% + \glsxtrifwasfirstuse + {% + \space\glsxtrparen + {% + \ifglshassymbol{\glslabel}% + {\glsaccesssymbol{\glslabel}, }% + {}% + \glsaccessdesc{\glslabel}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsxtrdiscardperiod} % Discard following period (if present) if the % \catattr{discardperiod} attribute is true. If a period is @@ -12999,6 +13546,16 @@ defined}{}% \def\glsxtrorgshort{#3}% \def\glsxtrorglong{#4}% % \end{macrocode} +%\changes{1.31}{2018-05-09}{added \cs{ExtraCustomAbbreviationFields}} +%Provide extra settings for hooks (if modified, this command must +%end with a comma). +% \begin{macrocode} + \def\ExtraCustomAbbreviationFields{}% +% \end{macrocode} +%Initialise accessibility settings if required. +% \begin{macrocode} + \@gls@initaccesskeys +% \end{macrocode} % Get the category. %\changes{0.3}{2015-12-02}{fixed family name in \cs{setkeys}} % \begin{macrocode} @@ -13105,6 +13662,11 @@ defined}{}% \expandafter\glsshortpltok\expandafter{\@gls@shortpl}% \expandafter\glslongpltok\expandafter{\@gls@longpl}% % \end{macrocode} +% Hook for accessibility support (does nothing if +% \sty{glossaries-accsupp} hasn't been loaded). +% \begin{macrocode} + \@gls@setup@default@short@access{#3}% +% \end{macrocode} % Do any extra setup provided by hook: % \begin{macrocode} \newabbreviationhook @@ -13122,6 +13684,15 @@ defined}{}% longplural={\the\glslongpltok},% name={\the\glsshorttok},% \CustomAbbreviationFields,% +% \end{macrocode} +% Hook may override abbreviation style default settings (this hook +% must end with a comma if set). +% \begin{macrocode} + \ExtraCustomAbbreviationFields +% \end{macrocode} +% Any explicit fields set in the optional argument override all +% other settings. +% \begin{macrocode} \the\glskeylisttok }% }% @@ -20265,6 +20836,16 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsxtrRevertTocMarks} +%\changes{1.31}{2018-05-09}{new} +%Just restores \cs{@starttoc}. +% \begin{macrocode} +\newcommand*{\glsxtrRevertTocMarks}{% + \let\@starttoc\@glsxtr@org@@starttoc +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsxtrifinmark} %\changes{1.07}{2016-08-15}{new} % \begin{macrocode} @@ -21596,7 +22177,7 @@ defined}{}% %automatically loaded by the record option. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-extra-bib2gls}[2018/04/25 v1.30 (NLCT)] +\ProvidesPackage{glossaries-extra-bib2gls}[2018/05/09 v1.31 (NLCT)] % \end{macrocode} % %These are some convenient macros for use with custom rules. @@ -21607,6 +22188,23 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glscapturedgroup} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand*{\glscapturedgroup}{\string\$} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfHasNonZeroChildCount} +%\changes{1.31}{2018-05-09}{new} +%For use with \app{bib2gls}'s \texttt{save-child-count} resource option. +% \begin{macrocode} +\newcommand*{\GlsXtrIfHasNonZeroChildCount}[3]{% + \GlsXtrIfFieldNonZero{childcount}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsxtrprovidecommand} %\changes{1.27}{2018-02-26}{new} %For use in \texttt{@preamble}, this behaves like @@ -23956,7 +24554,7 @@ defined}{}% % First identify package: % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-extra-stylemods}[2018/04/25 v1.30 (NLCT)] +\ProvidesPackage{glossaries-extra-stylemods}[2018/05/09 v1.31 (NLCT)] % \end{macrocode} % Provide package options to automatically load required predefined % styles. The simplest method is to just test for the existence of @@ -24098,6 +24696,12 @@ defined}{}% \newcommand{\glslistchildpostlocation}{.} % \end{macrocode} %\end{macro} +%\begin{macro}{\glslistdesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glslistdesc}[1]{\glossentrydesc{#1}\glspostdescription} +% \end{macrocode} +%\end{macro} %Redefine \glostyle{list} to use these commands. % \begin{macrocode} \renewglossarystyle{list}{% @@ -24108,11 +24712,11 @@ defined}{}% \renewcommand*{\glossentry}[2]{% \item[\glsentryitem{##1}% \glstarget{##1}{\glossentryname{##1}}] - \glossentrydesc{##1}\glspostdescription\glslistprelocation ##2}% + \glslistdesc{##1}\glslistprelocation ##2}% \renewcommand*{\subglossentry}[3]{% \glssubentryitem{##2}% \glstarget{##2}{\strut}\space - \glossentrydesc{##2}\glspostdescription + \glslistdesc{##2}% \glslistchildprelocation ##3\glslistchildpostlocation}% \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}% } @@ -24130,11 +24734,11 @@ defined}{}% \item[\glsentryitem{##1}% \glstarget{##1}{\glossentryname{##1}}]% \mbox{}\par\nobreak\@afterheading - \glossentrydesc{##1}\glspostdescription\glslistprelocation ##2}% + \glslistdesc{##1}\glslistprelocation ##2}% \renewcommand{\subglossentry}[3]{% \par \glssubentryitem{##2}% - \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription + \glstarget{##2}{\strut}\glslistdesc{##2}% \glslistchildprelocation ##3}% } } @@ -24659,6 +25263,46 @@ defined}{}% % \end{macrocode} % %\section{Tree Styles} +% Redefine both \cs{glstreenamefmt} and \cs{glstreegroupheaderfmt} +% in terms of \cs{glstreedefaultnamefmt} to make it easier to change +% both at the same time or only change one without affecting the +% other. +% \begin{macrocode} +\ifdef\glstreenamefmt +{ +% \end{macrocode} +%\begin{macro}{\glstreedefaultnamefmt} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreedefaultnamefmt}[1]{\textbf{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreenamefmt} +%\changes{1.31}{2018-05-09}{added redefinition} +% \begin{macrocode} + \renewcommand{\glstreenamefmt}[1]{\glstreedefaultnamefmt{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreegroupheaderfmt} +%\changes{1.31}{2018-05-09}{added redefinition} +%This command was only introduced to \sty{glossary-tree} v4.22, so +%it may not be defined. +% \begin{macrocode} + \def\glstreegroupheaderfmt#1{\glstreedefaultnamefmt{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreenavigationfmt} +%\changes{1.31}{2018-05-09}{added redefinition} +%This command was only introduced to \sty{glossary-tree} v4.22, so +%it may not be defined. +% \begin{macrocode} + \def\glstreenavigationfmt#1{\glstreedefaultnamefmt{#1}} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} % The \glostyle{index} style is redefined so that the space before % the number list isn't hard coded. %\changes{1.21}{2017-11-03}{modified index to remove hard coded \cs{space}} @@ -24682,6 +25326,7 @@ defined}{}% \newcommand*{\glstreechildprelocation}{\glstreeprelocation} % \end{macrocode} %\end{macro} +%Modify the \glostyle{index} style. % \begin{macrocode} \renewglossarystyle{index}{% \renewenvironment{theglossary}% @@ -24697,8 +25342,8 @@ defined}{}% \renewcommand*{\glossentry}[2]{% \item\glsentryitem{##1}% \glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% - \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}% - \glstreepredesc \glossentrydesc{##1}\glspostdescription + \glstreesymbol{##1}% + \glstreedesc{##1}% \glstreeprelocation ##2% }% \renewcommand{\subglossentry}[3]{% @@ -24711,8 +25356,8 @@ defined}{}% \subsubitem \fi \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}% - \ifglshassymbol{##2}{\space(\glossentrysymbol{##2})}{}% - \glstreechildpredesc\glossentrydesc{##2}\glspostdescription + \glstreechildsymbol{##2}% + \glstreechilddesc{##2}% \glstreechildprelocation ##3% }% \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}% @@ -24766,6 +25411,45 @@ defined}{}% % \begin{macrocode} \ifdef{\@glsstyle@tree} {% +%Provide a command for use with the \glostyle{tree} styles that displays +%the pre-description separator, the +%description and post-description hook. +%\begin{macro}{\glstreedesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreedesc}[1]{% + \glstreepredesc\glossentrydesc{#1}\glspostdescription + } +% \end{macrocode} +%\end{macro} +%Similarly for the symbol. +%\begin{macro}{\glstreesymbol} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreesymbol}[1]{% + \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}% + }% +% \end{macrocode} +%\end{macro} +%And for the child entries: +%\begin{macro}{\glstreechilddesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreechilddesc}[1]{% + \glstreechildpredesc\glossentrydesc{#1}\glspostdescription + }% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreechildsymbol} +%\changes{1.31}{2018-05-09}{new} +%This just behaves in the same way as the top-level. +% \begin{macrocode} + \newcommand{\glstreechildsymbol}[1]{% + \glstreesymbol{#1}% + }% +% \end{macrocode} +%\end{macro} +% \begin{macrocode} \renewglossarystyle{tree}{% \renewenvironment{theglossary}% {\setlength{\parindent}{0pt}% @@ -24777,8 +25461,8 @@ defined}{}% \hangindent0pt\relax \parindent0pt\relax \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% - \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}% - \glstreepredesc\glossentrydesc{##1}\glspostdescription + \glstreesymbol{##1}% + \glstreedesc{##1}% \glstreeprelocation##2\par }% \renewcommand{\subglossentry}[3]{% @@ -24788,8 +25472,8 @@ defined}{}% \glssubentryitem{##2}% \fi \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}% - \ifglshassymbol{##2}{\space(\glossentrysymbol{##2})}{}% - \glstreechildpredesc\glossentrydesc{##2}\glspostdescription + \glstreechildsymbol{##2}% + \glstreechilddesc{##2}% \glstreechildprelocation ##3\par }% \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}% @@ -24841,6 +25525,37 @@ defined}{}% % \begin{macrocode} \ifdef{\@glsstyle@treenoname} {% +%Provide a command for use with the \glostyle{treenoname} styles that displays +%the pre-description separator, the +%description and post-description hook. +%\begin{macro}{\glstreenonamedesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreenonamedesc}[1]{% + \glstreepredesc\glossentrydesc{#1}\glspostdescription + }% +% \end{macrocode} +%\end{macro} +%Similarly for the symbol. +%\begin{macro}{\glstreenonamesymbol} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreenonamesymbol}[1]{% + \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}% + }% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreenonamechilddesc} +%\changes{1.31}{2018-05-09}{new} +%The child entry doesn't have the pre-description separator as the +%name isn't displayed. +% \begin{macrocode} + \newcommand{\glstreenonamechilddesc}[1]{% + \glossentrydesc{#1}\glspostdescription + }% +% \end{macrocode} +%\end{macro} +% \begin{macrocode} \renewglossarystyle{treenoname}{% \renewenvironment{theglossary}% {\setlength{\parindent}{0pt}% @@ -24852,8 +25567,8 @@ defined}{}% \hangindent0pt\relax \parindent0pt\relax \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% - \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}% - \glstreepredesc\glossentrydesc{##1}\glspostdescription + \glstreenonamesymbol{##1}% + \glstreenonamedesc{##1}% \glstreeprelocation##2\par }% \renewcommand{\subglossentry}[3]{% @@ -24863,7 +25578,8 @@ defined}{}% \glssubentryitem{##2}% \fi \glstarget{##2}{\strut}% - \glossentrydesc{##2}\glspostdescription\glstreechildprelocation##3\par + \glstreenonamechilddesc{##2}% + \glstreechildprelocation##3\par }% \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}% } @@ -26013,7 +26729,7 @@ defined}{}% %\section{Package Initialisation and Options} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossary-bookindex}[2018/04/25 v1.30 (NLCT)] +\ProvidesPackage{glossary-bookindex}[2018/05/09 v1.31 (NLCT)] % \end{macrocode} %Load required packages. % \begin{macrocode} 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 870152f26c4..3f5f25aa8ef 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.2 2018/4/25 15:12 +% glossaries-extra.ins generated using makedtx version 1.2 2018/5/9 22:46 \input docstrip \preamble -- cgit v1.2.3