texlive[43408] Master/texmf-dist: xassoccnt (5mar17)

commits+karl at tug.org commits+karl at tug.org
Sun Mar 5 22:39:47 CET 2017


Revision: 43408
          http://tug.org/svn/texlive?view=revision&revision=43408
Author:   karl
Date:     2017-03-05 22:39:46 +0100 (Sun, 05 Mar 2017)
Log Message:
-----------
xassoccnt (5mar17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/xassoccnt/README
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex
    trunk/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf
    trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/README	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/README	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,9 +1,9 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% README file for xassoccnt.sty
 %%
 %%
 %% -------------------------------------------------------------------------------------------
-%% Copyright (c) 2015 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
+%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
 %% -------------------------------------------------------------------------------------------
 %%
 %% This work may be distributed and/or modified under the
@@ -26,7 +26,7 @@
 to the totcount package by Vasileios Koutavas (http://www.ctan.org/pkg/totcount), but
 can be used without it too.
 
-As of 2017/03/04 xassoccnt does not supersede the package assoccnt by the same author, however, 
-the older package isn't declared obsolete as of 2017/03/04
+As of 2017/03/05 xassoccnt does not supersede the package assoccnt by the same author, however, 
+the older package isn't declared obsolete as of 2017/03/05
 
 

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file for backup counters file for xassoccnt.sty
 %%
 %%

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file for coupled counters file for xassoccnt.sty
 %%
 %%

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Documentation file for xassoccnt.sty
 %%
 %%
@@ -99,6 +99,8 @@
 
 \@namedef{xassoccntversion1.2}{v1.2 2017-03-03}
 
+\@namedef{xassoccntversion1.3}{v1.3 2017-03-04}
+
 \newcommand{\authorname}{Autor}
 
 
@@ -382,7 +384,7 @@
   pdfsubject={Documentation of \PackageDocName\ package},
   pdfkeywords={LaTeX, counters},
   bookmarksopen=true,
-  bookmarksopenlevel=4,
+  bookmarksopenlevel=2,
   bookmarksnumbered=true,
   pdfcreator={LaTeX}
 }
@@ -390,7 +392,7 @@
 
 
 \begin{document}
-\mmddyyyydate
+\yyyymmdddate
 
 
 \setlength{\parindent}{0em}
@@ -401,7 +403,7 @@
 \bfseries
   \node [concept] {Counters}
   child[concept color=red!30!yellow,grow=30] { node [concept] {Associated counters}}
-  child[grow=80,white,concept color=red!80!blue] { node [concept] {Backup \& Restore of counters}}
+  child[grow=85,white,concept color=red!80!blue] { node [concept] {Backup \& Restore of counters}}
   child[grow=300,concept color=yellow!90!red] { node [concept] {Extensions to \LaTeXe} child[grow=230,concept color={yellow!20!green}] {node [concept] {Query macros}}
     child[grow=290,concept color={yellow!30!cyan}] {node [concept] {Document counters}}
 }
@@ -410,7 +412,8 @@
   child[grow=170,concept color=red!30!yellow] { node [concept] {Total} child[concept color=yellow!30!,grow=150] {node[concept] {Super total counters}}}
   child[grow=260,concept color=red!30!green] { node [concept] {Loops on counters}}
   child[grow=200,concept color=red!30!green] { node [concept] {Counter output}}
-  child[grow=230,concept color=red!20!cyan] { node [concept] {Coupled counters} child [grow=250,concept color=cyan!50!blue] {node[concept] {Coupled counter groups}}};
+  child[grow=230,concept color=red!20!cyan] { node [concept] {Coupled counters} child [grow=250,concept color=cyan!50!blue] {node[concept] {Coupled counter groups}}}
+  child[grow=57,concept color=red!20!yellow] { node [concept] {Label}};
 \end{tikzpicture}
 
 \CHPackageTitlePage[packageauthor={Christian Hupfer}]{Associated counters stepping simultaneously\\ (and other gadgets)}
@@ -791,7 +794,7 @@
 
 On occasions it might be important to have some information which counter has been changed last. Since there are four commands manipulating counter values, there are four corresponding routines for this:
 
-\begin{docCommand}{LastAddedToCounter}{}
+\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastAddedToCounter}{}
 This command has no arguments and expands to the name of the counter which was used last in \cs{addtocounter}. There is no further typesetting done with the countername. 
 
 \begin{dispExample}
@@ -808,19 +811,22 @@
 \end{marker}
 
 
-\begin{docCommand}{LastSteppedCounter}{}
+\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastSteppedCounter}{}
+
 This command has no arguments and expands to the name of the counter which was stepped last using \cs{stepcounter}. There is no further typesetting done with the countername. 
 
+
 \begin{dispExample}
   \stepcounter{SomeCounter}
-
   The last counter being stepped  was \LastSteppedCounter.
 \end{dispExample}%
 
 \end{docCommand}%
 
-\begin{docCommand}{LastRefSteppedCounter}{}
+\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastRefSteppedCounter}{}
 
+This macro gives the last counter being used in \cs{refstepcounter} and is expandable.%{\ChDocVersion{1.3}}
+
 \begin{dispExample}
   \begin{equation}
     E = mc^2 \label{eq::einstein}
@@ -830,6 +836,7 @@
   The last counter being refstepped  was \LastRefSteppedCounter.
 \end{dispExample}%
 
