From 5add5510b8b8121f5575f0c8cc8397a36abb3eab Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 5 Jan 2018 21:49:40 +0000 Subject: glossaries-extra (5jan18) git-svn-id: svn://tug.org/texlive/trunk@46225 c570f23f-e606-0410-a88d-b1316a301751 --- .../latex/glossaries-extra/glossaries-extra.dtx | 207 +++++++++++++++++++-- .../latex/glossaries-extra/glossaries-extra.ins | 4 +- 2 files changed, 191 insertions(+), 20 deletions(-) (limited to 'Master/texmf-dist/source/latex/glossaries-extra') 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 e9151f3574c..369ed3645e6 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: +% -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})" +% -setambles ".*\.bib=>\nopreamble\nopostamble" +% -doc "glossaries-extra-codedoc.tex" +% -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" -% -author "Nicola Talbot" -% -section "chapter" -% -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})" -% -macrocode ".*\.tex" -% -macrocode ".*\.bib" -% -doc "glossaries-extra-codedoc.tex" % -comment ".*\.tex" % -comment ".*\.bib" -% -setambles ".*\.bib=>\nopreamble\nopostamble" +% -macrocode ".*\.tex" +% -macrocode ".*\.bib" +% -section "chapter" % glossaries-extra -% Created on 2017/11/24 16:50 +% Created on 2018/1/5 12:41 %\fi %\iffalse %<*package> @@ -39,7 +39,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2017 Nicola Talbot, all rights reserved. +% Copyright (C) 2018 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -126,7 +126,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of \setcounter{IndexColumns}{2} -\CheckSum{20152} +\CheckSum{20216} \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.25: +\title{glossaries-extra.sty v1.26: documented code} \author{Nicola L.C. Talbot\\[10pt] Dickimaw Books\\ \url{http://www.dickimaw-books.com/}} -\date{2017-11-24} +\date{2018-01-05} \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/24 v1.25 (NLCT)] +\ProvidesPackage{glossaries-extra}[2018/01/05 v1.26 (NLCT)] % \end{macrocode} % Requires \sty{xkeyval} to define package options. % \begin{macrocode} @@ -3943,6 +3943,23 @@ Dickimaw Books\\ % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsxtr@inc@linkcount} +%\changes{1.26}{2018-01-05}{new} +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\glsxtr@inc@linkcount}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslinkpresetkeys} +%\changes{1.26}{2018-01-05}{new} +%User hook performed immediately before options are set. +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\glslinkpresetkeys}{} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@gls@link} %\changes{1.14}{2017-04-18}{added redefinition} %Redefine to allow the indexing to be placed after the link text. By @@ -3975,13 +3992,30 @@ Dickimaw Books\\ % \begin{macrocode} \glsxtrinithyperoutside % \end{macrocode} -% As the original definition. Note that the default link options may +% Note that the default link options may % override \cs{glsxtrinitwrgloss}. % \begin{macrocode} \@gls@setdefault@glslink@opts +% \end{macrocode} +%Increment link counter if enabled (new to v1.26). +% \begin{macrocode} + \glsxtr@inc@linkcount +% \end{macrocode} +% As the original definition. +% \begin{macrocode} \do@glsdisablehyperinlist \do@gls@link@checkfirsthyper +% \end{macrocode} +%User hook before options are set (new to v1.26): +% \begin{macrocode} + \glslinkpresetkeys +% \end{macrocode} +%Set options. +% \begin{macrocode} \setkeys{glslink}{#1}% +% \end{macrocode} +%User hook after options are set: +% \begin{macrocode} \glslinkpostsetkeys % \end{macrocode} % Check \gloskey[glslink]{thevalue} and \gloskey[glslink]{theHvalue} @@ -6239,11 +6273,15 @@ Dickimaw Books\\ % %\subsection{Entry Counting} % -% The entry counting mechanism from \styfmt{glossaries} is adjusted +% The (use) entry counting mechanism from \styfmt{glossaries} is adjusted % here to work with category attributes. Provide a convenient % command to enable entry counting, set the \catattr{entrycount} % attribute for given categories and redefine \ics{gls} etc to -% use \cs{cgls} instead. +% use \cs{cgls} instead. This form of entry counting is provided to +% adjust the formatting if the number of times an entry has been +% used (through commands that unset the first use flag) doesn't +% exceeding the specified threshold. For link counting, see +% \sectionref{sec:linkcount}. % % First adjust definitions of the unset and reset commands to % provide a hook. @@ -9423,6 +9461,7 @@ defined}{}% \def\@glsxtr@thevalue{}% \def\@glsxtr@theHvalue{\@glsxtr@thevalue}% \glsxtrinitwrgloss + \glslinkpresetkeys \setkeys{glslink}{#1}% \glslinkpostsetkeys \ifdefempty{\@glsxtr@thevalue}% @@ -9699,6 +9738,138 @@ defined}{}% % \end{macrocode} %\end{macro} % +%\section{Link Counting} +%\label{sec:linkcount} +%This is different to the entry counting provided by the base +%package (which counts the number of times the first use flag is +%unset). Instead, this method hooks into \cs{@gls@link} (through +%\cs{glsxtr@inc@linkcount}) to increment an associated counter. +%To preserve resources, the counter is only defined if it needs to +%be incremented. This method is independent of the presence of +%hyperlinks. (The \qt{link} part of the name refers to \cs{@gls@link} +%not \cs{hyperlink}.) +% +%\begin{macro}{\@glsxtr@do@inc@linkcount} +%\changes{1.26}{2018-01-05}{new} +%This performs the actual incrementing and counter definition. +%The counter is given by \cs{c@glsxtr@linkcount@\meta{label}} where +%\meta{label} is the entry's label. Since this is performed within +%\cs{@gls@link} the label can be accessed with \cs{glslabel}. +% \begin{macrocode} +\newcommand{\@glsxtr@do@inc@linkcount}{% +% \end{macrocode} +%Does this entry have the \catattr{linkcount} attribute set? +% \begin{macrocode} + \glsifattribute{\glslabel}{linkcount}{true}% + {% +% \end{macrocode} +%Does the counter exist? +% \begin{macrocode} + \ifcsdef{c@glsxtr@linkcount@\glslabel}{}% + {% +% \end{macrocode} +%Counter doesn't exist, so define it. +% \begin{macrocode} + \newcounter{glsxtr@linkcount@\glslabel}% +% \end{macrocode} +%If \catattr{linkcountmaster} is set, add to counter reset. +% \begin{macrocode} + \glshasattribute{\glslabel}{linkcountmaster}% + {% +% \end{macrocode} +%Need to ensure values are fully expanded. +% \begin{macrocode} + \begingroup + \edef\x{\endgroup\noexpand\@addtoreset{glsxtr@linkcount@\glslabel}% + {\glsgetattribute{\glslabel}{linkcountmaster}}}% + \x + }% + {}% + }% +% \end{macrocode} +% Increment counter: +% \begin{macrocode} + \glsxtrinclinkcounter{glsxtr@linkcount@\glslabel}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrinclinkcounter} +%\changes{1.26}{2018-01-05}{new} +%May be redefined to use \cs{refstepcounter} if required. +% \begin{macrocode} +\newcommand*{\glsxtrinclinkcounter}[1]{\stepcounter{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLinkCounterValue} +%\changes{1.26}{2018-01-05}{new} +%Expands to the associated link counter register or 0 if not +%defined. +% \begin{macrocode} +\newcommand*{\GlsXtrLinkCounterValue}[1]{% + \ifcsundef{c@glsxtr@linkcount@#1}{0}{\csname c@glsxtr@linkcount@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrTheLinkCounter} +%\changes{1.26}{2018-01-05}{new} +%Expands to the display value of the associated link counter or 0 if not +%defined. +% \begin{macrocode} +\newcommand*{\GlsXtrTheLinkCounter}[1]{% + \ifcsundef{theglsxtr@linkcount@#1}{0}% + {\csname theglsxtr@linkcount@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfLinkCounterDef} +%\changes{1.26}{2018-01-05}{new} +%Tests if the counter has been defined +% \begin{macrocode} +\newcommand*{\GlsXtrIfLinkCounterDef}[3]{% + \ifcsundef{theglsxtr@linkcount@#1}{#3}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLinkCounterName} +%\changes{1.26}{2018-01-05}{new} +%Expands to the associated link counter name. (No check for +%existence.) +% \begin{macrocode} +\newcommand*{\GlsXtrLinkCounterName}[1]{glsxtr@linkcount@#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrEnableLinkCounting} +%\changes{1.26}{2018-01-05}{new} +%\begin{definition} +%\cs{GlsXtrEnableLinkCounting}\oarg{master counter}\marg{categories} +%\end{definition} +%Enable link counting for the given categories. +% \begin{macrocode} +\newcommand*{\GlsXtrEnableLinkCounting}[2][]{% + \let\glsxtr@inc@linkcount\@glsxtr@do@inc@linkcount + \@for\@glsxtr@label:=#2\do + {% + \glssetcategoryattribute{\@glsxtr@label}{linkcount}{true}% + \ifstrempty{#1}{}% + {% + \ifcsundef{c@#1}% + {\@nocounterr{#1}}% + {\glssetcategoryattribute{\@glsxtr@label}{linkcountmaster}{#1}}% + }% + }% +} +\@onlypreamble\GlsXtrEnableLinkCounting +% \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 @@ -20926,7 +21097,7 @@ defined}{}% % First identify package: % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-extra-stylemods}[2017/11/24 v1.25 (NLCT)] +\ProvidesPackage{glossaries-extra-stylemods}[2018/01/05 v1.26 (NLCT)] % \end{macrocode} % Provide package options to automatically load required predefined % styles. The simplest method is to just test for the existence of @@ -22983,7 +23154,7 @@ defined}{}% %\section{Package Initialisation and Options} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossary-bookindex}[2017/11/24 v1.25 (NLCT)] +\ProvidesPackage{glossary-bookindex}[2018/01/05 v1.26 (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 b675e9517f1..089a1aa7ab8 100644 --- a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins +++ b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins @@ -1,10 +1,10 @@ -% glossaries-extra.ins generated using makedtx version 1.2 2017/11/24 16:50 +% glossaries-extra.ins generated using makedtx version 1.2 2018/1/5 12:41 \input docstrip \preamble glossaries-extra.dtx - Copyright 2017 Nicola Talbot + Copyright 2018 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 -- cgit v1.2.3