diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-19 21:37:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-19 21:37:34 +0000 |
commit | f72d4261f1d88b9543cdae61918a314cc69118e4 (patch) | |
tree | 627a884ae934f486642b45f8774edd2f5ad7106f | |
parent | 36713e69240f37f23c19a3c6263eacadfe848fd7 (diff) |
xassoccnt (19jun16)
git-svn-id: svn://tug.org/texlive/trunk@41500 c570f23f-e606-0410-a88d-b1316a301751
16 files changed, 650 insertions, 124 deletions
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/README b/Master/texmf-dist/doc/latex/xassoccnt/README index 02e0db32150..eebc964da38 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.8 (2016/06/10 -- 23/28/27) +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) %% 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/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 +As of 2016/06/19 xassoccnt does not supersede the package assoccnt by the same author, however, +the older package isn't declared obsolete as of 2016/06/19 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 011e364122c..eca5594bc28 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 e4551a286c2..4f1417e5c1f 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) %% 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 572082f925f..6f13d5f9c54 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 f67c6ecab59..fbe9a1f4777 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) %% Documentation file for xassoccnt.sty %% %% @@ -29,6 +29,7 @@ \usepackage{bbding} \savesymbol{Cross} +\usepackage{graphicx} \usepackage{blindtext} \usepackage[x11names]{xcolor} \usepackage{imakeidx} @@ -74,6 +75,11 @@ } +\@namedef{xassoccntversion0.1}{v0.1 2016-11-07} + +\@namedef{xassoccntversion0.2}{v0.2 2016-11-14} + +\@namedef{xassoccntversion0.3}{v0.3 2016-01-08} \@namedef{xassoccntversion0.4}{v0.4 2016-01-26} @@ -83,7 +89,9 @@ \@namedef{xassoccntversion0.7}{v0.7 2016-05-10} -\@namedef{xassoccntversion0.8}{v0.8 2016-05-16} +\@namedef{xassoccntversion0.8}{v0.8 2016-06-10} + +\@namedef{xassoccntversion0.9}{v0.9 2016-06-18} \makeatother @@ -249,11 +257,54 @@ \item \CHDocKey*{foo} deals with a command or package option named \texttt{foo} \end{itemize} } + + + +\renewcommand{\tcbdocnew}[1]{#1}% +\renewcommand{\tcbdocupdated}[1]{#1}% + +\newcommand{\CHDocNew}[1]{% + \tcbdocmarginnote[doclang/new={N}, + colframe=blue, + halign=left, + colback={blue!20!white}, + fontupper={\tiny} + ]{% + \chdocextractversion{xassoccntversion#1}% + }% +} + + + +\newcommand{\CHDocUpdate}[1]{\tcbdocmarginnote[doclang/updated={},colback={yellow},colframe={yellow!50!red}, fontupper={\tiny} +]{% + \tcbdocupdated{\chdocextractversion{xassoccntversion#1}}% +}% +} + + + +\newcommand{\CHDocFullVersion}[1]{Version \chdocextractversion{xassoccntversion#1}} + + +\newcommand{\CHDocExpCommand}[1][Expandable]{% + \tcbdocmarginnote[doclang/new={N}, + colframe=green!50!blue, + halign=left, + colback={green!90!blue}, + fontupper={\tiny} + ]{% + #1% + }% +} + +\usepackage{graphicx}% \usepackage[autodefinecounters=true]{xassoccnt} \usepackage{amsmath} \usepackage{amssymb} \usepackage{bookmark} \usepackage{cleveref} +\usetikzlibrary{mindmap} \newcommand{\PackageDocName}{xassoccnt}% @@ -307,21 +358,35 @@ pdfcreator={LaTeX} } -\newcommand{\versionzerofourdate}{v0.4 2016-01-26} -\newcommand{\versionzerofivedate}{v0.5 2016-02-27} -\newcommand{\versionzerosixdate}{v0.6 2016-03-05} -\newcommand{\versionzerosevendate}{v0.7 2016-05-10} -\newcommand{\currentversiondate}{2016-06-10} -\newcommand{\versionzeroeightdate}{v0.8 \currentversiondate} + \begin{document} \mmddyyyydate -\setlength{\parindent}{0pt} +\setlength{\parindent}{0em} + +\pagestyle{empty}% + +\begin{tikzpicture}[mindmap,concept color=red,black,scale=1] +\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=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}} +} + child[grow=-20,white] { node [concept] {Periodically resetting counters}} + child[grow=130,concept color=red!20!green] { node [concept] {Suspension \\ \& Resuming of counters} child[grow=160,concept color=green!10!yellow] {node[concept] {Cascaded suspension}}} + 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}}}; +\end{tikzpicture} -\thispagestyle{empty}% \CHPackageTitlePage[packageauthor={Christian Hupfer}]{Associated counters stepping simultaneously} + + \clearpage \tableofcontents \clearpage @@ -330,8 +395,6 @@ \clearpage - - \pagestyle{plain} @@ -422,8 +485,7 @@ For potential problems see \cref{subsection:incompatibilities} \begin{marker} -%\tcbdocmarginnote{\tcbdocupdated{\versionzerosevendate}} -\tcbdocmarginnote{\tcbdocupdated{\chdocextractversion{xassoccntversion0.7}}} +\CHDocUpdate{0.7} Of course any package other that loads \CHDocPackage{calc} must be loaded before \PackageDocName, i.e. \CHDocPackage{mathtools}. \end{marker} @@ -451,7 +513,7 @@ As of version \packageversion\ \CHDocPackage{\PackageDocName} supports the packa \end{itemize} \end{docKey} -\begin{docKey}{nonumberofruns}{}{initially not set}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docKey}{nonumberofruns}{}{initially not set}\CHDocNew{0.6} Using this package option the super total counter \CHDocCounter{numberofruns} counter will not be defined. See \cref{subsection:numberofruns} about this feature. \end{docKey} @@ -527,7 +589,7 @@ This document has \number\totvalue{totalpages} (note: \number\totvalue{anotherto \begin{itemize} \item No checking whether the 2nd and 3rd arguments hold counter names is applied. \item Mutually cross - association of two counters is not supported! The compilation will stop on this! - \tcbdocmarginnote{\tcbdocupdated{\versionzerosixdate}} + \CHDocUpdate{0.6} A driver counter, say, \CHDocCounter{foo}) of, say \CHDocCounter{foobar} can not be an associated counter of \CHDocCounter{foobar}, which in turn can be a driver counter of other counters, of course. @@ -861,7 +923,7 @@ 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}}} +\begin{docCommand}{DisplayResetList}{\oarg{separator={,}}\marg{resetting counter}}\CHDocNew{0.8} This command displays the reset list of a counter as a separated list. If the counter has no resetting list, nothing is shown. @@ -879,8 +941,7 @@ This command displays the reset list of a counter as a separated list. If the co \end{docCommand} -\begin{docCommand}{ShowResetList}{\marg{resetting counter}}\tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} - +\begin{docCommand}{ShowResetList}{\marg{resetting counter}}\CHDocNew{0.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} @@ -994,7 +1055,7 @@ Please note, that all of this commands are only working in the current run of co 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}}} +\CHDocNew{0.8} \begin{marker} Suspension and resuming counters can cause wrong hyper links if \CHDocPackage{hyperref} is used. \end{marker} @@ -1014,7 +1075,7 @@ Rather than removing an associated counter from the list, it is possible to susp \end{docCommandArgs} \end{docCommand}% -\begin{docCommand}{CascadeSuspendCounters}{\oarg{options}\marg{counters list}}\tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xassoccntversion0.8}}} +\begin{docCommand}{CascadeSuspendCounters}{\oarg{options}\marg{counters list}}\CHDocNew{0.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. @@ -1043,7 +1104,7 @@ This macro is more powerful than \refCom{SuspendCounters}, since it tries to det 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}}} +\begin{docCommand}{ResumeAllSuspendedCounters}{\oarg{options}} \CHDocNew{0.8} As of version \packageversion\ the optional argument is not used and reserved for later purposes. This command revokes all suspended counters. \end{docCommand} @@ -1086,7 +1147,23 @@ There are \number\totvalue{totalequations}~equations in here! -\section{Additions to standard commands}\label{section::additions_to_l2e} +\section[Additions and extensions to standard commands]{Additions and extensions to standard counter related commands}\label{section::additions_to_l2e} + +\subsection{Extension of \LaTeXe\ commands}\label{subsection::extension_of_l2e_commands} + +\begin{docCommand}[before={\CHDocNew{0.9}}]{addtocounter}{\marg{counter}\marg{increment value}\oarg{options}} + The \refCom{addtocounter} macro behaves like the usual \cs{addtocounter} counter, but takes care to specific counter features such as \CHDocTag{periodic counters} and has an optional argument in order to perform special settings. + +As of \packageversion, there is only one option used: +\begin{docKey}[][after={\CHDocNew{0.9}}]{wrap}{=\meta{true/false}}{initially true} + + This key determines whether addition of values to a periodic counter (see \nameref{section:periodic_counters}) will lead to a modulo part addition. +\end{docKey} + +\end{docCommand} + + +\subsection{Additions to \LaTeXe\ commands} \begin{docCommand}{NewDocumentCounter}{\oarg{options}\marg{counter}\oarg{resetting counter}} This command is a new interface to \cs{newcounter} and behaves effectively the same. %The first optional argument is reserved for later purposes but not used as of version \packageversion. @@ -1141,7 +1218,7 @@ Some notes on \refCom{SetDocumentCounter} \end{itemize} \end{docCommand}% -\begin{docCommand}{StepDownCounter}{\oarg{options}\marg{counter}}\tcbdocmarginnote{\tcbdocnew{\versionzerofourdate}} +\begin{docCommand}{StepDownCounter}{\oarg{options}\marg{counter}}\CHDocNew{0.4} This macro subtracts the value of 1 from the counter and is the counterpart of \cs{stepcounter}. @@ -1158,7 +1235,7 @@ This macro subtracts the value of 1 from the counter and is the counterpart of \ \end{docCommand}% -\begin{docCommand}{SubtractFromCounter}{\oarg{options}\marg{counter}\marg{delta value}}\tcbdocmarginnote{\tcbdocnew{\versionzerofourdate}} +\begin{docCommand}{SubtractFromCounter}{\oarg{options}\marg{counter}\marg{delta value}}\CHDocNew{0.4} This macro subtracts the (positive) delta value from the counter and is the counterpart of \cs{addtocounter} @@ -1264,7 +1341,7 @@ This document synchronizes the driver counter value to the associated values. It \end{itemize} \end{dispExample} -\section[Loops on multiple counter]{Performing the same action for many counters} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\section[Loops on multiple counter]{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. @@ -1279,7 +1356,7 @@ All macros concerning this feature use the first macro argument having a comma-s \end{marker} -\begin{docCommand}{LoopAddtoCounters}{\marg{counter1, counter2,\dots}\marg{counter increment/decrement}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{LoopAddtoCounters}{\marg{counter1, counter2,\dots}\marg{counter increment/decrement}} \CHDocNew{0.7} \begin{docCommandArgs}{LoopAddToCounters}% The 2nd argument value is added (or subtracted) to the counters given in the list of the 1st argument using the \cs{addtocounter}. @@ -1297,7 +1374,7 @@ The 2nd argument value is added (or subtracted) to the counters given in the lis \end{docCommand} -\begin{docCommand}{LoopResetCounters}{\marg{counter1, counter2,\dots}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{LoopResetCounters}{\marg{counter1, counter2,\dots}} \CHDocNew{0.7} \begin{docCommandArgs}{LoopResetCounters}% @@ -1313,7 +1390,7 @@ All counters given in the first argument are set to zero using the regular \cs{s \end{docCommand} -\begin{docCommand}{LoopRefstepCounters}{\marg{counter1, counter2,\dots}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{LoopRefstepCounters}{\marg{counter1, counter2,\dots}} \CHDocNew{0.7} \begin{docCommandArgs}{LoopStepCounters}% All counters given in the first argument are stepped using the regular \cs{refstepcounter} to allow labels -- however, only the last counter will have the correct label reference. @@ -1332,7 +1409,7 @@ All counters given in the first argument are stepped using the regular \cs{refst -\begin{docCommand}{LoopSetCounters}{\marg{counter1, counter2,\dots}\marg{new counter value}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{LoopSetCounters}{\marg{counter1, counter2,\dots}\marg{new counter value}} \CHDocNew{0.7} \begin{docCommandArgs}{LoopAddToCounters}% The 2nd argument value is used as new counter value added (or subtracted) to the counters given in the list of the 1st argument using the \cs{addtocounter}. @@ -1350,7 +1427,7 @@ The 2nd argument value is used as new counter value added (or subtracted) to th \end{docCommand} -\begin{docCommand}{LoopStepCounters}{\marg{counter1, counter2,\dots}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{LoopStepCounters}{\marg{counter1, counter2,\dots}} \CHDocNew{0.7} \begin{docCommandArgs}{LoopStepCounters}% All counters given in the first argument are stepped using the regular \cs{stepcounter}. @@ -1366,7 +1443,7 @@ All counters given in the first argument are stepped using the regular \cs{stepc A more general command for doing "arbitrary" operations with counters (and more setup, for example) is -\begin{docCommand}{LoopCountersFunction}{\marg{counter1, counter2,\dots}\marg{counter operation macro}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{LoopCountersFunction}{\marg{counter1, counter2,\dots}\marg{counter operation macro}} \CHDocNew{0.7} \begin{docCommandArgs}{LoopAddToCounters}% The 2nd argument value should hold a macro with any number of arguments, but the last mandatory argument of this macro is reserved for counter name. @@ -1393,7 +1470,7 @@ The 2nd argument value should hold a macro with any number of arguments, but the -\section{Coupled counters}\label{sec::coupledcounters}\tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\section{Coupled counters}\label{sec::coupledcounters}\CHDocNew{0.5} \begin{marker} The features described here are very experimental and not fully implemented so far. @@ -1405,11 +1482,11 @@ This can be achieved with the concept of coupled counters. As usual, those count \subsection[Common options for coupled counters]{Common options for most of the coupled counter macros}\label{subsection:options_coupledcounters} -\begin{docKey}{name}{=\meta{name of a list}}{}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docKey}{name}{=\meta{name of a list}}{}\CHDocNew{0.6} This option has the name of the counter group that should be coupled, say ``figuretablegroup'' etc. \end{docKey} -\begin{docKey}{multiple}{=\meta{true,false}}{initially false}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docKey}{multiple}{=\meta{true,false}}{initially false}\CHDocNew{0.6} This option allows to add a counter multiple times to a counter group. In general, using this style is not recommended. \end{docKey} @@ -1417,7 +1494,7 @@ This can be achieved with the concept of coupled counters. As usual, those count -\begin{docCommand}{DeclareCoupledCounters}{\oarg{options}\marg{counter name1, counter name2, \dots}}\tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{DeclareCoupledCounters}{\oarg{options}\marg{counter name1, counter name2, \dots}}\CHDocNew{0.5} \begin{codeoptionsenum} \item \oarg{options}: See \cref{subsection:options_coupledcounters} for a explanation about available options. \item \marg{counter name 1, counter name2, \dots}: The list of counters that should should be stepped together for the given counter group. @@ -1427,7 +1504,7 @@ This macro is a preamble-only command. \end{docCommand} -\begin{docCommand}{DeclareCoupledCountersGroup}{\marg{counter group name}}\tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{DeclareCoupledCountersGroup}{\marg{counter group name}}\CHDocNew{0.5} This macro defines a name for a counter group and allocates a new group list for the counter names. If the name already exists, nothing is done. \begin{codeoptionsenum} \item \marg{counter group name}: The name of the counter group. @@ -1437,7 +1514,7 @@ This macro is a preamble-only command and does not add counters to the group con \end{docCommand} -\begin{docCommand}{RemoveCoupledCounters}{\oarg{options}\marg{counter name1, counter name2, \dots}}\tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{RemoveCoupledCounters}{\oarg{options}\marg{counter name1, counter name2, \dots}}\CHDocNew{0.5} This removes the comma separated counter names from the coupled counter list given in the \refKey{name} option. \begin{codeoptionsenum} @@ -1456,8 +1533,8 @@ If all counters from a group name should be removed, this is equal to clearing - \end{docCommand} -\begin{docCommand}{AddCoupledCounters}{\oarg{options}\marg{counter name1, counter name2, \dots}}\tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} -\tcbdocmarginnote{\tcbdocupdated{\versionzerosixdate}} +\begin{docCommand}{AddCoupledCounters}{\oarg{options}\marg{counter name1, counter name2, \dots}}\CHDocNew{0.5} +\CHDocUpdate{0.6} This adds the listed counter names to coupled counter list. It acts like \refCom{DeclareCoupledCounters}, but does not setup new counter groups. Please use \refCom{DeclareCoupledCounters} first, then apply \cs{AddCoupledCounters} later on. @@ -1472,7 +1549,7 @@ This adds the listed counter names to coupled counter list. It acts like \refCom \end{docCommand} -\begin{docCommand}{ClearCoupledCounters}{\marg{options}}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docCommand}{ClearCoupledCounters}{\marg{options}}\CHDocNew{0.6} This removes all names from the given name of a group of coupled counters. \begin{codeoptionsenum} \item \oarg{options}: As of version \packageversion{} the only recognized option is \refKey{name}. @@ -1490,23 +1567,108 @@ In order to clear all coupled counter lists, use \refCom{ClearAllCoupledCounters \end{docCommand} -\begin{docCommand}{ClearAllCoupledCounters}{}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docCommand}{ClearAllCoupledCounters}{}\CHDocNew{0.6} This removes all coupled counter groups, but not the group names, i.e. the list names can be used later on to add counter names again. In order to clear a specific list, use \refCom{ClearCoupledCounters}. \end{docCommand} -\begin{docCommand}{IsCoupledCounterTF}{\marg{counter name}\marg{true branch}\marg{false branch}}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docCommand}{IsCoupledCounterTF}{\marg{counter name}\marg{true branch}\marg{false branch}}\CHDocNew{0.6} This macro tests if a counter is under the administration of the coupled counter commands and expands to the relevant branch then. There are two short-circuit commands \refCom{IsCoupledCounterT} and \refCom{IsCoupledCounterF}. \end{docCommand} -\begin{docCommand}{IsCoupledCounterT}{\marg{counter name}\marg{true branch}}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docCommand}{IsCoupledCounterT}{\marg{counter name}\marg{true branch}}\CHDocNew{0.6} This macro tests if a counter is under the administration of the coupled counter commands and executes the true branch then. There are two related commands \refCom{IsCoupledCounterTF} and \refCom{IsCoupledCounterF}. \end{docCommand} -\begin{docCommand}{IsCoupledCounterF}{\marg{counter name}\marg{false branch}}\tcbdocmarginnote{\tcbdocnew{\versionzerosixdate}} +\begin{docCommand}{IsCoupledCounterF}{\marg{counter name}\marg{false branch}}\CHDocNew{0.6} This macro tests if a counter is under the administration of the coupled counter commands and executes the false branch then if this is not the case. There are two related commands \refCom{IsCoupledCounterTF} and \refCom{IsCoupledCounterT}. \end{docCommand} +\clearpage +\section{Periodic counters}\label{section:periodic_counters}\CHDocNew{0.9} + + +It might be very convenient to have counters that are automatically reset not only by a driving counter such as \CHDocCounter*{chapter} but also periodically, i.e. after a certain amount of steps -- this can be achieved with the concept of periodic counters. + +\subsection{Commands related to periodic counters setup} + +\begin{docCommand}[before={\CHDocNew{0.9}}]{DeclarePeriodicCounter}{\oarg{}\marg{counter name}\marg{counter treshold value}} +This defines the counter given in the first mandatory argument as a periodic counter and is automatically reset if the treshold value is reached. + +\begin{marker} +The command \refCom{DeclarePeriodicCounter} does not define a new counter, however but is the preamble-only version of \refCom{AddPeriodicCounter}. +\end{marker} + +Please note that in case of \cs{addtocounter} applied to a periodic counter the value to be added leads to a modulo division such that the counter might be reset if the addition would increase the counter beyond the treshold value, the module part will be added then. In order to prevent this wrapping, use the \refKey{wrap} option to \refCom{addtocounter}: + +\begin{dispExample} + \setcounter{foocntr}{3}% + \AddPeriodicCounter{foocntr}{8}% + + Value of foocntr is: \thefoocntr % Should be 3 + + \addtocounter{foocntr}{20} % Is it 23? No, it is 23 % 8 = 7 + Value of foocntr is \thefoocntr\ now! + + Adding a value of 4 again: + \addtocounter{foocntr}{4} % Is it 11? No, it is 11 % 8 = 3 + Value of foocntr is \thefoocntr\ now! + + Now prevent the wrapping + \addtocounter{foocntr}{10}[wrap=false] % Is it 13? Yes, it is! + Value of foocntr is \thefoocntr\ now! + +\end{dispExample} +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{0.9}}]{AddPeriodicCounter}{\oarg{}\marg{counter name}\marg{counter treshold value}} +This defines the counter given in the first mandatory argument as a periodic counter and is automatically reset if the treshold value is reached. +\end{docCommand} + + +\begin{docCommand}[before={\CHDocNew{0.9}}]{RemovePeriodicCounter}{\oarg{options}\marg{counter name}\marg{counter treshold value}} +This defines the counter given in the first mandatory argument as a periodic counter and is automatically reset if the treshold value is reached. + +\begin{codeoptionsenum} +\item \oarg{options} + + As of version \packageversion, there is only one option: + \begin{docKey}[][before={\CHDocNew{0.9}}]{reset}{=\meta{true/false}}{initially true} + Use `false` to prevent the resetting of the relevant counter after removal! + \end{docKey} + \item \marg{counter name} -- the name of the counter that should be no periodic counter any longer. +\end{codeoptionsenum} + +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{0.9}}]{ChangePeriodicCounterCondition}{\oarg{options}\marg{counter name}\marg{new counter treshold value}} +This changes the counter treshold condition -- the counter is reset automatically if not specified otherwise with the \refKey{reset} option. + +\begin{codeoptionsenum} +\item \oarg{options} + + As of version \packageversion, there is only one option: \refKey{reset}, which serves the same functionality as in \refCom{RemovePeriodicCounter}. +\item \marg{counter name} -- the name of the counter that should be no periodic counter any longer. +\item \marg{new counter value treshold} -- the new value after which an automatic resetting will occur. + +\end{codeoptionsenum} + +\end{docCommand} + +\subsection{Commands to query for periodic counter feature} + + +\begin{docCommand}[after={\CHDocNew{0.9}\par}]{IsPeriodicCounterTF}{\marg{counter name}\marg{true branch}\marg{false branch}} +This macro tests if a counter is under the administration of the periodic counter commands and expands to the relevant branch then. There are two short-circuit commands: \refCom{IsPeriodicCounterT} and \refCom{IsPeriodicCounterF}. +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{0.9}}]{IsPeriodicCounterT}{\marg{counter name}\marg{true branch}} +This macro tests if a counter is under the administration of the periodic counter commands and expands to the \meta{true} branch then. There are two related commands: \refCom{IsPeriodicCounterTF} and \refCom{IsPeriodicCounterF}. +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{0.9}}]{IsPeriodicCounterF}{\marg{counter name}\marg{false branch}} +This macro tests if a counter is under the administration of the periodic counter commands and expands to the \meta{false} branch then if this is not the case. There are two related commands: \refCom{IsPeriodicCounterTF} and \refCom{IsPeriodicCounterT}. +\end{docCommand} \section{Total counters}\tcbdocmarginnote{\tcbdocnew{2015-11-27}} @@ -1521,7 +1683,7 @@ The declaration of a total counter is a preamble - only event and \refCom{NewTot \end{marker} -\begin{docCommand}{RegisterTotalDocumentCounter}{\oarg{options}\marg{total counter name}}\tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{RegisterTotalDocumentCounter}{\oarg{options}\marg{total counter name}}\CHDocNew{0.5} \begin{codeoptionsenum} \item \oarg{options}: As of version \packageversion, only this option is used \begin{docKey}{supertotal}{=\meta{true,false}}{false} @@ -1548,7 +1710,8 @@ This command reports the internal name of a total counter or the usual name if t \stepcounter{foototal} -\begin{docCommand}{TotalValue}{\marg{counter name}} + +\begin{docCommand}[before={\CHDocExpCommand}]{TotalValue}{\marg{counter name}}\CHDocUpdate{0.9}% This command prints the value of a total counter or falls back to the value of the counter if this is not a total counter. \begin{dispExample} @@ -1639,7 +1802,7 @@ This macro checks if a counter is under the administration of the super total co 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. -\section[Counter backup/restoration]{Backup and restore of counter values}\tcbdocmarginnote{\tcbdocnew{\versionzerofourdate}} +\section[Counter backup/restoration]{Backup and restore of counter values}\CHDocNew{0.4} 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. @@ -1650,7 +1813,7 @@ It might be necessary to interrupt the current sectioning, e.g. including anothe \begin{itemize} \item All counters in the list will be reset to zero (after storing the values) for the next usage, unless the \refKey{resetbackup} key is set to \meta{false}. - \item Multiple specification of the same counter name is possible, but only the first occurence will be regarded -- consecutive occurences of the same counter name are not taken into account. \tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} + \item Multiple specification of the same counter name is possible, but only the first occurence will be regarded -- consecutive occurences of the same counter name are not taken into account. \CHDocNew{0.5} \end{itemize} \begin{docKey}[][]{resetbackup}{=\meta{true/false}}{initially true} @@ -1662,7 +1825,7 @@ Please note: If a name does not belong to a counter register the compilation abo Some remarks \begin{marker} -If a specific counter name is suffixed with an \textasteriskcentered\ at its end the resetting is disabled for this particular counter, regardless whether \refKey{resetbackup} is set to true or not.\tcbdocmarginnote{\tcbdocnew{\versionzerofourdate}} +If a specific counter name is suffixed with an \textasteriskcentered\ at its end the resetting is disabled for this particular counter, regardless whether \refKey{resetbackup} is set to true or not.\CHDocNew{0.4} \end{marker} \begin{marker} @@ -1671,7 +1834,7 @@ If a specific counter name is suffixed with an \textasteriskcentered\ at its end \end{docCommand}% -\begin{docCommand}{RestoreAllCounterValues}{\oarg{options}} \tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{RestoreAllCounterValues}{\oarg{options}} \CHDocNew{0.5} This macro restores all stored counter values corresponding to the counter names. As of version \packageversion\ the optional argument isn't used and reserved for later purposes. @@ -1686,7 +1849,7 @@ counters, not all in a row. -\begin{docCommand}{RestoreCounterValues}{\oarg{options}\marg{counter name1,counter name2,...}} \tcbdocmarginnote{\tcbdocupdated{\versionzerofivedate}} +\begin{docCommand}{RestoreCounterValues}{\oarg{options}\marg{counter name1,counter name2,...}} \CHDocUpdate{0.5} This macro restores only the stored counter values given by the counter names. As of version \packageversion\ the optional argument isn't used and reserved for later purposes. @@ -1722,13 +1885,13 @@ Restored the values: \thefigure\ and \thetable \end{dispExample} -\begin{docCommand}{AddBackupCounter}{\oarg{options}\marg{counter name1,counter name2,...}} \tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{AddBackupCounter}{\oarg{options}\marg{counter name1,counter name2,...}} \CHDocNew{0.5} This is similar to \refCom{BackupCounterValues}, but adds the counter names to an existing global list and can be applied after \refCom{BackupCounterValues}. \end{docCommand} -\begin{docCommand}{RemoveBackupCounters}{\oarg{options}\marg{counter name1, counter name2,...}} \tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{RemoveBackupCounters}{\oarg{options}\marg{counter name1, counter name2,...}} \CHDocNew{0.5} This macro removes the counters from the list of backup counters and immediately restores the counter value unless the starred version \refCom{RemoveBackupCounters*} is used. If the package \CHDocPackage{hyperref} is used, the macro \cs{theH...} (see \nameref{subsec::backup_and_hyperref} on this) is restored to the original meaning. @@ -1738,7 +1901,7 @@ As of version \packageversion\ the optional argument isn't used and reserved for \end{docCommand} -\begin{docCommand}{RemoveBackupCounters*}{\oarg{options}\marg{counter name}} \tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} +\begin{docCommand}{RemoveBackupCounters*}{\oarg{options}\marg{counter name}} \CHDocNew{0.5} This command is basically similar to \refCom{RemoveBackupCounters}, but does not restore the counter value right at the place the macro is used. @@ -1751,33 +1914,32 @@ Principally backing up counter values and restoring them later on is not really However, there is a solution to this problem: The hypertarget anchors are built up from the specifications of a macro \cs{theH...} where the ellipses stands for the counter name. If for example \cs{theHchapter} is changed after a counter was reset the hypertargets will again be correct, since this will provide a different target name. \cs{BackupCounterValues} does this resetting automatically in an unique way and \cs{RestoreCounterValues} restores as well the old \cs{theH...} macros of all counters that are in the backup list. It tracks the number of calls to \cs{BackupCounterValues} and changes the relevant \cs{theH...} macro definitions to use unique anchor names then -- this way multiple \cs{BackupCounterValues} calls are possible without destroying the hyperlink facicilities with \packagename{hyperref}. -\section{Counter output} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\section{Counter output} \CHDocNew{0.7} Once in a while it might be necessary to provide counter output not only as integer numbers, letters or Roman figures but also using binary, octal or hexdecimal number output. The \CHDocPackage{fmtcount} package has support for this already -- here are some alternatives \begin{marker} None of the commands checks whether the argument refers to counter name. \end{marker} - -\begin{docCommand}{BinaryValue}{\marg{counter name}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}[doc new={\chdocextractversion{xassoccntversion0.7}}]{BinaryValue}{\marg{counter name}}% \CHDocNew{0.7} This command will print the value of the counter using binary digits. \end{docCommand} -\begin{docCommand}{hexValue}{\marg{counter name}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{hexValue}{\marg{counter name}} \CHDocNew{0.7} This command will print the value of the counter using lowercase hexadecimal digits. \end{docCommand} -\begin{docCommand}{HexValue}{\marg{counter name}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{HexValue}{\marg{counter name}} \CHDocNew{0.7} This command will print the value of the counter using uppercase hexadecimal digits. \end{docCommand} -\begin{docCommand}{OctalValue}{\marg{counter name}} \tcbdocmarginnote{\tcbdocnew{\versionzerosevendate}} +\begin{docCommand}{OctalValue}{\marg{counter name}} \CHDocNew{0.7} This command will print the value of the counter using uppercase hexadecimal digits. @@ -1837,13 +1999,16 @@ write this documentation. \section{Version history} -\begin{itemize} - -\item -Version 0.8 -\begin{itemize}[label={$\checkmark$}] -\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}[itemsep=15pt] +\item \CHDocFullVersion{0.9} + \begin{itemize} + \item \CHDocUpdate{0.9}\refCom{TotalValue} is an expandable command now. + \item \CHDocNew{0.9} Added the \CHDocTag{periodic counter} features -- see \nameref{section:periodic_counters} for more information on this. + \end{itemize} +\item \CHDocFullVersion{0.8} + \begin{itemize}[label={$\checkmark$}] + \item \CHDocUpdate{0.8}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). + \item \CHDocNew{0.8}Additions of commands \begin{itemize}[label={$\triangleright$}] \item \refCom{ResumeAllSuspendedCounters} \item \refCom{CascadeSuspendCounters} @@ -1851,51 +2016,46 @@ Version 0.8 \item \refCom{ShowResetList} \end{itemize} \end{itemize} -\item - Version 0.7 - +\item \CHDocFullVersion{0.7} + \leavevmode \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\CHDocUpdate{0.7} 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. \CHDocNew{0.7} + \item Added the \cs{Loop...Counters} macros that perform an action in loop on all given counter names. \CHDocNew{0.7} + \end{itemize} + +\item \CHDocFullVersion{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 \CHDocNew{0.6} + \item Fixed a small bug within backup counter support -- the resetting was not done any more \CHDocNew{0.6} \item Added the \CHDocKey{nonumberofruns}\ package option. -\end{itemize} + \end{itemize} \item -Version 0.5 -\begin{itemize}[label={$\checkmark$}] -\item Added support (very experimental!) for the \CHDocTag{coupled counters} feature, see \cref{sec::coupledcounters} about this feature! \tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} -\item Added \cs{RegisterTotalDocumentCounter} and improved \cs{TotalValue} support\tcbdocmarginnote{\tcbdocnew{\versionzerofivedate}} -\end{itemize} + \CHDocFullVersion{0.5} + \begin{itemize}[label={$\checkmark$}] + \item Added support (very experimental!) for the \CHDocTag{coupled counters} feature, see \cref{sec::coupledcounters} about this feature! \CHDocNew{0.5} + \item Added \cs{RegisterTotalDocumentCounter} and improved \cs{TotalValue} support\CHDocNew{0.5} + \end{itemize} \item -Version 0.4 -\begin{itemize}[label={$\checkmark$}] -\item Added \cs{BackupCounterValues} and \cs{RestoreCounterValues} support\tcbdocmarginnote{\tcbdocnew{\versionzerofourdate}} -\item Added \cs{StepDownCounter} and \cs{SubtractFromCounter} macros\tcbdocmarginnote{\tcbdocnew{\versionzerofourdate}} -\end{itemize} + \CHDocFullVersion{0.4} + \begin{itemize}[label={$\checkmark$}] + \item Added \cs{BackupCounterValues} and \cs{RestoreCounterValues} support\CHDocNew{0.4} + \item Added \cs{StepDownCounter} and \cs{SubtractFromCounter} macros\CHDocNew{0.4} + \end{itemize} \item -Version 0.3 -\begin{itemize}[label={$\checkmark$}] -\item Added the \CHDocTag{totalcounter} features similar to the packages \CHDocPackage{totcount} or \CHDocPackage{totalcount} \tcbdocmarginnote{\tcbdocnew{2015-11-11}} -\item Added the \CHDocTag{super total counter} features\tcbdocmarginnote{\tcbdocnew{2015-25-11}} -\item Added the \CHDocCounter*{numberofruns} counter \tcbdocmarginnote{\tcbdocnew{2015-25-11}} + \CHDocFullVersion{0.3}\CHDocUpdate{0.3} + \begin{itemize}[label={$\checkmark$}] + \item Added the \CHDocTag{totalcounter} features similar to the packages \CHDocPackage{totcount} or \CHDocPackage{totalcount} \tcbdocmarginnote{\tcbdocnew{2015-11-11}} + \item Added the \CHDocTag{super total counter} features \tcbdocmarginnote{\tcbdocnew{2015-25-11}} + \item Added the \CHDocCounter*{numberofruns} counter \tcbdocmarginnote{\tcbdocnew{2015-25-11}} \end{itemize} -\item -Version 0.2 - -Improved \cs{stepcounter} to remove some incompatibilities with the \CHDocPackage{perpage}. This is only partially managed so far. +\item \CHDocFullVersion{0.2}\CHDocUpdate{0.2} +Improved \cs{stepcounter} to remove some incompatibilities with the \CHDocPackage{perpage}. This is only partially managed so far. \item - -Version: 0.1 +\CHDocFullVersion{0.1} +%Version: 0.1 \CHDocNew{0.1} A major bug fixed due to some error in usage together with \CHDocPackage{calc} when the driven counters are not stepped any longer. The culprit was in \CHDocPackage{assoccnt} that the counter reset list was not really disabled. 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 673de363105..50209f1e1c4 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 c07fb83b19b..615e49406d4 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) %% Driver file for xassoccnt.sty %% %% @@ -21,6 +21,7 @@ \documentclass{book} +\usepackage{graphicx} \usepackage{xcolor} \usepackage{totcount} \usepackage{calc} 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 ef38cd07e92..788ce9bac06 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 e29df7fe8ca..f5d9fd41a1f 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) %% Example file for xassoccnt.sty %% %% @@ -43,6 +43,7 @@ % Some packages only for output and dummy pages +\usepackage{graphicx} \usepackage{blindtext} \usepackage{forloop} \usepackage[svgnames]{xcolor} diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf Binary files differnew file mode 100644 index 00000000000..c5e1e356251 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex new file mode 100644 index 00000000000..fa40a6e109a --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex @@ -0,0 +1,78 @@ +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% Example file for periodic 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{article} + +\usepackage{xassoccnt} + +\usepackage{blindtext} + +\usepackage{pgffor} + +\DeclarePeriodicCounter{section}{10} + +\newcounter{foocntr} + +\begin{document} + + +\setcounter{foocntr}{3}% +\AddPeriodicCounter{foocntr}{8}% + +Value of foocntr is: \thefoocntr % Should be 3 + +\addtocounter{foocntr}{20} % Is it 23? No, it is 23 % 8 = 7 +Value of foocntr is \thefoocntr\ now! + +Adding a value of 4 again: +\addtocounter{foocntr}{4} % Is it 11? No, it is 11 % 8 = 3 +Value of foocntr is \thefoocntr\ now! + +Now prevent the wrapping +\addtocounter{foocntr}{10}[wrap=false] % Is it 13? No, it is 11 % 8 = 3 +Value of foocntr is \thefoocntr\ now! + + + +\foreach \x in {1,...,22} {% + \section{My nice section \x} +} + +%\RemovePeriodicCounter[resetperiodic=false]{section} + +\clearpage + +\ChangePeriodicCounterCondition[reset=false]{section}{5}% + +\foreach \x in {1,...,22} {% + \section{My nice section \x} +} +\clearpage + +\ChangePeriodicCounterCondition{section}{7}% + +\foreach \x in {1,...,22} {% + \section{My nice section \x} +} + + + +\end{document}
\ No newline at end of file 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 differindex 8ab5eac4d3d..81e04e2f750 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf +++ 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 index d84116837d4..7eb2cfaf3a8 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.8 (2016/06/10 -- 23/28/27) +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) %% Example file for suspended counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf Binary files differnew file mode 100644 index 00000000000..ea8135abd0a --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex new file mode 100644 index 00000000000..16d895b7701 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex @@ -0,0 +1,42 @@ +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% Example file for total 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{article} + +\usepackage[nonumberofruns]{xassoccnt} +\usepackage{blindtext} +\usepackage{hyperref} + +\RegisterTotalDocumentCounter{section} + +\begin{document} + +The total value of section is \TotalValue{section} + +\ifnum\TotalValue{section} > 1\relax Hooray \else only one section found\fi +\blinddocument + +\blinddocument + + + + +\end{document} diff --git a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty index 38410d2c686..db0ebec8c2f 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.8 (2016/06/10 -- 23/28/27) +%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) %% Source file for xassoccnt.sty %% %% @@ -19,11 +19,11 @@ %% %% -\def\xassoccntpackageversion{0.8} +\def\xassoccntpackageversion{0.9} \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{xassoccnt}[2016/06/10 - v\xassoccntpackageversion] - +\ProvidesPackage{xassoccnt}[2016/06/19 - v\xassoccntpackageversion] +\RequirePackage{graphicx} \RequirePackage{xcolor} \RequirePackage{xparse} \RequirePackage{l3keys2e} @@ -61,6 +61,9 @@ \bool_new:N \l__xassoccnt_is_supertotalcounter_bool +\bool_new:N \l_xassoccnt_resetperiodiccounters_bool +\bool_new:N \l_xassoccnt_wrapperiodiccounters_bool + \seq_new:N \l__xassoccnt_counterreset_seq %%% @@ -163,7 +166,14 @@ supertotal .bool_set:N={\l__xassoccnt_is_supertotalcounter_bool }, - resetbackup .bool_set:N={\l__xassoccnt_resetbackupcounters_bool } + resetbackup .bool_set:N={\l__xassoccnt_resetbackupcounters_bool }, + +% resetperiodic .bool_set:N={ \l_xassoccnt_resetperiodiccounters_bool } +} + +\keys_define:nn {xassoccnt_periodiccounter} {% + reset .bool_set:N={ \l_xassoccnt_resetperiodiccounters_bool }, + wrap .bool_set:N={ \l_xassoccnt_wrapperiodiccounters_bool } } \keys_set:nn{xassoccnt}{nonumberofruns} @@ -266,6 +276,7 @@ \cs_set_eq:NN \xassoccnt_standardsetcounter \setcounter + % Needed for Backup/Restore features \AtBeginDocument{% @@ -284,7 +295,7 @@ }{} \AtEndOfPackage{ - \PackageInfo{xassoccnt}{2016/06/10 - v\xassoccntpackageversion -- stepping counters simultaneously and other features} + \PackageInfo{xassoccnt}{2016/06/19 - 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 @@ -349,8 +360,14 @@ \seq_new:N \g__xassoccnt_totalcounter_container +\prop_new:N \g_xassoccnt_totalcounter_prop \seq_new:N \g__xassoccnt_supertotalcounter_container + +\seq_new:N \g_xassoccnt_periodiccounter_container_seq +\prop_new:N \g_xassoccnt_periodiccounter_prop + + \cs_new_nopar:Nn \__xassoccnt_container_perdriver_new:n { \seq_if_exist:cF{ \__xassoccnt_drivercontainer:n {#1} } { % Generate only if there is no driver container sequence so far! @@ -852,7 +869,9 @@ %% More generic macros (hidding the internal features of the lists) -\cs_new:Nn \xassoccnt_container_datatype: {seq} +\cs_new_nopar:Nn \xassoccnt_container_property: {prop} + +\cs_new_nopar:Nn \xassoccnt_container_datatype: {seq} \cs_new:Nn \__xassoccnt_construct_cs:n {% @@ -1331,12 +1350,170 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%% + +\NewDocumentCommand{\DeclarePeriodicCounter}{O{}mm}{% + \xassoccnt_add_periodiccounter:nnn {#1} {#2} {#3}% +} + + +\prg_new_conditional:Nnn \xassoccnt_is_periodiccounter:n {TF,T,F} +{% + \seq_if_in:NnTF \g_xassoccnt_periodiccounter_container_seq {#1} + {\prg_return_true:} + {\prg_return_false:} +} + +\cs_new:Nn \xassoccnt_stepcounter_periodiccounter:n {% + \xassoccnt_is_periodiccounter:nT {#1}{% + \int_compare:nNnT {\prop_item:Nn \g_xassoccnt_periodiccounter_prop {#1}} = {\use:c{c@#1}}% + { \__xassoccnt_setdocumentcounter:nnn {} {#1}{\c_zero} } + } +} +\cs_new:Nn \xassoccnt_addtocounter_periodiccounter:nnn {% + \keys_set:nn {xassoccnt_periodiccounter} {wrap=true,#3} + \int_set:Nn \l_tmpa_int { \int_eval:n {\number\value{#1}+#2 } } + \bool_if:NTF \l_xassoccnt_wrapperiodiccounters_bool {% + \int_set:Nn \l_tmpb_int { \int_mod:nn {\l_tmpa_int} {\prop_item:Nn \g_xassoccnt_periodiccounter_prop {#1}}}% + \__xassoccnt_setdocumentcounter:nnn {} {#1}{\l_tmpb_int}% Wrap around!!!! + }{% + \__xassoccnt_setdocumentcounter:nnn {} {#1}{\l_tmpa_int}% Don't Wrap around!!!! + }% +} + + +\cs_new:Nn \xassoccnt_reset_periodiccounter:nn {% + \keys_set:nn {xassoccnt_periodiccounter} {reset=true,#1} + % Reset the periodic counter if requested (by default this is true!) + \bool_if:NT \l_xassoccnt_resetperiodiccounters_bool {% + \__xassoccnt_setdocumentcounter:nnn {} {#2} {\c_zero}% + } +} + +\cs_new:Nn \xassoccnt_remove_periodiccounter:nn {% + \seq_gremove_all:Nn \g_xassoccnt_periodiccounter_container_seq {#2}% + \prop_remove:Nn \g_xassoccnt_periodiccounter_prop {#2}% + \xassoccnt_reset_periodiccounter:nn {#1} {#2} +} + +\cs_new:Nn \xassoccnt_add_periodiccounter:nnn {% + \keys_set:nn {xassoccnt} {#1} + \seq_put_right:Nn \g_xassoccnt_periodiccounter_container_seq {#2}% + \seq_gremove_duplicates:N \g_xassoccnt_periodiccounter_container_seq + \xassoccnt_changecondition_periodiccounter:nnn {reset=false} {#2} {#3} % Check the optional argument later on!!!! +} + +\cs_new:Nn \xassoccnt_changecondition_periodiccounter:nnn {% + \xassoccnt_is_periodiccounter:nTF {#2}{% + \prop_put:Nnn \g_xassoccnt_periodiccounter_prop {#2} {#3}% + \xassoccnt_reset_periodiccounter:nn {#1} {#2} + } +} + +\NewDocumentCommand{\ChangePeriodicCounterCondition}{O{}mm}{% + \xassoccnt_changecondition_periodiccounter:nnn {#1}{#2}{#3}% +} + +\NewDocumentCommand{\RemovePeriodicCounter}{O{}m}{% + \xassoccnt_remove_periodiccounter:nn{#1} {#2} +} + +\NewDocumentCommand{\AddPeriodicCounter}{O{}mm}{% + \xassoccnt_add_periodiccounter:nnn {#1} {#2} {#3} +} + +\NewDocumentCommand{\IsPeriodicCounterTF}{m+m+m}{% + \xassoccnt_is_periodiccounter:nTF{#1}{#2}{#3}% +} + +\NewDocumentCommand{\IsPeriodicCounterT}{m+m}{% + \xassoccnt_is_periodiccounter:nT{#1}{#2} +} + +\NewDocumentCommand{\IsPeriodicCounterF}{m+m}{% + \xassoccnt_is_periodiccounter:nF{#1}{#2} +} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% + + %%%% Redefinition of standard counter macros + +\NewDocumentCommand{\stepcounteroldnototal}{m}{% + \__xassoccnt_translate_countername:cn {l_tmpa_tl} {#1}% + \xassoccnt_is_suspendedcounter:nF{#1}{% + \xassoccnt_is_coupledcounter:nTF {#1} + { \xassoccnt_stepcounter_coupledcounters:n{#1} } + {% No, not a coupled counter! + \cs_gset_nopar:Nn \__xassoccnt_laststeppedcounter: {\l_tmpa_tl}% + \xassoccnt_countersinresetlist:n{\l_tmpa_tl}% + \__xassoccnt_getresetlist:n {\l_tmpa_tl}% + \seq_if_empty:NTF \l__xassoccnt_counterreset_seq + {% + \xassoccnt_standardaddtocounter{\l_tmpa_tl}{\c_one}% Use the original one! + \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{\l_tmpa_tl}}% + \__xassoccnt_step_associatedcounters:n {\l_tmpa_tl} + }{ % reset list is not empty! + % This is the replacement of \csname cl@#1\endcsname + \xassoccnt_standardaddtocounter{\l_tmpa_tl}{\c_one} + \seq_map_inline:Nn \l__xassoccnt_counterreset_seq {% + \xassoccnt_is_drivercounter:nTF{##1}{% + \csname c@##1\endcsname\c_zero % Reset but do not increase + }{% + \csname c@##1\endcsname\c_minus_one + \xassoccnt_standardstepcounter{##1}% + } + } + \__xassoccnt_step_associatedcounters:n {\l_tmpa_tl} % step the remaining associated counters + }% End of not empty reset list + }% End of coupled counters + } % end of not suspended counter +} + + + +\NewDocumentCommand{\stepcounterTotal}{m}{% + \__xassoccnt_translate_countername:cn {l_tmpa_tl} {#1}% + \xassoccnt_is_suspendedcounter:nF{#1}{% + \xassoccnt_is_coupledcounter:nTF {#1} + { \xassoccnt_stepcounter_coupledcounters:n{#1} } + {% No, not a coupled counter! + \cs_gset_nopar:Nn \__xassoccnt_laststeppedcounter: {\l_tmpa_tl}% + \xassoccnt_countersinresetlist:n{\l_tmpa_tl}% + \__xassoccnt_getresetlist:n {\l_tmpa_tl}% + \seq_if_empty:NTF \l__xassoccnt_counterreset_seq + {% + \xassoccnt_standardaddtocounter{\l_tmpa_tl}{\c_one}% Use the original one! + \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{\l_tmpa_tl}}% + \__xassoccnt_step_associatedcounters:n {\l_tmpa_tl} + }{ % reset list is not empty! + % This is the replacement of \csname cl@#1\endcsname + \xassoccnt_standardaddtocounter{\l_tmpa_tl}{\c_one} + \seq_map_inline:Nn \l__xassoccnt_counterreset_seq {% + \xassoccnt_is_drivercounter:nTF{##1}{% + \csname c@##1\endcsname\c_zero % Reset but do not increase + }{% + \csname c@##1\endcsname\c_minus_one + \xassoccnt_standardstepcounter{##1}% + } + } + \__xassoccnt_step_associatedcounters:n {\l_tmpa_tl} % step the remaining associated counters + }% End of not empty reset list + }% End of coupled counters + } % end of not suspended counter + \__xassoccnt_is_totalcounter:nT {#1} {% + \__xassoccnt_store_totalcounter_value:n {#1}% + } +} + + \RenewDocumentCommand{\stepcounter}{m}{% \__xassoccnt_translate_countername:cn {l_tmpa_tl} {#1}% \xassoccnt_is_suspendedcounter:nF{#1}{% + \xassoccnt_stepcounter_periodiccounter:n {#1}% \xassoccnt_is_coupledcounter:nTF {#1} { \xassoccnt_stepcounter_coupledcounters:n{#1} } {% No, not a coupled counter! @@ -1363,8 +1540,23 @@ }% End of not empty reset list }% End of coupled counters } % end of not suspended counter + \__xassoccnt_is_totalcounter:nT {#1} {% + \__xassoccnt_store_totalcounter_value:n {#1}% + } } +\RenewDocumentCommand{\addtocounter}{mmO{}}{% + \xassoccnt_is_periodiccounter:nTF {#1}{% + \xassoccnt_addtocounter_periodiccounter:nnn {#1} {#2} {#3}% + }{% + \xassoccnt_standardaddtocounter{#1}{#2}% + } +} + + + + + \NewDocumentCommand{\xassoccnt_addtocounter}{mmO{}}{% @@ -1374,9 +1566,28 @@ \xassoccnt_standardaddtocounter{\l_tmpb_tl}{#2}% \cs_gset_nopar:Nn \__xassoccnt_lastaddtocounter: {\l_tmpb_tl}% }% + % Now check if #1 is a total counter and set the property correspondingly + \__xassoccnt_is_totalcounter:nT {#1} {% + \__xassoccnt_store_totalcounter_value:n {#1}% + } +} + + +\RenewDocumentCommand{\xassoccnt_addtocounter}{mmO{}}{% + % Only add to a counter if this counter isn't on the suspended counters list! + \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}% + }% + % Now check if #1 is a total counter and set the property correspondingly + \__xassoccnt_is_totalcounter:nT {#1} {% + \__xassoccnt_store_totalcounter_value:n {#1}% + } } + \cs_new:Nn \__xassoccnt_setdocumentcounter:nnn {% \__xassoccnt_translate_countername:cn {l_tmpa_tl} {#2}% \xassoccnt_standardsetcounter{\l_tmpa_tl}{#3}% @@ -1468,6 +1679,10 @@ \cs_gset_nopar:Nn \__xassoccnt_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} {% + \__xassoccnt_store_totalcounter_value:n {#1}% + %\prop_put:Nnn \g_xassoccnt_totalcounter_prop {#1} {\number\value{\tl_use:N \l_tmpa_tl}} + } } @@ -1514,6 +1729,8 @@ + + \NewDocumentCommand{\NewDocumentCounter}{O{initial=\c_zero}mo}{% \IfValueTF{#3}{% \__xassoccnt_newcounter_ltx:nnn{#1}{#2}{#3} @@ -1626,11 +1843,15 @@ \NewDocumentCommand{\NewTotalDocumentCounter}{O{}m}{% \keys_set:nn {xassoccnt} {supertotal=false,#1} \__xassoccnt_ifis_latexcounter:nF {#2} {% Define the counter - \DeclareDocumentCounter[sloppy=false]{#2}% + \xassoccnt_declaredocumentcounter:nn{sloppy=false}{#2}% }% \__xassoccnt_registertotaldocumentcounter:nn{#1}{#2} } +\cs_new:Nn \__xassoccnt_store_totalcounter_value:n {% + \prop_put:Nnn \g_xassoccnt_totalcounter_prop {#1} {\number\value{\__xassoccnt_expand_totalcountername:n{#1}}} +} + \cs_new:Nn \__xassoccnt_registertotaldocumentcounter:nn {% \keys_set:nn {xassoccnt} {supertotal=false,#1} \__xassoccnt_ifis_latexcounter:nF {#2} {% Counter does not exist -- do not autodefine @@ -1639,8 +1860,10 @@ % If the counter already exists -> check for the internal totalcounter name \cs_if_exist:cF { c@\__xassoccnt_expand_totalcountername:n{#2} } { - \DeclareDocumentCounter[sloppy=false,initial={\c_minus_one}]{\__xassoccnt_expand_totalcountername:n{#2}} - \seq_gput_right:Nx \g__xassoccnt_totalcounter_container {\__xassoccnt_expand_totalcountername:n{#2}} + \xassoccnt_declaredocumentcounter:nn{sloppy=false,initial={\c_minus_one}}{\__xassoccnt_expand_totalcountername:n{#2}}% + \seq_gput_right:Nx \g__xassoccnt_totalcounter_container {\__xassoccnt_expand_totalcountername:n{#2}}% + \__xassoccnt_store_totalcounter_value:n {#2}% + %\prop_put:Nnn \g_xassoccnt_totalcounter_prop {#2} {\number\value{\__xassoccnt_expand_totalcountername:n{#2}}} \bool_if:NT \l__xassoccnt_is_supertotalcounter_bool {% \__xassoccnt_add_supertotalcounter:n {#2} } @@ -1669,6 +1892,12 @@ \number\value{\tl_use:N \l_tmpa_tl}% } +\renewcommand{\TotalValue}[1]{% + \prop_item:Nn \g_xassoccnt_totalcounter_prop {#1}% +} + +%\newcommand{\loadstore} + \cs_new:Nn \__xassoccnt_writetotalcounters:nn {% @@ -2001,22 +2230,36 @@ %%%%%%%%%%%%%%%%%%%% +\cs_new:Nn \xassoccnt_declaredocumentcounteropt:nnn{% + \__xassoccnt_newcounter_ltx:nnn{#1}{#2}{#3}% +} + +\cs_new:Nn \xassoccnt_declaredocumentcounter:nn{% + \__xassoccnt_newcounter_ltx:nn{#1}{#2}{}% +} + + + +%%%%%%%%%%%%%%%%%%%% + \NewDocumentCommand{\EnableNumberofrunsTF}{mm}{% \bool_if:NF \g__xassoccnt_nonumberofruns_bool { #1 }{#2} } -\ExplSyntaxOff \NewDocumentCommand{\DeclareDocumentCounter}{O{initial={0}}mo}{% \IfValueTF{#3}{% - \NewDocumentCounter[#1]{#2}[#3]% + \xassoccnt_declaredocumentcounteropt:nnn{#1}{#2}{#3}% }{% - \NewDocumentCounter[#1]{#2}% + \xassoccnt_declaredocumentcounter:nn{#1}{#2}% }% } +\ExplSyntaxOff + + \EnableNumberofrunsTF{% \NewTotalDocumentCounter[supertotal=true]{numberofruns} @@ -2055,6 +2298,7 @@ \AddFeature[sublists=true]{coupledcounters} % New style, not fully implemented so far +\AddFeature[sublists=false]{periodiccounters} % New style, not fully implemented so far % Some more to be done |