+
 \end{docCommand}%
 
 
@@ -836,7 +843,7 @@
 
 
 
-\begin{docCommand}{LastSetCounter}{}
+\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastSetCounter}{}
 This command has no arguments and expands to the name of the counter which was set last using \cs{setcounter}. There is no further typesetting done with the countername. 
 
 \begin{dispExample}
@@ -986,6 +993,24 @@
 \end{docCommand}
 
 
+\begin{docCommand}[before={\CHDocNew{1.3}}]{GetAllResetLists}{}
+  This determines all reset lists and stores the information internally. It should be called right before \cs{begin{document}} or at any time inside the document environment, when new counters are added there (which is not recommended)
+
+The information can be retrieved with \refCom{GetParentCounter}. 
+
+\end{docCommand}
+
+\begin{docCommand}[before={\CHDocExpCommand\par\CHDocNew{1.3}}]{GetParentCounter}{\marg{counter}}
+This macro tries to detect the counter that was responsible for the resetting of the counter named \marg{counter} and is expandable. 
+In order to minimize the amount of searching and maintaining expandability, the counter reset data must be stored beforehand, i.e. with \refCom{GetAllResetLists}. 
+
+\begin{marker} 
+If a counter has been added to more than one parent counter as their resetting driver counter, only the most recent addition is in action. This may be correct in some occasions but there is no guarantee that the given counter name really caused the last reset of the counter given as argument. 
+\end{marker}
+\end{docCommand}
+
+
+
 \section[Loops on multiple counters]{Performing the same action for many counters} \CHDocNew{0.7}
 
 Sometimes it might be necessary to set the values of many counters at once. This can be done with consecutive \cs{setcounter} statements, for example. This poses no problem, but might become tedious if there are more than three counters or if this task occurs more than once. \CHDocPackage{\PackageDocName} provides some macros that can do the usual operations like stepping, refstepping, adding to, resetting or setting counter values. 
@@ -1495,53 +1520,8 @@
 \end{docCommand}%
 
 
-\subsection{Associated counters -- Experimental features}\label{subsec::associated_counters_experimental}
-\begin{marker}
-\marginnote{\bcbombe}
-The content here is only of experimental nature and there is no guarantee that the feature will be maintained in future releases. 
-\end{marker}
 
-\begin{marker}
-To enable the redefined \refCom{label} macro, specify the package option \refKey{redefinelabel}
-\end{marker}
 
-
-
-\begin{docCommand}[before={\CHDocNew{1.2}}]{label}{\oarg{cleveref-counter-overrule}\marg{label name}\oarg{options for associated counters}}
-  \begin{docKey}{all}{=\meta{true,false}}{initially \meta{false}}\CHDocNew{1.2}
-    This will enable that all associated counters to a driver counter will cause the generation of a label too. By default this option is \meta{false}.
-    This option deliberately overrules \refKey{select}, the value of the option \refKey{prefix} is disregarded.
-  \end{docKey}
-  \begin{docKey}{select}{={counter1, counter2,\dots}}{initially empty}\CHDocNew{1.2}
-    Select only some of the associated counters to be able to be labeled. 
-    As of version \packageversion{} there is no check whether the given names refer to counters at all or are associated counters to the last counter that has been used with \cs{refstepcounter}. 
-  \end{docKey}
-  \begin{docKey}{prefix}{=\meta{text}}{initially empty}\CHDocNew{1.2}
-    This gives the prefix of the label of the associated counter. If the option \refKey{all} is enabled, the label name is generated from the name of the associated counter, the value of \refKey{prefix-sep} and the value of the 2nd argument. 
-    \newcounter{morefoobar}
-    \begin{dispExample*}{listing only}
-      % Assume that some counter has the associated counters foobar, morefoobar and yetanotherfoobar
-      \label{foo}[prefix=assoc,all]
-      \end{dispExample*}
-      will cause a label named \texttt{foobar::foo}, \texttt{morefoobar::foo} and \texttt{yetanotherfoobar::foo}, whereas
-      \begin{dispExample*}{listing only}
-        \label{foo}[prefix=assoc,select=morefoobar]
-      \end{dispExample*}
-      would generate the label \texttt{assocc::foobar} only and will be tied to the value of the counter \texttt{morefoobar}
-  \end{docKey}
-  \begin{docKey}{prefix-sep}{=\meta{text}}{initially ::}\CHDocNew{1.2}
-    Defines the separator between the \refKey{prefix} and the label name for the driver counter, i.e. the  2nd argument of the \refCom{label} command. 
-  \end{docKey}
-\end{docCommand}
-
-
-\begin{marker}
-\marginnote{\bcbombe}
-If the package option \refKey{redefinelabel} is set to \meta{false}, the usage of the third optional argument will leave spurious content at the position \cs{label} was used. The reason is that the content of third optional argument with \texttt{[]} is not recognized as an argument any longer. 
-\end{marker}
-
-
-
 \section[Counter backup/restoration]{Backup and restore of counter values}\CHDocNew{1.0}\label{section::new_backuprestore}
 
 It might be necessary to interrupt the current sectioning, e.g. including another document's structure (an external paper, for example) such that the counting should start again and after finishing of the external structure the old values should be restored. 
