diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-11 23:06:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-11 23:06:44 +0000 |
commit | 876b86d0b964599f049d2ae7d670b73308961d4a (patch) | |
tree | b0fd38e2e0f32c2797b76e3e26fbab924adcc712 /Master | |
parent | a880c715c123c4ecf8da826a5283895cec739b42 (diff) |
xassoccnt (11jun16)
git-svn-id: svn://tug.org/texlive/trunk@41371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/README | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf | bin | 94256 -> 94256 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf | bin | 417841 -> 430273 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex | 141 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf | bin | 80724 -> 80724 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf | bin | 68837 -> 68384 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf | bin | 0 -> 60527 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex | 94 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty | 118 |
12 files changed, 319 insertions, 54 deletions
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/README b/Master/texmf-dist/doc/latex/xassoccnt/README index b73bb24eda1..02e0db32150 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/README +++ b/Master/texmf-dist/doc/latex/xassoccnt/README @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.7 (2016/05/10 -- 00/41/54) +%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) %% README file for xassoccnt.sty %% %% @@ -26,7 +26,7 @@ the associated counters as well. This package can be regarded as a supplement to the totcount package by Vasileios Koutavas (http://www.ctan.org/pkg/totcount), but can be used without it too. -As of 2016/05/10 xassoccnt does not supersede the package assoccnt by the same author, however, -the older package isn't declared obsolete as of 2016/05/10 +As of 2016/06/10 xassoccnt does not supersede the package assoccnt by the same author, however, +the older package isn't declared obsolete as of 2016/06/10 diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf Binary files differindex 17476450b1c..011e364122c 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex index b015aabf611..e4551a286c2 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex @@ -1,5 +1,5 @@ -%% LaTeX package xassoccnt - version 0.7 (2016/05/10 -- 00/41/54) -%% Coupled counters examples file for xassoccnt.sty +%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% Example file for coupled counters file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf Binary files differindex 8b173192452..572082f925f 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex index c0ff88c6290..f67c6ecab59 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex @@ -1,5 +1,5 @@ -%% LaTeX package xassoccnt - version 0.7 (2016/05/10 -- 00/41/54) -%% Documentation file for xassoccnt.sty +%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% Documentation file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- @@ -51,6 +51,7 @@ \newlist{codeoptionsenum}{enumerate}{1} \setlist[codeoptionsenum,1]{label={\textcolor{blue}{\#\arabic*}}} +\renewcommand{\rmdefault}{\sfdefault} \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} @@ -67,10 +68,31 @@ \def\KVchdocfilepurpose{#1}% } + +\newcommand{\chdocextractversion}[1]{% + \@nameuse{#1}% +} + + + +\@namedef{xassoccntversion0.4}{v0.4 2016-01-26} + +\@namedef{xassoccntversion0.5}{v0.5 2016-02-27} + +\@namedef{xassoccntversion0.6}{v0.6 2016-03-05} + +\@namedef{xassoccntversion0.7}{v0.7 2016-05-10} + +\@namedef{xassoccntversion0.8}{v0.8 2016-05-16} + + \makeatother + + + \fancypagestyle{plain}{% \fancyfoot[L]{\begin{tabular}[t]{l}\PackageDocName\ \packageversion \tabularnewline \textcopyright\ Dr. Christian Hupfer\end{tabular}}% \fancyfoot[C]{\thepage}% @@ -84,6 +106,7 @@ } + \newtcolorbox{CHPackageTitleBox}[1][]{% enhanced jigsaw, drop lifted shadow, @@ -287,8 +310,9 @@ \newcommand{\versionzerofourdate}{v0.4 2016-01-26} \newcommand{\versionzerofivedate}{v0.5 2016-02-27} \newcommand{\versionzerosixdate}{v0.6 2016-03-05} -\newcommand{\currentversiondate}{2016-05-10} -\newcommand{\versionzerosevendate}{v0.7 \currentversiondate} +\newcommand{\versionzerosevendate}{v0.7 2016-05-10} +\newcommand{\currentversiondate}{2016-06-10} +\newcommand{\versionzeroeightdate}{v0.8 \currentversiondate} \begin{document} \mmddyyyydate @@ -398,7 +422,8 @@ For potential problems see \cref{subsection:incompatibilities} \begin{marker} -\tcbdocmarginnote{\tcbdocupdated{\versionzerosevendate}} +%\tcbdocmarginnote{\tcbdocupdated{\versionzerosevendate}} +\tcbdocmarginnote{\tcbdocupdated{\chdocextractversion{xassoccntversion0.7}}} Of course any package other that loads \CHDocPackage{calc} must be loaded before \PackageDocName, i.e. \CHDocPackage{mathtools}. \end{marker} @@ -836,6 +861,32 @@ This command sequence tests whether the counter \meta{reset counter} is not in t See the related commands \refCom{IfInResetListTF} and \refCom{IfInResetListT} as well. \end{docCommand} +\begin{docCommand}{DisplayResetList}{\oarg{separator={,}}\marg{resetting counter}}\tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} + +This command displays the reset list of a counter as a separated list. If the counter has no resetting list, nothing is shown. + +\begin{docCommandArgs}{DisplayResetList}% + +\begin{codeoptionsenum} +\item \oarg{separator}% + This separator is used for display, it defaults to a comma character. + +\item \marg{resetting counter}% + + Contains the name of counter whose resetting list should be displayed. +\end{codeoptionsenum} +\end{docCommandArgs} + +\end{docCommand} + +\begin{docCommand}{ShowResetList}{\marg{resetting counter}}\tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} + +This command displays the reset list of a counter on the terminal as the \cs{show} command would do. This is rather useful for debugging purposes only. +\end{docCommand} + + + + \subsection[Information macros]{Information on counters} \label{subsection::informationcmds} 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: @@ -939,15 +990,45 @@ Please note, that all of this commands are only working in the current run of co \section[Suspending and Resuming]{Suspending and resuming (associated) counters}\label{section::suspendedresumedcounters} + + Rather than removing an associated counter from the list, it is possible to suspend the automatic stepping for a while and then resume it (or completely drop it), for example, if the value of a counter should not be stepped within a specific chapter etc. +\tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} +\begin{marker} + Suspension and resuming counters can cause wrong hyper links if \CHDocPackage{hyperref} is used. +\end{marker} + \begin{docCommand}{SuspendCounters}{\oarg{options}\marg{counters list}}% \begin{docCommandArgs}{SuspendCounters}% \begin{codeoptionsenum} \item \oarg{options}% + + Not used so far, reserved for later usage. + +\item \marg{counters list}% - Not used so far, reserved for later usages + Contains the name of counters to be suspended, separated by commas (CSV - list) +\end{codeoptionsenum} +\end{docCommandArgs} +\end{docCommand}% + +\begin{docCommand}{CascadeSuspendCounters}{\oarg{options}\marg{counters list}}\tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} + +This macro is more powerful than \refCom{SuspendCounters}, since it tries to detect whether a counter has a reset list and 'mutes' the counters on this list as well and checks whether those counters themselves have reset lists and cascades down to the final state. + +\begin{marker} + Stated differently: All counters anyhow connected to a counter named \CHDocCounter{foo} will be suspended, e.g. for the \CHDocClass{book} class and \CHDocCounter{chapter}, this means in a standard setup, that \CHDocCounter*{section,figure,table,equation,footnote} will be suspended, as well as in consequence \CHDocCounter*{subsection,subsubsection,paragraph,subparagraph}, assuming hereby no other counters have been added to the reset lists. +\end{marker} + + +\begin{docCommandArgs}{CascadeSuspendCounters}% + +\begin{codeoptionsenum} +\item \oarg{options}% + + Not used so far, reserved for later usage. \item \marg{counters list}% @@ -956,10 +1037,17 @@ Rather than removing an associated counter from the list, it is possible to susp \end{docCommandArgs} \end{docCommand}% + \begin{docCommand}{ResumeSuspendedCounters}{\oarg{options}\marg{counters list}} + As of version \packageversion\ the optional argument is not used and reserved for later purposes. This command revokes the suspension of the counters in the \marg{counters} list. \end{docCommand} +\begin{docCommand}{ResumeAllSuspendedCounters}{\oarg{options}} \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} + As of version \packageversion\ the optional argument is not used and reserved for later purposes. + This command revokes all suspended counters. +\end{docCommand} + \begin{marker} If a driver counter is suspended, all counters associated to it are suspended too! @@ -1132,7 +1220,7 @@ This macro swaps the values of the counters given in arguments 2 and 3 \begin{docCommand}{SyncCounters}{\oarg{options}\marg{driver counter}} -This document synchronizes the driver counter value to the associated values. It has the some options as \refCom{SetDocumentCounter}. If the given counter is no driver counter, nothing is done. +This document synchronizes the driver counter value to the associated values. It has the same options as \refCom{SetDocumentCounter}. If the given counter is no driver counter, nothing is done. \begin{docCommandArgs}{SyncCounters}% @@ -1732,7 +1820,7 @@ to the users at tex.stackexchange.com, especially to \item Enrico Gregorio \item Joseph Wright \item David Carlisle - \item Werner + \item Werner Grundlingh \item Gonzalo Medina \item Cosmo Huber (for providing the bug report with the \CHDocPackage{calc} package.) \end{itemize} @@ -1750,21 +1838,34 @@ write this documentation. \section{Version history} \begin{itemize} -\item -Version 0.7 - -\begin{itemize}[label={$\checkmark$}] -\item Fixed a small bug in the \CHDocPackage{\PackageDocName} version of \cs{stepcounter} -\item Added some macros that support the output of binary, octal or hexadecimal (both lower/uppercase) values of counters. \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} - \item Added the \cs{Loop...Counters} macros that performs an action in loop on all given counter names. \tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} -\end{itemize} \item -Version 0.6 - +Version 0.8 \begin{itemize}[label={$\checkmark$}] - \item The coupled counters allow to specify a counter group to which all relevant counters belong, this allows several coupled counter groups then \tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} - \item Fixed a small bug within backup counter support -- the resetting was not done any more \tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\item Fixed the \refCom{SuspendCounters} and \refCom{ResumeSuspendedCounters} macros -- the comma separated list of counters was not used (contrary to the purpose and the documentation description). \tcbdocmarginnote{\tcbdocupdated{\chdocextractversion{xassoccntversion0.8}}} + \item Additions of commands\tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} + \begin{itemize}[label={$\triangleright$}] + \item \refCom{ResumeAllSuspendedCounters} + \item \refCom{CascadeSuspendCounters} + \item \refCom{DisplayResetList} + \item \refCom{ShowResetList} + \end{itemize} + \end{itemize} +\item + Version 0.7 + + \begin{itemize}[label={$\checkmark$}] + \item Fixed a small bug in the \CHDocPackage{\PackageDocName} version of \cs{stepcounter} + \item Added some macros that support the output of binary, octal or hexadecimal (both lower/uppercase) values of counters. \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} + \item Added the \cs{Loop...Counters} macros that performs an action in loop on all given counter names. \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} + \end{itemize} + + \item + Version 0.6 + + \begin{itemize}[label={$\checkmark$}] + \item The coupled counters allow to specify a counter group to which all relevant counters belong, this allows several coupled counter groups then \tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} + \item Fixed a small bug within backup counter support -- the resetting was not done any more \tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} \item Added the \CHDocKey{nonumberofruns}\ package option. \end{itemize} \item diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf Binary files differindex 5e6876b0467..673de363105 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex index d79e6bbe5f4..c07fb83b19b 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex @@ -1,5 +1,5 @@ -%% LaTeX package xassoccnt - version 0.7 (2016/05/10 -- 00/41/54) -%% Driver file for xassoccnt.sty +%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% Driver file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf Binary files differindex 1eb68c663cc..ef38cd07e92 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex index 431621c5d22..e29df7fe8ca 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex @@ -1,5 +1,5 @@ -%% LaTeX package xassoccnt - version 0.7 (2016/05/10 -- 00/41/54) -%% Example file for xassoccnt.sty +%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% Example file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- @@ -141,7 +141,7 @@ In section \ref{section::query} same queries and statistics are shown. \QuickSections{10}{subsection}% % Resume all counters -\ResumeSuspendedCounters +\ResumeAllSuspendedCounters \QuickSections{20}{subsection}% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf Binary files differnew file mode 100644 index 00000000000..8ab5eac4d3d --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex new file mode 100644 index 00000000000..d84116837d4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex @@ -0,0 +1,94 @@ +%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% Example file for suspended counters file for xassoccnt.sty +%% +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2016 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de> +%% ------------------------------------------------------------------------------------------- +%% +%% 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` +%% +%% + +\documentclass{book} + +\usepackage{xassoccnt} +\usepackage{blindtext} + + +\setcounter{secnumdepth}{4} +\begin{document} +\tableofcontents +\listoffigures +\listoftables + + +\CascadeSuspendCounters{chapter} +\chapter{The first chapter} +\section{Foo} + + +\begin{figure} + +\caption{A foo figure} +\end{figure} + +\begin{table} +\caption{A foo table} +\end{table} + + + +\subsection{My First subsection} +\blindtext +\section{Foobar} +\subsection{Foobar subsection} +\blindtext +\subsubsection{Foobar Again} +\blindtext + + +\ResumeAllSuspendedCounters + +\chapter{Another chapter} + + +\begin{figure} +\caption{Another figure} +\end{figure} + + + +\SuspendCounters{chapter,section} + +\chapter{Yet another chapter} + +\section{Foo section in yet another chapter} + +\begin{figure} +\caption{Another figure} +\end{figure} + + + +\end{document} + + +\subsubsection{Foobar Again} +\blindtext + +\subsection{Foobar subsection} +\blindtext + +\subsubsection{Foobar Again} +\blindtext + diff --git a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty index dae0afc37ab..38410d2c686 100644 --- a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty +++ b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.7 (2016/05/10 -- 00/41/54) +%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) %% Source file for xassoccnt.sty %% %% @@ -19,10 +19,10 @@ %% %% -\def\xassoccntpackageversion{0.7} -\NeedsTeXFormat{LaTeX2e} +\def\xassoccntpackageversion{0.8} +\NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{xassoccnt}[2016/05/10 - v\xassoccntpackageversion] +\ProvidesPackage{xassoccnt}[2016/06/10 - v\xassoccntpackageversion] \RequirePackage{xcolor} \RequirePackage{xparse} @@ -52,6 +52,8 @@ \bool_new:N \l__xassoccnt_autodefine_allcounters \bool_new:N \l__xassoccnt_autodefine_associatedcounter +\bool_new:N \l__xassoccnt_cascade_suspension_bool + \bool_new:N \l__xassoccnt_countertype_general \bool_new:N \l__xassoccnt_countertype_driver \bool_new:N \l__xassoccnt_countertype_associated @@ -127,6 +129,7 @@ \clist_set:Nn \l__xassoccnt_onlycounters_clist {#1} }, exclude .clist_set:N=\l__xassoccnt_exclude_clist, + cascade .bool_set:N={\l__xassoccnt_cascade_suspension_bool}, %% For later purposes countertype .choice:, @@ -251,6 +254,10 @@ \endgroup } +\cs_new:Nn \xassoccnt_report_resetlist:n {% + \__xassoccnt_getresetlist:n {#1} + \seq_show:N \l__xassoccnt_counterreset_seq% +} \cs_set_eq:NN \xassoccnt_standardstepcounter \stepcounter @@ -277,6 +284,7 @@ }{} \AtEndOfPackage{ + \PackageInfo{xassoccnt}{2016/06/10 - 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 @@ -334,6 +342,7 @@ \cs_new_nopar:Nn \__xassoccnt_container_removeduplicates:n { \seq_gremove_duplicates:c{\__xassoccnt_generate_countercontainername:n{#1}}} \cs_new_nopar:Nn \__xassoccnt_container_removecounter:nn { \seq_gremove_all:cn{\__xassoccnt_generate_countercontainername:n{#1}}{#2} } \cs_new_nopar:Nn \__xassoccnt_container_putright:nn { \seq_put_right:cn{\__xassoccnt_generate_countercontainername:n{#1}}{#2} } +\cs_new_nopar:Nn \__xassoccnt_container_gputright:nn { \seq_gput_right:cn{\__xassoccnt_generate_countercontainername:n{#1}}{#2} } \cs_new_nopar:Nn \__xassoccnt_container_removeassociated:nn { \seq_gremove_all:cn{\__xassoccnt_drivercontainer:n{#1}}{#2}} \cs_new_nopar:Nn \__xassoccnt_container_gclear:n {\seq_gclear:N #1 } \cs_new_nopar:Nn \__xassoccnt_container_clear:n {\seq_clear:N #1 } @@ -540,9 +549,9 @@ } } -\cs_generate_variant:Nn \__xassoccnt_container_if_in:NnTF { cnTF } -\cs_generate_variant:Nn \__xassoccnt_container_if_in:NnT { cnT } -\cs_generate_variant:Nn \__xassoccnt_container_if_in:NnF { cnF } +\cs_generate_variant:Nn \__xassoccnt_container_if_in:NnTF { nxTF, cnTF,cxTF } +\cs_generate_variant:Nn \__xassoccnt_container_if_in:NnT { nxT,cnT,cxT } +\cs_generate_variant:Nn \__xassoccnt_container_if_in:NnF { nxF,cnF,cxF } \prg_new_conditional:Nnn \xassoccnt_is_associatedcounter:n {T,F,TF} { @@ -555,7 +564,7 @@ \prg_new_conditional:Nnn \xassoccnt_is_suspendedcounter:n {TF,T,F} {% - \__xassoccnt_container_if_in:cnTF{\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_suspendedname_str}}{#1}{% + \__xassoccnt_container_if_in:cxTF{\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_suspendedname_str}}{#1}{% \prg_return_true: }{% \prg_return_false: @@ -602,14 +611,65 @@ \NewDocumentCommand{\SuspendCounters}{O{}m}{% \keys_set:nn { xassoccnt }{#1}% - \__xassoccnt_container_putright:nn{\c_xassoccnt_suspendedname_str}{#2} + \clist_set:Nx \l_tmpa_clist {#2}% + \clist_map_inline:Nn \l_tmpa_clist { + \__xassoccnt_container_gputright:nn{\c_xassoccnt_suspendedname_str}{##1} + } + % Code for removal of duplicates + \__xassoccnt_container_removeduplicates:n{\c_xassoccnt_suspendedname_str} +} + +\cs_new_protected:Nn \xassoccnt_cascade_suspendcounters:nn {% + \keys_set:nn { xassoccnt }{#1}% + \clist_set:Nx \l_tmpa_clist {#2}% + % Loop through the several counters! + \clist_map_inline:Nn \l_tmpa_clist {% + % Cascading requires knowledge of the counter reset list, so get this! + \xassoccnt_countersinresetlist:n {##1} + \int_compare:nNnT {\l_xassoccnt_resetlist_counter} > {0} {% + \__xassoccnt_getresetlist:n {##1}% + \seq_map_inline:Nn \l__xassoccnt_counterreset_seq {% + \__xassoccnt_container_gputright:nn{\c_xassoccnt_suspendedname_str}{####1} + % Recursively suspend all other counters that are on the reset list of #2 and hunt down their reset lists as well. + \xassoccnt_cascade_suspendcounters:nn{#1}{####1}% + }% + }% End \int_compare: + % Now add ##1 + \__xassoccnt_container_gputright:nn{\c_xassoccnt_suspendedname_str}{##1} + }% End \clist_map_inline: + % Remove duplicates + \__xassoccnt_container_removeduplicates:n{\c_xassoccnt_suspendedname_str} + \bool_set_false:N \l__xassoccnt_cascade_suspension_bool } + +\NewDocumentCommand{\CascadeSuspendCounters}{O{}m}{% + \xassoccnt_cascade_suspendcounters:nn {#1}{#2}% +} + +\NewDocumentCommand{\ShowSuspendedCounters}{}{% + \seq_use:cn { \__xassoccnt_generate_countercontainername:n{\c_xassoccnt_suspendedname_str}} {\par} +} + \NewDocumentCommand{\ResumeSuspendedCounters}{O{}m}{% - \__xassoccnt_container_removecounter:nn{\c_xassoccnt_suspendedname_str}{#2}% + \clist_set:Nx \l_tmpa_clist {#2}% + \clist_map_inline:Nn \l_tmpa_clist { + \__xassoccnt_container_removecounter:nn{\c_xassoccnt_suspendedname_str}{##1}% + } } +\NewDocumentCommand{\ResumeAllSuspendedCounters}{O{}}{% + \seq_if_exist:cTF{\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_suspendedname_str}} {% + \seq_gclear:c {\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_suspendedname_str}}% + }{% + % A warning message later on here! + \typeout{Container\space\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_suspendedname_str}\space does\space not\space exist}% + }% +} + + +%%%% Associated counters section \NewDocumentCommand{\DeclareAssociatedCounters}{omm}{% \IfValueTF{#1}{% @@ -759,11 +819,10 @@ \cs_new:Nn \__xassoccnt_step_associatedcounters:n {% \seq_if_exist:cT { \__xassoccnt_drivercontainer:n{#1} } { \seq_map_inline:cn {\__xassoccnt_drivercontainer:n{#1} } - { -% \typeout{Stepping~the~associated~counter(#1):##1}% + {% \xassoccnt_addtocounter{##1}{\c_one} - } - } + }% + }% % End of \seq_if_exist } @@ -1412,12 +1471,16 @@ } + \RenewDocumentCommand{\refstepcounter}{m}{% - \cs_gset_nopar:Nn \__xassoccnt_lastrefsteppedcounter: {#1} - \xassoccnt_standardrefstepcounter{#1}% - \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{#1}}% + \seq_if_in:NxF \g_xassoccnt_suspendedcnt_seq {#1} {% + \cs_gset_nopar:Nn \__xassoccnt_lastrefsteppedcounter: {#1} + \xassoccnt_standardrefstepcounter{#1}% + \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{#1}}% + } } + %%%% Now some expandable wrapper macros for information on the last counter changed \newcommand{\LastSteppedCounter}{% @@ -1596,7 +1659,6 @@ % \seq_use:Nn \g__xassoccnt_totalcounter_container {\par}% \tl_set:Nx \l_tmpa_tl {\__xassoccnt_expand_totalcountername:n{#1}} \tl_set:Nx \l_tmpb_tl {#1}% - \typeout{Foo} \seq_if_in:NnTF \g__xassoccnt_supertotalcounter_container {\l_tmpb_tl }{% \tl_set:Nx \l_tmpa_tl {\__xassoccnt_expand_totalcountername:n{#1}} }{% @@ -1607,11 +1669,6 @@ \number\value{\tl_use:N \l_tmpa_tl}% } -\newcommand{\TotalValueOld}[1]{% - %\tl_set:Nx \l_tmpa_tl {\__xassoccnt_expand_totalcountername:n{#1}} - %\tl_set:Nx \l_tmpb_tl {#1}% - \number\value{\__xassoccnt_expand_totalcountername:n{#1}}% -} \cs_new:Nn \__xassoccnt_writetotalcounters:nn {% @@ -1770,7 +1827,6 @@ \msg_error:nnn{xassoccnt}{nameisnocounter}{##1}% }% }% -% \seq_use:Nn \l__xassoccnt_countervaluesbackup_seq {\par} } @@ -1930,6 +1986,17 @@ %%%%%%%%%%%%%%%%%%%% +%% Reporting Macros + +\NewDocumentCommand{\ShowResetList}{m}{% + \xassoccnt_report_resetlist:n{#1}% +} + +\NewDocumentCommand{\DisplayResetList}{O{,}m}{% + \__xassoccnt_getresetlist:n {#2} + \seq_use:Nn \l__xassoccnt_counterreset_seq {#1} +} + %%%%%%%%%%%%%%%%%%%% @@ -1984,6 +2051,9 @@ \newcommand{\TotalCounterInfoColor}{violet} + + + \AddFeature[sublists=true]{coupledcounters} % New style, not fully implemented so far |