@@ -2281,7 +2261,99 @@
 
 This package adds a counter of its own: \CHDocCounter{numberofruns} which is a super total counter and is stepped each compilation run. It's added in \cs{AtBeginDocument} and can be retrieved with \refCom{TotalValue}. Use the \refKey{nonumberofruns} package option to prevent the definition of this counter.  
 
-\clearpage{
+
+\section{Experimental features}\label{subsec::associated_counters_experimental}
+
+
+\begin{marker}
+\marginnote{\bcbombe}
+The content here is only of experimental nature and there is no guarantee that the feature will be maintained in future releases. 
+\end{marker}
+
+
+\subsection{Labels}
+
+
+
+\begin{marker}
+To enable the redefined \refCom{label} macro, specify the package option \refKey{redefinelabel}
+\end{marker}
+
+
+
+\begin{docCommand}[before={\CHDocNew{1.2}}]{label}{\oarg{cleveref-counter-overrule}\marg{label name}\oarg{options for associated counters}}
+  \begin{docKey}{all}{=\meta{true,false}}{initially \meta{false}}\CHDocNew{1.2}
+    This will enable that all associated counters to a driver counter will cause the generation of a label too. By default this option is \meta{false}.
+    This option deliberately overrules \refKey{select}, the value of the option \refKey{prefix} is disregarded.
+  \end{docKey}
+  \begin{docKey}{select}{={counter1, counter2,\dots}}{initially empty}\CHDocNew{1.2}
+    Select only some of the associated counters to be able to be labeled. 
+    As of version \packageversion{} there is no check whether the given names refer to counters at all or are associated counters to the last counter that has been used with \cs{refstepcounter}. 
+  \end{docKey}
+  \begin{docKey}{prefix}{=\meta{text}}{initially empty}\CHDocNew{1.2}
+    This gives the prefix of the label of the associated counter. If the option \refKey{all} is enabled, the label name is generated from the name of the associated counter, the value of \refKey{prefix-sep} and the value of the 2nd argument. 
+    \newcounter{morefoobar}
+    \begin{dispExample*}{listing only}
+      % Assume that some counter has the associated counters foobar, morefoobar and yetanotherfoobar
+      \label{foo}[prefix=assoc,all]
+      \end{dispExample*}
+      will cause a label named \texttt{foobar::foo}, \texttt{morefoobar::foo} and \texttt{yetanotherfoobar::foo}, whereas
+      \begin{dispExample*}{listing only}
+        \label{foo}[prefix=assoc,select=morefoobar]
+      \end{dispExample*}
+      would generate the label \texttt{assocc::foobar} only and will be tied to the value of the counter \texttt{morefoobar}
+  \end{docKey}
+  \begin{docKey}{prefix-sep}{=\meta{text}}{initially ::}\CHDocNew{1.2}
+    Defines the separator between the \refKey{prefix} and the label name for the driver counter, i.e. the  2nd argument of the \refCom{label} command. 
+  \end{docKey}
+\end{docCommand}
+
+
+\begin{marker}
+\marginnote{\bcbombe}
+If the package option \refKey{redefinelabel} is set to \meta{false}, the usage of the third optional argument will leave spurious content at the position \cs{label} was used. The reason is that the content of third optional argument with \texttt{[]} is not recognized as an argument any longer. 
+\end{marker}
+
+
+\begin{docCommand}[before={\CHDocNew{1.3}}]{LaTeXLabel}{\oarg{cleveref-counter-overrule}\marg{label name}}
+  This is the default label macro, either with the \CHDocPackage{cleveref} extension or the classical \LaTeX2e\ macro (eventually modified by \CHDocPackage{hyperref}) and is not modified by this package. 
+
+
+The feature of label hooks from \refCom{RegisterPreLabelHook} or \refCom{RegisterPostLabelHook} is not used here. 
+\end{docCommand}
+
+
+\subsection{Hooks}
+
+
+This feature is experimental and only realized for the modified \refCom{label} command until now. See \nolinkurl{xassoccnt_getparentcounter_example.tex} as an example of usage. 
+
+\begin{docCommand}[before={\CHDocNew{1.3}}]{RegisterPreLabelHook}{\marg{command name1, command name2,\dots}}
+
+This macro declares a possible list of hooks (commands) that should be executed \textbf{before} the traditional \cs{label} command is applied. If the hook name refers to some unknown macro, nothing is done. 
+
+The hook names must be given with the \textbackslash as command sequence indicator, i.e. \cs{zlabel}, more than one macro name is possible by using comma as separator. 
+
+As of version \packageversion\ the hook macro does not allow more than one argument, which is automatically used from the surrounding \cs{label} call and is the usual label name. 
+
+
+\end{docCommand}
+
+\begin{docCommand}[before={\CHDocNew{1.3}}]{RegisterPostLabelHook}{\marg{command name1, command name2,\dots}}
+
+This macro declares a possible list of hooks (commands) that should be executed after the traditional \cs{label} command is applied. If the hook name refers to some unknown macro, nothing is done. 
+
+The hook names must be given with the \textbackslash as command sequence indicator, i.e. \cs{zlabel}, more than one macro name is possible by using comma as separator. 
+
+As of version \packageversion\ the hook macro does not allow more than one argument, which is automatically used from the surrounding \cs{label} call and is the usual label name. 
+
+\end{docCommand}
+
+
+
+
+
+\clearpage
 \part{Meta-Information}
 
 \parttoc
@@ -2352,6 +2424,14 @@
 
 \begin{itemize}[itemsep=15pt]
 
+\item   \CHDocFullVersion{1.3}
+\begin{itemize}
+  \item Provided the \refCom{LaTeXLabel} macro to access the non-xassoccnt version of the \refCom{label} command. 
+  \item \CHDocExperimentalFeature Added the concept of label hooks, see \cref{subsec::associated_counters_experimental} for more information.
+  \item The macros \cs{Last...} are defined with \CHDocPackage{expl3} methods. 
+  \item Added \refCom{GetAllResetLists} and \refCom{GetParentCounter} for information on parent (or driver) counters. 
+\end{itemize}
+
 \item   \CHDocFullVersion{1.2}
 \begin{itemize}
   \item Corrected some typos in the manual. 

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Driver file for xassoccnt.sty
 %%
 %%

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file for xassoccnt.sty
 %%
 %%

Added: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf	2017-03-05 21:39:46 UTC (rev 43408)

Property changes on: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -0,0 +1,152 @@
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
+%% Example file for determing the parent counter of a counter and referring to it file for xassoccnt.sty
+%%
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
+%% -------------------------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%%
+%% This work has the LPPL maintenance status `author-maintained`
+%%
+%%
+
+
+% Source was a question on TeX.SE by user gigabytes: http://tex.stackexchange.com/questions/353491/how-to-show-also-the-name-of-the-parent-counter-with-cleveref
+% The provided answer by Christian Hupfer did not use xassoccnt but the features were incorporated in the package. 
+
+\documentclass{book}
+\usepackage{lipsum}
+\usepackage{xassoccnt}
+\usepackage{xpatch}
+\usepackage{hyperref}
+\usepackage[user,counter,hyperref]{zref}
+\usepackage{cleveref}
+
+\makeatletter
+\AtEndPreamble{
+  \newif\if at hyperrefloaded
+
+\@ifpackageloaded{hyperref}{%
+  \@hyperrefloadedtrue
+}{
+  \@hyperrefloadedfalse
+}
+}
+\makeatother
+
+
+
+
+\usepackage{xparse}
+\makeatletter
+
+\ExplSyntaxOn
+\prop_new:N \g_latex_parentcounters_prop 
+\seq_new:N  \g_latex_counters_seq
+
+\cs_generate_variant:Nn \str_head:n {x,o,V}
+\cs_generate_variant:Nn \str_tail:n {x,o,V}
+\cs_generate_variant:Nn \str_upper_case:n {x,o,V}
+\cs_generate_variant:Nn \str_set:Nn {Nx,No}
+
+% Store all reset lists and make a property list for each counter and its possible parent counter
+
+% Make the first character of a word upper case
+\newcommand{\FirstUpcase}[1]{%
+  \str_set:Nx \l_tmpa_str {#1}%
+  \str_upper_case:x {\str_head:N \l_tmpa_str}\str_tail:V {\l_tmpa_str}%
+}
+
+\ExplSyntaxOff
+
+
+
+
+% Define new properties
+\zref at newprop{childcountervalue}{\arabic{\LastRefSteppedCounter}}% This is the naked value
+\zref at newprop{parentcountervalue}{\csname the\GetParentCounter{\LastRefSteppedCounter}\endcsname}
+\zref at newprop{parentcountername}{\GetParentCounter{\LastRefSteppedCounter}}
+
+% Add the new properties to the main property list stored with \zlabel
+\zref at addprops{main}{childcountervalue,parentcountervalue,parentcountername}
+
+% Command for uppercase output
+\NewDocumentCommand{\parentCref}{m}{%
+  \zref at ifrefundefined{#1}{%
+    \Cref{#1}%
+  }{%
+    \edef\@tmpb@{\zref at extract{#1}{parentcountervalue}}%
+    \edef\@tmpa@{\csname the\zref at extract{#1}{parentcountername}\endcsname}%
+    \ifx\@tmpb@\@tmpa@
+    \Cref{#1}%
+    \else
+    \if at hyperrefloaded
+    \FirstUpcase{\zref at extract{#1}{counter}} \hyperlink{\zref at extract{#1}{anchor}}{\zref at extract{#1}{childcountervalue}} of \FirstUpcase{\zref at extract{#1}{parentcountername}} \hyperlink{\zref at extract{#1}{anchor}}{\zref at extract{#1}{parentcountervalue}}%
+    \else
+    \FirstUpcase{\zref at extract{#1}{counter}} \zref at extract{#1}{childcountervalue} of \FirstUpcase{\zref at extract{#1}{parentcountername}} \zref at extract{#1}{parentcountervalue}%
+    \fi
+    \fi
+  }%
+}
+
+% Command for lowercase output
+\NewDocumentCommand{\parentcref}{m}{%
+  \zref at ifrefundefined{#1}{%
+    \cref{#1}%
+  }{%
+    \edef\@tmpb@{\zref at extract{#1}{parentcountervalue}}%
+    \edef\@tmpa@{\csname the\zref at extract{#1}{parentcountername}\endcsname}%
+    \ifx\@tmpb@\@tmpa@
+    \Cref{#1}%
+    \else
+    \if at hyperrefloaded
+    \zref at extract{#1}{counter} \hyperlink{\zref at extract{#1}{anchor}}{\zref at extract{#1}{childcountervalue}} of \zref at extract{#1}{parentcountername} \hyperlink{\zref at extract{#1}{anchor}}{\zref at extract{#1}{parentcountervalue}}%
+    \else
+    \zref at extract{#1}{counter} \zref at extract{#1}{childcountervalue} of \zref at extract{#1}{parentcountername} \zref at extract{#1}{parentcountervalue}%
+    \fi
+    \fi
+  }%
+}
+
+\makeatother
+
+
+\GetAllResetLists
+\RegisterPostLabelHook{\zlabel}
+
+
+
+\begin{document}
+\chapter{Chapter One}
+  Please look at \parentCref{othersection} or at \parentCref{foosubsection} or at \parentcref{foosubsection}
+
+
+  \section{Section One.One}
+  \label{mysection}
+  \lipsum
+
+  \section{Section One.Two}
+
+  \subsection{A subsection} \label{foosubsection}
+  Please ignore \parentCref{mysection}.
+  
+  \chapter{Chapter Two}
+  \section{Section Two.One}
+
+  As you may have noticed, \parentCref{mysection} is useless.
+
+
+  \chapter{Chapter Three}
+  \section{Section Three.One}   %
+  \section{Section Three.Two}\label{othersection}
+
+\end{document}
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file the the usage of labels with associated counters file for xassoccnt.sty
 %%
 %%

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file for periodic counters file for xassoccnt.sty
 %%
 %%

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file for reset list features file for xassoccnt.sty
 %%
 %%
@@ -25,11 +25,14 @@
 
 \usepackage{xassoccnt}
 
+\DeclareDocumentCounter{dummyctra}[chapter]
+
 \newcommand{\showfullresetlist}[1]{%
 \item Counter name: #1 \hfill \csname the#1\endcsname%\leavevmode%
 }
 
 \begin{document}
+\tableofcontents
 
 \chapter{First} 
 
@@ -60,6 +63,7 @@
 \AddToReset{section}{chapter}
 
 
+
 \chapter{Third Chapter}
 
 \section{First section in 3rd chapter}
@@ -71,5 +75,22 @@
 \caption{Another dummy figure}
 \end{figure}
 
+\GetAllResetLists
 
+\chapter[Parent counter of another counter]{Determing the parent counter of a counter}
+
+\section{Some dummy section}
+
+The last ref stepped counter is \LastRefSteppedCounter
+
+\fbox{\GetParentCounter{\LastRefSteppedCounter}}
+
+\AddToReset{dummyctra}{section}
+
+\GetAllResetLists
+\noindent\GetParentCounter{dummyctra}
+
+
+
+
 \end{document}
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file for suspended counters file for xassoccnt.sty
 %%
 %%

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,4 +1,4 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Example file for total counters file for xassoccnt.sty
 %%
 %%

Modified: trunk/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty	2017-03-05 21:39:33 UTC (rev 43407)
+++ trunk/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty	2017-03-05 21:39:46 UTC (rev 43408)
@@ -1,9 +1,9 @@
-%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43)
+%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47)
 %% Source file for xassoccnt.sty
 %%
 %%
 %% -------------------------------------------------------------------------------------------
-%% Copyright (c) 2015 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
+%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
 %% -------------------------------------------------------------------------------------------
 %%
 %% This work may be distributed and/or modified under the
@@ -19,10 +19,10 @@
 %%
 %%
 
-\def\xassoccntpackageversion{1.2}
+\def\xassoccntpackageversion{1.3}
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
 
-\ProvidesPackage{xassoccnt}[2017/03/04 - v\xassoccntpackageversion]
+\ProvidesPackage{xassoccnt}[2017/03/05 - v\xassoccntpackageversion]
 \RequirePackage{etoolbox}
 \RequirePackage{letltxmacro}
 \RequirePackage{xcolor}
@@ -38,6 +38,7 @@
 % Some variants of standard expl3 contributions
 
 \cs_generate_variant:Nn \seq_set_from_clist:Nn { Nx, cx }
+\cs_generate_variant:Nn \seq_gset_from_clist:Nn { Nx, cx }
 
 \cs_generate_variant:Nn \seq_remove_all:Nn { cV, NV }
 \cs_generate_variant:Nn \seq_gremove_all:Nn { cV, NV }
@@ -44,7 +45,7 @@
 \cs_generate_variant:Nn \seq_gput_right:cn {cx}
 \cs_generate_variant:Nn \prop_put:Nnn {cxx}
 \cs_generate_variant:Nn \prop_remove:Nn {cx,Nx}
-\cs_generate_variant:Nn \prop_item:Nn {NV,cV,cx}
+\cs_generate_variant:Nn \prop_item:Nn {NV,cV,cx,No,co}
 \cs_generate_variant:Nn \int_set:Nn {NV,Nx}
 
 
@@ -87,8 +88,15 @@
 \bool_new:N \l_xassoccnt_resetperiodiccounters_bool 
 \bool_new:N \l_xassoccnt_wrapperiodiccounters_bool 
 
+
+% Reset of counters related 'variables'
 \seq_new:N \l__xassoccnt_counterreset_seq
 
+\seq_new:N \g_xassoccnt_all_latex_counters_seq
+
+\prop_new:N \g_xassoccnt_latex_parentcounters_prop
+
+
 %%%
 \int_new:N \g__xassoccnt_backupcalls_int
 \int_new:N \l__xassoccnt_backuptmpa_int
@@ -477,7 +485,7 @@
 }{}
 
 \AtEndOfPackage{
-  \PackageInfo{xassoccnt}{2017/03/04 - v\xassoccntpackageversion -- stepping counters simultaneously and other features}
+  \PackageInfo{xassoccnt}{2017/03/05 - v\xassoccntpackageversion -- stepping counters simultaneously and other features}
   \@ifpackageloaded{calc}{%
     \msg_warning:nnn{xassoccnt}{incompatiblepackagenonfatal}{calc}% Warning
     \bool_set_true:N \l__xassoccnt_calcpackage_loaded
@@ -1550,7 +1558,6 @@
   }{%
     \AddBackupCounters[#1]{#2}%
   }
-
 }
 
 
@@ -2167,7 +2174,8 @@
     \xassoccnt_is_coupledcounter:nTF {#1}
     { \xassoccnt_stepcounter_coupledcounters:n{#1} }
     {% No, not a coupled counter!
-      \cs_gset_nopar:Nn \__xassoccnt_laststeppedcounter: {\l_tmpa_tl}%
+%      \cs_gset_nopar:Nn \__xassoccnt_laststeppedcounter: {\l_tmpa_tl}%
+      \cs_gset_nopar:Npx \LastSteppedCounter {\tl_use:N \l_tmpa_tl}%
       \xassoccnt_countersinresetlist:n{\l_tmpa_tl}%
       \__xassoccnt_getresetlist:n {\l_tmpa_tl}%
       \seq_if_empty:NTF  \l__xassoccnt_counterreset_seq 
@@ -2228,7 +2236,8 @@
   \xassoccnt_is_suspendedcounter:nF{#1}{%
     \__xassoccnt_translate_countername:cn {l_tmpb_tl} {#1}%
     \xassoccnt_standardaddtocounter{\l_tmpb_tl}{#2}%
-    \cs_gset_nopar:Nn \__xassoccnt_lastaddtocounter: {\l_tmpb_tl}%
+%    \cs_gset_nopar:Nn \__xassoccnt_lastaddtocounter: {\l_tmpb_tl}% Remove this
+    \cs_gset_nopar:Npx \LastAddedToCounter {\tl_use:N \l_tmpb_tl}%
   }%
   % Now check if #1 is a total counter and set the property correspondingly
   \__xassoccnt_is_totalcounter:nT {#1} {%
@@ -2264,6 +2273,7 @@
     }
   }
   \cs_gset_nopar:Nn \__xassoccnt_lastsetdocumentcounter: {#2}%
+  \cs_gset_nopar:Npx \LastSetDocumentCounter {#2}%
   \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{\l_tmpa_tl}}%
 }
 
@@ -2326,7 +2336,8 @@
 
 \RenewDocumentCommand{\setcounter}{mm}{%
   \__xassoccnt_translate_countername:cn {l_tmpb_tl}{#1}%
-  \cs_gset_nopar:Nn \__xassoccnt_lastsetcounter: {#1}
+%  \cs_gset_nopar:Nn \__xassoccnt_lastsetcounter: {#1}
+  \cs_gset_nopar:Npx \LastSetCounter {#1}
   \xassoccnt_standardsetcounter{\tl_use:N \l_tmpb_tl}{#2}%
   \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{\l_tmpb_tl}}%
   \__xassoccnt_is_totalcounter:nT {#1} {%
@@ -2338,7 +2349,7 @@
 
 \RenewDocumentCommand{\refstepcounter}{m}{%
   \seq_if_in:NxF \g_xassoccnt_suspendedcnt_seq {#1} {%
-    \cs_gset_nopar:Nx \__xassoccnt_lastrefsteppedcounter: {#1}
+    \cs_gset_nopar:Npx \LastRefSteppedCounter {#1}
     \xassoccnt_standardrefstepcounter{#1}%
     \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{#1}}%
   }
@@ -2345,38 +2356,14 @@
 }
 
 
-%%%% Now some expandable wrapper macros for information on the last counter changed
 
-\newcommand{\LastSteppedCounter}{%
-  \__xassoccnt_laststeppedcounter:
-}
-
-
-\newcommand{\LastRefSteppedCounter}{%
-  \__xassoccnt_lastrefsteppedcounter:
-}
-
-\newcommand{\LastAddedToCounter}{%
-  \__xassoccnt_lastaddtocounter:
-}
-
-\newcommand{\LastSetCounter}{%
-  \__xassoccnt_lastsetcounter:
-}
-
-\newcommand{\LastSetDocumentCounter}{%
-  \__xassoccnt_lastsetdocumentcounter:
-}
-
-
-%%%%%%%%%
-
-
 \newcommand{\LastCounterValue}{%
   \int_use:N \g__xassoccnt_lastcountervalue_int
 }
 
 
+%%%%% Wrappers for \newcounter etc. 
+
 \NewDocumentCommand{\NewDocumentCounter}{O{initial=\c_zero}mo}{%
   \seq_set_from_clist:Nx \l_tmpa_seq {#2} 
   \seq_map_inline:Nn \l_tmpa_seq {%
@@ -2388,17 +2375,6 @@
   }
 }
 
-%\NewDocumentCommand{\NewDocumentCounters}{O{initial=\c_zero}mo}{%
-%  \seq_map_inline:Nn \l_tmpa_seq {%
-%    \IfValueTF{#3}{%
-%      \NewDocumentCounter[#1]{##1}[#3]%
-%    }{%
-%      \NewDocumentCounter[#1]{##1}%
-%    }%	
-%  }%
-%}
-
-
 \NewDocumentCommand{\CopyDocumentCounters}{O{}mm}{% 
   \__xassoccnt_copycounters:nnn{#1}{#2}{#3}%
 }
@@ -2454,6 +2430,35 @@
 }
 
 
+
+\cs_new_nopar:Npn \GetAllResetLists {%
+  \group_begin:
+  \def\@elt##1{%
+    \seq_gput_right:Nn \g_xassoccnt_all_latex_counters_seq {##1}%
+%    \seq_set:c { g_latex_cntr_##1_seq }
+  }
+  \cl@@ckpt%
+  \seq_map_inline:Nn \g_xassoccnt_all_latex_counters_seq {%
+    \def\@elt####1{####1,}
+    \seq_set_from_clist:cx { g_latex_cntr_##1_seq } { \use:c{cl@##1} }
+  }
+  % Now fill the parent counter lists
+  \seq_map_inline:Nn \g_xassoccnt_all_latex_counters_seq {%
+    \seq_map_inline:cn { g_latex_cntr_##1_seq }{ %
+      \prop_gput:Nnn \g_xassoccnt_latex_parentcounters_prop {####1} {##1}
+    }
+  }
+  \group_end:
+}
+
+
+% Gives the parent counter of a specific counter (or nothing)
+\cs_new:Npn \GetParentCounter #1{%
+  \prop_item:No \g_xassoccnt_latex_parentcounters_prop {#1}
+}
+
+
+
 % Pretty printing counters
 
 \NewDocumentCommand{\PrettyPrintCounterName}{+mm}{%
@@ -2944,50 +2949,137 @@
 
 %%% Label features --- Experimental --- from 2017/03/03
 
-\NewDocumentCommand{\RedefineLabelCommand}{}{%
-  \bool_if:NT \g__xassoccnt_redefinelabel_bool {
-  
+\seq_new:N \g_xassoccnt_pre_label_hooks_seq
+\seq_new:N \g_xassoccnt_post_label_hooks_seq
+
+\cs_new:Nn \__xassoccnt_register_label_hook:nn {%
+  \group_begin:
+  \seq_set_from_clist:Nn \l_tmpa_seq {#2}
+  \seq_map_inline:Nn \l_tmpa_seq {%
+    \seq_gput_right:cn {g_xassoccnt_#1_label_hooks_seq} {\cs_to_str:N ##1}
+  }
+  \seq_gremove_duplicates:c {g_xassoccnt_#1_label_hooks_seq}
+  \group_end:
+}
+
+\cs_new:Nn \__xassoccnt_clear_label_hooks:n {
+  \seq_gclear:c {g_xassoccnt_#1_label_hooks_seq }
+}
+
+\cs_new:Nn \__xassoccnt_remove_from_label_hook:nn {%
+  \seq_gremove:cn {g_xassoccnt_#1_label_hooks_seq} {#2}
+}
+
+\NewDocumentCommand{\RegisterPreLabelHook}{m}{%
+  \__xassoccnt_register_label_hook:nn {pre} {#1}
+}
+
+\NewDocumentCommand{\RegisterPostLabelHook}{m}{%
+  \__xassoccnt_register_label_hook:nn {post} {#1}
+}
+
+\NewDocumentCommand{\ClearPostLabelHook}{}{%
+  \__xassoccnt_clear_label_hooks:n {post}
+}
+
+\NewDocumentCommand{\ClearPreLabelHook}{}{%
+  \__xassoccnt_clear_label_hooks:n {post}
+}
+
+
+\NewDocumentCommand{\RunLabelHooks}{mm}{%
+  \seq_if_exist:cT {g_xassoccnt_#1_label_hooks_seq} {
+    \seq_map_inline:cn {g_xassoccnt_#1_label_hooks_seq} {%
+      \cs_if_exist:cT {##1} {
+        \use:c{##1}{#2}%
+      }
+    }	  
+  }
+}
+
+\NewDocumentCommand{\RunPreLabelHooks}{m}{%
+  \seq_if_exist:NT \g_xassoccnt_pre_label_hooks_seq {
+    \seq_map_inline:Nn \g_xassoccnt_pre_label_hooks_seq {%
+      \cs_if_exist:cT {##1} {
+        \use:c{##1}{#1}%
+      }	
+    }
+  }
+}
+
+\NewDocumentCommand{\RunPostLabelHooks}{m}{%
+  \seq_if_exist:NT \g_xassoccnt_post_label_hooks_seq {
+    \seq_map_inline:Nn \g_xassoccnt_post_label_hooks_seq {%
+      \cs_if_exist:cT {##1} {
+        \use:c{##1}{#1}%
+      }
+    }	
+  }
+}
+
+%%%
+
+\NewDocumentCommand{\ProvideOriginalLabelCommands}{}{%
   \cs_new:Nn \__xassoccnt_internal_label:n {%
-    \latex@@label{##1}%
+    \xassoccntlatex@@label{##1}%
   }
 
   \cs_new:Nn \__xassoccnt_internal_label:nn {%
     \bool_if:NTF \l__xassoccnt_cleverefpackage_loaded_bool {%
-      \latex@@label[##1]{##2}%
+      \xassoccntlatex@@label[##1]{##2}%
     }{
-      \latex@@label{##2}%
+      \xassoccntlatex@@label{##2}%
     }
   }
+}
 
-  \keys_define:nn {xassoccntlabel} {%
-    all .bool_set:N  = \l_xassoccnt_allassociatedcounters_labeled_bool,
-    select .code:n= { \seq_set_from_clist:Nx  \l_tmpa_seq { ##1 }\bool_set_false:N  \l_xassoccnt_allassociatedcounters_labeled_bool },
-    prefix .code:n={ \prop_put:Nnx \l_tmpa_prop {prefix} {##1} },
-    prefix-sep .code:n={ \prop_put:Nnx \l_tmpa_prop {prefix-sep} {##1} }
-  }
-  \RenewDocumentCommand{\label}{omO{}}{%
-    \group_begin:
-    \prop_clear:N \l_tmpa_prop
-    \seq_clear:N \l_tmpa_seq
-    \keys_set:nn {xassoccntlabel} {all=true,prefix-sep={\xassoccnt_extract_moduledata:n{prefix-sep}},##3}%
-    % 
-    \IfValueTF{##1}{%
-      % Generate the regular label 
-      \__xassoccnt_internal_label:nn {##1} {##2}
-    }{%
-      \__xassoccnt_internal_label:n {##2}
+
+\NewDocumentCommand{\RedefineLabelCommand}{}{%
+  % Do only if redefinelabel=true was set as package option
+  \bool_if:NT \g__xassoccnt_redefinelabel_bool {
+    \keys_define:nn {xassoccntlabel} {%
+      all .bool_set:N  = \l_xassoccnt_allassociatedcounters_labeled_bool,
+      select .code:n= { \seq_set_from_clist:Nx  \l_tmpa_seq { ##1 }\bool_set_false:N  \l_xassoccnt_allassociatedcounters_labeled_bool },
+      prefix .code:n={ \prop_put:Nnx \l_tmpa_prop {prefix} {##1} },
+      prefix-sep .code:n={ \prop_put:Nnx \l_tmpa_prop {prefix-sep} {##1} }
     }
-    \bool_if:NT \l_xassoccnt_allassociatedcounters_labeled_bool  {%
-      % The prefix is made from the associated counter
-      \prop_remove:Nn \l_tmpa_prop {prefix}
-      \seq_set_eq:Nc \l_tmpa_seq {\__xassoccnt_drivercontainer:n{\LastRefSteppedCounter}}
+    \RenewDocumentCommand{\label}{omO{}}{%
+      \group_begin:
+      \prop_clear:N \l_tmpa_prop
+      \seq_clear:N \l_tmpa_seq
+      \keys_set:nn {xassoccntlabel} {all=true,prefix-sep={\xassoccnt_extract_moduledata:n{prefix-sep}},##3}%
+      % 
+      \RunLabelHooks{pre}{##2}%
+      \IfValueTF{##1}{%
+        % Generate the regular label 
+        \__xassoccnt_internal_label:nn {##1} {##2}
+      }{%
+        \__xassoccnt_internal_label:n {##2}
+      }
+      \RunLabelHooks{post}{##2}%
+      \bool_if:NT \l_xassoccnt_allassociatedcounters_labeled_bool  {%
+        % The prefix is made from the associated counter
+        \prop_remove:Nn \l_tmpa_prop {prefix}
+        \seq_set_eq:Nc \l_tmpa_seq {\__xassoccnt_drivercontainer:n{\LastRefSteppedCounter}}
+      }
+      \seq_if_empty:NF \l_tmpa_seq {% Check whether either the only - list or the driver container list is empty (i.e. it was no driver container at all
+        % If non-empty -> generate the labels with the given naming scheme 
+        \__xassoccnt_generate_associated_counters_labels:Nn \l_tmpa_seq {##2}
+      }% End of \seq_if_empty
+      \group_end:
+    }% End of \RenewDocumentCommand{\label}
+  }% End of bool_if:NT \g__xassoccnt_redefinelabel_bool
+}
+
+\NewDocumentCommand{\LaTeXLabel}{om}{%
+  \bool_if:NTF \l__xassoccnt_cleverefpackage_loaded_bool {%
+    \IfValueTF{#1}{
+      \xassoccntlatex@@label[#1]{#2}%
+    }{
+      \xassoccntlatex@@label{#2}%
     }
-    \seq_if_empty:NF \l_tmpa_seq {% Check whether either the only - list or the driver container list is empty (i.e. it was no driver container at all
-      % If non-empty -> generate the labels with the given naming scheme 
-      \__xassoccnt_generate_associated_counters_labels:Nn \l_tmpa_seq {##2}
-    }% End of \seq_if_empty
-    \group_end:
-  }% End of \RenewDocumentCommand{\label}
+  }{%
+    \xassoccntlatex@@label{#2}%
   }
 }
 
@@ -3020,7 +3112,8 @@
 
 \AtEndPreamble{%
   \AtBeginDocument{%
-    \LetLtxMacro\latex@@label\label
+    \LetLtxMacro\xassoccntlatex@@label\label
+    \ProvideOriginalLabelCommands%
     \RedefineLabelCommand%
   }
 }



More information about the tex-live-commits mailing list