From 3fd588bb279cdfa2a5b61892ebe94ada81d07fbe Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 30 Jul 2016 23:08:03 +0000 Subject: xassoccnt (29jul16) git-svn-id: svn://tug.org/texlive/trunk@41767 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/xassoccnt/README | 8 +- .../xassoccnt/xassoccnt_backupcounters_example.pdf | Bin 0 -> 84360 bytes .../xassoccnt/xassoccnt_backupcounters_example.tex | 331 ++++ .../latex/xassoccnt/xassoccnt_coupledcounters.pdf | Bin 94195 -> 0 bytes .../latex/xassoccnt/xassoccnt_coupledcounters.tex | 206 --- .../xassoccnt_coupledcounters_example.pdf | Bin 0 -> 94256 bytes .../xassoccnt_coupledcounters_example.tex | 206 +++ .../doc/latex/xassoccnt/xassoccnt_doc.pdf | Bin 462941 -> 533167 bytes .../doc/latex/xassoccnt/xassoccnt_doc.tex | 1804 ++++++++++++-------- .../doc/latex/xassoccnt/xassoccnt_driver.pdf | Bin 80724 -> 77742 bytes .../doc/latex/xassoccnt/xassoccnt_driver.tex | 21 +- .../doc/latex/xassoccnt/xassoccnt_example.pdf | Bin 68384 -> 68384 bytes .../doc/latex/xassoccnt/xassoccnt_example.tex | 5 +- .../xassoccnt_periodiccounters_example.pdf | Bin 28017 -> 31637 bytes .../xassoccnt_periodiccounters_example.tex | 13 +- .../xassoccnt/xassoccnt_resetlist_example.pdf | Bin 0 -> 46542 bytes .../xassoccnt/xassoccnt_resetlist_example.tex | 75 + .../xassoccnt_suspendedcounters_example.pdf | Bin 60527 -> 60527 bytes .../xassoccnt_suspendedcounters_example.tex | 2 +- .../xassoccnt/xassoccnt_totalcounters_example.pdf | Bin 63245 -> 63550 bytes .../xassoccnt/xassoccnt_totalcounters_example.tex | 7 +- 21 files changed, 1731 insertions(+), 947 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf create mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex delete mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf delete mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex create mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf create mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex create mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf create mode 100644 Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex (limited to 'Master/texmf-dist/doc/latex/xassoccnt') diff --git a/Master/texmf-dist/doc/latex/xassoccnt/README b/Master/texmf-dist/doc/latex/xassoccnt/README index eebc964da38..a0d3f99da59 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/README +++ b/Master/texmf-dist/doc/latex/xassoccnt/README @@ -1,9 +1,9 @@ -%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) %% README file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016 by Dr. Christian Hupfer +%% Copyright (c) 2015 -- 2016 by Dr. Christian Hupfer %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -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/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 +As of 2016/07/28 xassoccnt does not supersede the package assoccnt by the same author, however, +the older package isn't declared obsolete as of 2016/07/28 diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf new file mode 100644 index 00000000000..4d3cd64eb03 Binary files /dev/null and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex new file mode 100644 index 00000000000..40a7a63fd19 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex @@ -0,0 +1,331 @@ +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) +%% Example file for backup counters file for xassoccnt.sty +%% +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2016 by Dr. Christian Hupfer +%% ------------------------------------------------------------------------------------------- +%% +%% 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} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +\usepackage{hyperref} + +\DeclareBackupCountersGroupName{sectiontree} +\DeclareBackupCountersGroupName{chaptertree} + +\AssignBackupCounters[name=chaptertree,cascading=true]{chapter} % Use all counters in the chapter counter driver reset list + + +\newcommand{\outputit}[1]{\csname the#1\endcsname\par} + +\begin{document} +Checking for existence of a backup counter group: + + +\IsBackupCounterGroupTF{chaptertree}{Yes, \fbox{chaptertree} is a backup counter group}{no, \fbox{chaptertree} is no backup counter group} + +\IsBackupCounterGroupT{chaptertree}{Yes, \fbox{chaptertree} is a backup counter group} + +\IsBackupCounterGroupF{foochaptertree}{No, \fbox{foochaptertree} is no backup counter group} + +\IsBackupCounterGroupTF{secondchaptertree}{Yes, \fbox{secondchaptertree} is a backup counter group}{no, \fbox{secondchaptertree} is no backup counter group} +\clearpage +\tableofcontents +\listoffigures + +\chapter{First regular chapter} + +\section{First section in first regular chapter} + +\subsection{First subsection in first regular section} + + + +\begin{figure} +\caption{My nice figure in 1st regular chapter} +\end{figure} + + +\begin{figure} +\caption{My other nice figure in 1st regular chapter} +\end{figure} + + + +\chapter{Second regular chapter} + +\section{First section in 2nd regular chapter} + +\subsection{1st subsection in 1st regular section of 2nd regular chapter} + + +\begin{figure} +\caption{My nice figure in 2nd regular chapter} +\end{figure} + + +\begin{figure} +\caption{My other nice figure in 2nd regular chapter} +\end{figure} + + + + + +\chapter{Third regular chapter} + +\section{1st section in 3rd regular chapter} + +\subsection{1st subsection in 1st regular section of 2nd regular chapter} +\subsection{2nd subsection in 1st regular section of 2nd regular chapter} + +\section{2nd section in 3rd regular chapter} + +\subsection{1st subsection in 2nd regular section of 2nd regular chapter} +\subsection{2nd subsection in 2nd regular section of 2nd regular chapter} + +\chapter{Fourth regular chapter} + + + +\BackupCounterGroup[backup-id={firstchaptertree},cascading=true]{chaptertree} + +\chapter{First chapter after backup command} + +\section{1st section in 1st backup chapter} + +\subsection{1st subsection in 1st regular section of 1st backup chapter} +\subsection{2nd subsection in 1st regular section of 1st backup chapter} + +\section{2nd section in 1st backup chapter} + +\subsection{1st subsection in 2nd regular section of 1st backup chapter} +\subsection{2nd subsection in 2nd regular section of 1st backup chapter} + + +\begin{figure} +\caption{My nice figure in 1st backup chapter} +\end{figure} + + +\begin{figure} +\caption{My other nice figure in 1st backup chapter} +\end{figure} + + + + + +\chapter{Second chapter after backup command} + +\section{1st section in 2nd backup chapter} + +\subsection{1st subsection in 1st regular section of 2nd backup chapter} +\subsection{2nd subsection in 1st regular section of 2nd backup chapter} + +\section{2nd section in 2nd backup chapter} + +\subsection{1st subsection in 2nd regular section of 2nd backup chapter} +\subsection{2nd subsection in 2nd regular section of 2nd backup chapter} + + +\chapter{Third chapter after first backup command} + + + +\BackupCounterGroup[backup-id={secondchaptertree}]{chaptertree} + +\chapter{First chapter after second backup command} + +% Now restore the full chaptertree command with the backup id firstchaptertree, but don't keep the state afterwards. + +Checking the backup state: \IsBackupStateTF{chaptertree}{firstchaptertree}{Yes}{No} + +Checking the backup state again: \IsBackupStateT{chaptertree}{firstchaptertree}{Yes} + +Checking the backup state again: \IsBackupStateF{chaptertree}{foochaptertree}{No, it's no backup state} + + +\RestoreBackupCounterGroup[keep-after-restore=false,backup-id={firstchaptertree}]{chaptertree} + +Now checking after restore with `keep-after-restore=false`: + +Checking the backup state: \IsBackupStateTF{chaptertree}{firstchaptertree}{Yes}{No} + +Checking the backup state again: \IsBackupStateT{chaptertree}{firstchaptertree}{Yes} + +Checking the backup state again: \IsBackupStateF{chaptertree}{foochaptertree}{No, it's no backup state} + + + + + +\chapter{First chapter after restoring of first backup} + + +\section{1st section in 1st backup chapter of 2nd backup} + +\subsection{1st subsection in 1st regular section of 2nd backup chapter} +\subsection{2nd subsection in 1st regular section of 2nd backup chapter} + +\section{2nd section in 2nd backup chapter of 2nd backup} + +\subsection{1st subsection in 2nd regular section of 2nd backup chapter} +\subsection{2nd subsection in 2nd regular section of 2nd backup chapter} + + +\chapter{Another chapter after restoring} + +% Now let us restore only some of the counters + + +\section{First section of another chapter} + +\begin{figure} +\caption{My nice figure} +\end{figure} + +\begin{figure} +\caption{My very nice figure} +\end{figure} + + +\subsection{First subsection of 1st section of another chapter} + +\section{Now another section} + + +\RestoreBackupCounterGroup[keep-after-restore=true,backup-id={secondchaptertree}]{chaptertree} + + +\chapter{Another chapter after restoring with secondchaptertree} + +% Now let us restore only some of the counters + + +\section{First section of another chapter} + +\begin{figure} +\caption{My nice figure} +\end{figure} + +\begin{figure} +\caption{My very nice figure} +\end{figure} + + +\subsection{First subsection of 1st section of another chapter} + +\section{Now another section} + + +\RestoreBackupCounterGroup[keep-after-restore=true,backup-id={secondchaptertree},restore-id=first]{chaptertree} + + +\chapter{Another chapter after restoring, secondchaptertree,other restore-id} + +% Now let us restore only some of the counters + + +\section{First section of another chapter} + +\begin{figure} +\caption{My nice figure} +\end{figure} + +\begin{figure} +\caption{My very nice figure} +\end{figure} + + +\subsection{First subsection of 1st section of another chapter} + +\section{Now another section} + +\RestoreBackupCounterGroup[keep-after-restore=true,backup-id={secondchaptertree},restore-id=newrestore]{chaptertree} + + +\chapter{Another chapter after restoring, secondchaptertree, yet another restore-id} + +% Now let us restore only some of the counters + + +\section{First section of another chapter} + +\begin{figure} +\caption{My nice figure} +\end{figure} + +\begin{figure} +\caption{My very nice figure} +\end{figure} + + +\subsection{First subsection of 1st section of another chapter} + +\section{Now another section} + + +%%%%% + + +%\ClearBackupCounterGroups{chaptertree} + +%\DeleteBackupCounterGroups{chaptertree} + + +\RemoveCountersFromBackupGroup{chaptertree}{section} + + + + +\RestoreBackupCounterGroup[keep-after-restore=true,backup-id={secondchaptertree},restore-id=renewrestore]{chaptertree} + +%\chapter{Another chapter after restoring, secondchaptertree, yet another restore-id} + + + +Removing a specific backup-id + +%\ClearCounterBackupState[backup-id=secondchaptertree]{chaptertree}{chapter} + + +\ClearBackupState[backup-id=secondchaptertree]{chaptertree} + + + +\section{First section of another chapter} + +\begin{figure} +\caption{My nice figure} +\end{figure} + +\begin{figure} +\caption{My very nice figure} +\end{figure} + + +\subsection{First subsection of 1st section of another chapter} + +\section{Now another section} + + + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf deleted file mode 100644 index eca5594bc28..00000000000 Binary files a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex deleted file mode 100644 index 4f1417e5c1f..00000000000 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters.tex +++ /dev/null @@ -1,206 +0,0 @@ -%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) -%% Example file for coupled counters file for xassoccnt.sty -%% -%% -%% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016 by Dr. Christian Hupfer -%% ------------------------------------------------------------------------------------------- -%% -%% 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{caption} -\usepackage{xassoccnt} -\usepackage{blindtext} - - -\usepackage{hyperref} - -\DeclareCoupledCountersGroup{figuretablebundle} - -\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table} - -\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table,figure} - -\DeclareCoupledCounters[name=sectionequationbundle]{section,equation} - -\begin{document} - -\AddCoupledCounters[name=figuretablefoo]{figure,table,figure} - -\listoffigures -\listoftables - -\section{First} - - -\blindtext[10] - -\begin{figure}[!ht] - -\caption{A figure} -\end{figure} - -A footnote here\footnote{Myfootnote} - -\blindtext[10] - - -\begin{table}[!ht] -\caption{A table} -\end{table} - -\begin{equation} - E=mc^2 -\end{equation} - -\section{Second} - -\blindtext[10] - -\begin{figure}[!ht] - -\caption{A foo figure} -\end{figure} - -\blindtext[10] - - -\begin{table}[!ht] -\caption{A foo table} -\end{table} - - - -\begin{table}[!ht] -\caption{A foobar table} -\end{table} - - - -\begin{figure}[!ht] - -\caption{A foobar figure} -\end{figure} - -\blindtext[10] - -\begin{table}[!ht] -\caption{Yet another foo table} -\end{table} - - - -\begin{figure}[!ht] - -\caption{Yet another foo figure} -\end{figure} - -\RemoveCoupledCounters[name=figuretablebundle]{figure} -\addcontentsline{lof}{section}{After using RemoveCoupledCounters for figure} - -\blindtext[10] - -\begin{figure}[!ht] - -\caption{An intermediate figure that is not coupled} -\end{figure} - - -\begin{table}[!ht] -\caption{Yet another foobar table} -\end{table} - -\begin{table}[!ht] -\caption{Even more foobar table} -\end{table} - -\begin{table}[!ht] -\caption{Even most foobar table} -\end{table} - - - -\begin{figure}[!ht] - -\caption{Even more foobar figure} -\end{figure} - -\clearpage - -\begin{figure}[!ht] - -\caption{Another intermediate figure that is not coupled} -\end{figure} - - -\AddCoupledCounters[name=figuretablebundle]{figure} - -\addcontentsline{lof}{section}{After using AddCoupledCounters for figure again} - -\begin{figure}[!ht] -\caption{Even most foobar figure} -\end{figure} - -\begin{table}[!ht] -\caption{Another coupled table} -\end{table} - -\begin{figure}[!ht] -\caption{Another coupled figure} -\end{figure} - - -\ClearAllCoupledCounters -\clearpage - -\addcontentsline{lof}{section}{After using ClearAllCoupledCounters} -\addcontentsline{lot}{section}{After using ClearAllCoupledCounters} - -\begin{figure}[!ht] -\caption{Almost next to last figure} -\end{figure} - - -\begin{table}[!ht] -\caption{Almost next to last table} -\end{table} - -\begin{figure}[!ht] - \caption{Next to last figure} -\end{figure} - -\begin{table}[!ht] - \caption{Next to last table} -\end{table} - - - -\AddCoupledCounters[name=figuretablebundle]{figure,table} -\addcontentsline{lof}{section}{After using AddCoupledCounters} -\addcontentsline{lot}{section}{After using AddCoupledCounters} - - -\begin{figure}[!ht] -\caption{The last figure} -\end{figure} - -\begin{table}[!ht] -\caption{The last table} -\end{table} - - - -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf new file mode 100644 index 00000000000..d22985a9876 Binary files /dev/null and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex new file mode 100644 index 00000000000..54bf7bb03b1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex @@ -0,0 +1,206 @@ +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) +%% Example file for coupled counters file for xassoccnt.sty +%% +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2016 by Dr. Christian Hupfer +%% ------------------------------------------------------------------------------------------- +%% +%% 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{caption} +\usepackage{xassoccnt} +\usepackage{blindtext} + + +\usepackage{hyperref} + +\DeclareCoupledCountersGroup{figuretablebundle} + +\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table} + +\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table,figure} + +\DeclareCoupledCounters[name=sectionequationbundle]{section,equation} + +\begin{document} + +\AddCoupledCounters[name=figuretablefoo]{figure,table,figure} + +\listoffigures +\listoftables + +\section{First} + + +\blindtext[10] + +\begin{figure}[!ht] + +\caption{A figure} +\end{figure} + +A footnote here\footnote{Myfootnote} + +\blindtext[10] + + +\begin{table}[!ht] +\caption{A table} +\end{table} + +\begin{equation} + E=mc^2 +\end{equation} + +\section{Second} + +\blindtext[10] + +\begin{figure}[!ht] + +\caption{A foo figure} +\end{figure} + +\blindtext[10] + + +\begin{table}[!ht] +\caption{A foo table} +\end{table} + + + +\begin{table}[!ht] +\caption{A foobar table} +\end{table} + + + +\begin{figure}[!ht] + +\caption{A foobar figure} +\end{figure} + +\blindtext[10] + +\begin{table}[!ht] +\caption{Yet another foo table} +\end{table} + + + +\begin{figure}[!ht] + +\caption{Yet another foo figure} +\end{figure} + +\RemoveCoupledCounters[name=figuretablebundle]{figure} +\addcontentsline{lof}{section}{After using RemoveCoupledCounters for figure} + +\blindtext[10] + +\begin{figure}[!ht] + +\caption{An intermediate figure that is not coupled} +\end{figure} + + +\begin{table}[!ht] +\caption{Yet another foobar table} +\end{table} + +\begin{table}[!ht] +\caption{Even more foobar table} +\end{table} + +\begin{table}[!ht] +\caption{Even most foobar table} +\end{table} + + + +\begin{figure}[!ht] + +\caption{Even more foobar figure} +\end{figure} + +\clearpage + +\begin{figure}[!ht] + +\caption{Another intermediate figure that is not coupled} +\end{figure} + + +\AddCoupledCounters[name=figuretablebundle]{figure} + +\addcontentsline{lof}{section}{After using AddCoupledCounters for figure again} + +\begin{figure}[!ht] +\caption{Even most foobar figure} +\end{figure} + +\begin{table}[!ht] +\caption{Another coupled table} +\end{table} + +\begin{figure}[!ht] +\caption{Another coupled figure} +\end{figure} + + +\ClearAllCoupledCounters +\clearpage + +\addcontentsline{lof}{section}{After using ClearAllCoupledCounters} +\addcontentsline{lot}{section}{After using ClearAllCoupledCounters} + +\begin{figure}[!ht] +\caption{Almost next to last figure} +\end{figure} + + +\begin{table}[!ht] +\caption{Almost next to last table} +\end{table} + +\begin{figure}[!ht] + \caption{Next to last figure} +\end{figure} + +\begin{table}[!ht] + \caption{Next to last table} +\end{table} + + + +\AddCoupledCounters[name=figuretablebundle]{figure,table} +\addcontentsline{lof}{section}{After using AddCoupledCounters} +\addcontentsline{lot}{section}{After using AddCoupledCounters} + + +\begin{figure}[!ht] +\caption{The last figure} +\end{figure} + +\begin{table}[!ht] +\caption{The last table} +\end{table} + + + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf index 6f13d5f9c54..45cedfbe713 100644 Binary files a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex index fbe9a1f4777..4fc5cf8a3da 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex @@ -1,9 +1,9 @@ -%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) %% Documentation file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016 by Dr. Christian Hupfer +%% Copyright (c) 2015 -- 2016 by Dr. Christian Hupfer %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -19,7 +19,7 @@ %% %% -\documentclass[12pt,a4paper]{article} +\documentclass[12pt,a4paper,oneside]{article} @@ -75,9 +75,9 @@ } -\@namedef{xassoccntversion0.1}{v0.1 2016-11-07} +\@namedef{xassoccntversion0.1}{v0.1 2015-11-07} -\@namedef{xassoccntversion0.2}{v0.2 2016-11-14} +\@namedef{xassoccntversion0.2}{v0.2 2015-11-14} \@namedef{xassoccntversion0.3}{v0.3 2016-01-08} @@ -91,7 +91,10 @@ \@namedef{xassoccntversion0.8}{v0.8 2016-06-10} -\@namedef{xassoccntversion0.9}{v0.9 2016-06-18} +\@namedef{xassoccntversion0.9}{v0.9 2016-06-19} + + +\@namedef{xassoccntversion1.0}{v1.0 2016-07-28} \makeatother @@ -302,10 +305,13 @@ \usepackage[autodefinecounters=true]{xassoccnt} \usepackage{amsmath} \usepackage{amssymb} +\usepackage{minitoc} +\usepackage{tocbibind} \usepackage{bookmark} \usepackage{cleveref} \usetikzlibrary{mindmap} +\setcounter{tocdepth}{3} \newcommand{\PackageDocName}{xassoccnt}% @@ -313,6 +319,7 @@ christian.hupfer@yahoo.de } +\doparttoc \let\DeclareAssociatedCountersOrig\DeclareAssociatedCounters % -> for use in examples only @@ -355,6 +362,9 @@ pdfauthor={PACKAGEAUTHOR}, pdfsubject={Documentation of \PackageDocName\ package}, pdfkeywords={LaTeX, counters}, + bookmarksopen=true, + bookmarksopenlevel=4, + bookmarksnumbered=true, pdfcreator={LaTeX} } @@ -384,7 +394,7 @@ 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} -\CHPackageTitlePage[packageauthor={Christian Hupfer}]{Associated counters stepping simultaneously} +\CHPackageTitlePage[packageauthor={Christian Hupfer}]{Associated counters stepping simultaneously\\ (and other gadgets)} \clearpage @@ -400,6 +410,10 @@ \setcounter{footnote}{0} +\part{Introduction} + +\parttoc + \section*{Preface} This package is the successor and a complete rewrite of \CHDocPackage{assoccnt}. Not all features of that package are implemented yet -- if some functionality of your document depends on \CHDocPackage{assoccnt}, continue using the older version and shift gradually to \CHDocPackage{\PackageDocName} please. @@ -518,379 +532,360 @@ As of version \packageversion\ \CHDocPackage{\PackageDocName} supports the packa \end{docKey} -\section{Documentation of Macros} -\tcbset{color command={blue}} +\clearpage +\part{Tools for counters} -The main purpose of this package is co-stepping of counters, but there are some helper commands in addition to macros provided \LaTeXe\ already, see section \nameref{section::additions_to_l2e}. +\parttoc -\begin{itemize} - \item Section \nameref{subsection::associatedcounterscmds} describes the most important macros for setting up associated counters - \item Section \nameref{subsection::drivercounterscmds} informs about the macros for setting up, removing or clearing driver counters - \item Section \nameref{subsection::querycmds} deals with query command sequences about counters being a driver or an associated counters - \item Section \nameref{subsection::informationcmds} contains routines that show which counters have been changed last -\end{itemize} +\section[Additions 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} -\subsection[Association macros]{Associated counters commands}\label{subsection::associatedcounterscmds} +\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. -All macros have the general rule, that the driver counter is specified as 1st mandatory argument to the macro, which is in almost all cases the 2nd argument of the macro. +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} -\begin{docCommand}{DeclareAssociatedCounters}{\oarg{options}\marg{driver counter}\marg{associated counters list}} -This command is the main macro of the package. It declares the counter names being specified in comma - separated - list (CSV) which should be stepped simultaneously when the driver counter is increased by \cs{stepcounter}. If only counter is to be associated, omit a trailing ","! +\end{docCommand} + -%\begin{docCommandArgs}{DeclareAssociatedCounters} +\subsection[\LaTeXe\ additions]{Additions to \LaTeXe\ commands} -\begin{codeoptionsenum} - \item \oarg{options}: %As of \packageversion, the optional argument \oarg{options} is not used so far, but is reserved for later purposes. - \begin{docKey}[][]{autodefine}{=\meta{choice}}{initially none} - This choice - key can be specified if the specified counters should be defined if they not already available. - Possible values are - \begin{itemize} - \item \texttt{none} -- no counter is autodefined - \item \texttt{all} -- all counters will be autodefined - \item \texttt{driver} -- only driver counters will be autodefined - \item \texttt{associated} -- only associated counters will be autodefined - \end{itemize} - \end{docKey} - Default is \texttt{none} - \begin{docKey}[][]{sloppy}{}{} - If \refKey{autodefine} key is used, the \texttt{sloppy} key disables the check whether a counter is defined already. - \end{docKey} +\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. + + \begin{docKey}{initial}{=\meta{integer value}}{initially 0} + This is used for the start value of the new counter. + \end{docKey} - \item \marg{driver counter} +\end{docCommand}% - Holds the name of the driver counter to which the list of counters should be associated -\item \marg{associated counters list} +\begin{docCommand}{DeclareDocumentCounter}{\oarg{options}\marg{counter}\oarg{resetting counter}} + This command is the preamble-only version of \refCom{NewDocumentCounter}. +\end{docCommand}% - A comma separated list of counter names that should be associated to the driver counter -\end{codeoptionsenum} -%\end{docCommandArgs} +\begin{docCommand}{SetDocumentCounter}{\oarg{options}\marg{counter}\marg{counter value}} -\begin{itemize} -\item This command is a preamble command, i.e. it can be used in the preamble of the document or within other packages or class files only. -\item This command should be used as early as possible, i.e. in the preamble of the document, since the driven counters are not increased as long as they are not associated to the driver counter. On the hand, it is possible or may be required to control the starting point of the association at any position in the body of the document, when the association should start later on. Use the command \refCom{AddAssociatedCounters} if counters should be associated within the document body. -\end{itemize} +This command behaves like the standard macro \cs{setcounter}, but has an additional optional 1st argument. %which is not used as of version \packageversion. +% This optional argument can be used to enable the setting of the driver counter value as well as the associated counter values at once. +\begin{docCommandArgs}{SetDocumentCounter}% -% Relax for documentation purposes -\renewcommand{\DeclareAssociatedCounters}[3][]{\relax}% -\begin{dispExample} -%%%% The association of anothertotalpages in this example just takes place here, so the stepping of the counter will start from here and providing a 'wrong' value. -%%%% -\DeclareAssociatedCounters{page}{totalpages,anothertotalpages}% -This document has \number\totvalue{totalpages} (note: \number\totvalue{anothertotalpages}) pages. -\end{dispExample} -\begin{itemize} - \item Current version (\packageversion) rules: - \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! - \CHDocUpdate{0.6} +\begin{codeoptionsenum} + \item \oarg{options}: %As of version \packageversion, this option is not used% the key value argument - 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. + \begin{docKey}{associatedtoo}{=\meta{true/false}}{initially false} + If enabled (\meta{true}), \refCom{SetDocumentCounter} will use the counter value for \underline{all} counters associated to this driver counter as well. Initially, this option is set to \meta{false}. + \end{docKey} + + \begin{docKey}{onlycounters}{=\meta{comma separated list of counters}}{initially empty} + If this key is used, only those associated counters are set as well that are given in the comma separated list. + + Names, that are either not referring to counters at all or to counters that are not associated to the given driver counter will be ignored silently. + \end{docKey} - A contrary feature are the \CHDocTag{coupled counters} -- If some counters should share a common base, i.e. increasing one arbitrary member counter of a group of counters then all should be increased, this called coupling of counters -- all group members are on an equal footing. See \cref{sec::coupledcounters} about this feature. + - On the other side, \CHDocTag{associated counters} belong to a hierarchy. The driver counter dominates the associated counters. - - \end{itemize} - \item A self-association of the driver counter to itself is ignored internally as this would lead to inconsistent counter values. - \item The order of the specification of associated counters in the 2nd arguments is of no importance. - \item Specifing an associated counter name multiple times has no effect, only the first occurence of the name will be used. -\end{itemize} -\end{docCommand} + \item \marg{counter} + Holds the name of the (driver) counter to be set. + \item \marg{counter value} + Holds the value to be set + \end{codeoptionsenum} +\end{docCommandArgs} -\begin{docCommand}{AddAssociatedCounters}{\oarg{options}\marg{driver counter}\marg{associated counters list}} -The usage of this macro is similar to \refCom{DeclareAssociatedCounters}; if it is called in the document preamble (or in package file), \refCom{AddAssociatedCounters} falls back to -\begin{center}\refCom{DeclareAssociatedCounters},\end{center} having the same optional argument functionality with \refKey{autodefine} and \refKey{sloppy}; if it is called in the document body, this command adds some counters to the associated counter list for a specific driver counter -- if this list does not exists, the \LaTeX{} run will issue a warning, but add the driver counter to the driver list and the associated counters analogously. -\marginnote{\bcbombe} +Some notes on \refCom{SetDocumentCounter} +\begin{itemize} + \item The option keys \refKey{associatedtoo} and \refKey{onlycounters} are mutually exclusive! % + \item The counter to be set can be either a driver counter or an otherwise associated counter. +\end{itemize} +\end{docCommand}% -Using \refCom{AddAssociatedCounters} in the document body automated generation of counters is disabled. +\begin{docCommand}{StepDownCounter}{\oarg{options}\marg{counter}}\CHDocNew{0.4} -% You have to use \refCom{DeclareAssociatedCounters} first, to set up the driver counter hook. +This macro subtracts the value of 1 from the counter and is the counterpart of \cs{stepcounter}. +\begin{docCommandArgs}{StepDownCounter}% -\begin{docCommandArgs}{AddAssociatedCounters} \begin{codeoptionsenum} - \item \oarg{options}: As of version \packageversion, the optional argument \oarg{options} are the same as for \refCom{DeclareAssociatedCounters}, see \refKey{autodefine} and \refKey{sloppy}. - - \item \marg{driver counter} - - Holds the name of the driver counter to which the list of counters should be associated - \item \marg{associated counters list} - - A comma separated list of counter names that should be associated to the driver counter -\end{codeoptionsenum} + \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument + \item \marg{counter} + Holds the name of the first counter. + \end{codeoptionsenum} \end{docCommandArgs} +\end{docCommand}% -% macro of the package. It declares the counter names being specified in comma - separated - list (CSV) which should be stepped simultaneously when the driver counter is increased by \cs{stepcounter}. -\end{docCommand}% +\begin{docCommand}{SubtractFromCounter}{\oarg{options}\marg{counter}\marg{delta value}}\CHDocNew{0.4} -\begin{docCommand}{RemoveAssociatedCounter}{\marg{driver counter}\marg{associated counter}} -This command removes a counter from the existing list for a driver counter, i.e. the counter will not be increased any longer by \cs{stepcounter}. It can be increased however manually, of course. -\end{docCommand} +This macro subtracts the (positive) delta value from the counter and is the counterpart of \cs{addtocounter} +\begin{docCommandArgs}{SubtractFromCounter}% -\begin{dispExample} -\RemoveAssociatedCounter{page}{anothertotalpages} -This document has \number\totvalue{totalpages} (beware: \number\totvalue{anothertotalpages}) pages. -\end{dispExample} +\begin{codeoptionsenum} + \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument + \item \marg{counter 1} + Holds the name of the first counter. + \item \marg{delta value} + Holds the (positive) value to be subtracted from the counter value. + \end{codeoptionsenum} +\end{docCommandArgs} +\end{docCommand}% -\begin{docCommand}{RemoveAssociatedCounters}{\marg{driver counter}\marg{list of associated counters}} -This command removes the comma-separated-value list of counters from the existing list for a driver counter, i.e. the counters will not be increased any longer by \cs{stepcounter}. They can be increased however manually, of course. -Take care not to confuse the commands \refCom{RemoveAssociatedCounters} -and{}\linebreak \refCom{RemoveAssociatedCounter} -\end{docCommand} +\begin{docCommand}{CopyDocumentCounters}{\oarg{options}\marg{source counter}\marg{target counter}} -\begin{docCommand}{ClearAssociatedCounters}{\oarg{options}\marg{driver counter}} -This command clears the internal list for all counters associated to the \marg{driver counter}. The counters will not be increased automatically any longer. +This document copies the counter value from the source counter in argument 2 to the target counter in argument 3. -The optional argument is not used as of version \packageversion. +\begin{docCommandArgs}{CopyDocumentCounters}% -Please note that the driver counter is not removed from the list of driver counters -- this simplifies reassociating of (other) counters to this one later on with the macro \refCom{AddAssociatedCounters} and suppress the relevant warning. -If the driver counter and all its associated counters should be removed, use \refCom{RemoveDriverCounter} instead. -\end{docCommand} +\begin{codeoptionsenum} + \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument + \item \marg{source counter} + Holds the name of the source counter. + \item \marg{target counter} + Holds the name of the target counter. + \end{codeoptionsenum} +\end{docCommandArgs} -\clearpage +\end{docCommand}% -\subsection[Driver macros]{Driver counter commands} \label{subsection::drivercounterscmds} +\begin{docCommand}{SwapDocumentCounters}{\oarg{options}\marg{counter 1}\marg{counter 2}} +This macro swaps the values of the counters given in arguments 2 and 3 -\begin{docCommand}{AddDriverCounter}{\oarg{options}\marg{driver counter name}} +\begin{docCommandArgs}{SwapDocumentCounters}% -\begin{docCommandArgs}{AddDriverCounter}% \begin{codeoptionsenum} -\item \oarg{options}: As of \packageversion, the optional argument \oarg{options} is not used so far, but is reserved for later purposes. - - \item \marg{driver counter name} + \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument - Holds the name of the driver counter that should be added to the list of driver counters. -\end{codeoptionsenum} + \item \marg{counter 1} + Holds the name of the first counter. + \item \marg{counter 2} + Holds the name of the second counter. + \end{codeoptionsenum} \end{docCommandArgs} \end{docCommand}% +\begin{docCommand}{SyncCounters}{\oarg{options}\marg{driver counter}} -\begin{docCommand}{RemoveDriverCounter}{\oarg{options}\marg{driver counter}} -This command clears the internal list for all counters associated to the \marg{driver counter}. The counters will not be increased automatically any longer. +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. -The optional argument is not used as of version \packageversion. +\begin{docCommandArgs}{SyncCounters}% -If all driver counters should be unregistered, use \refCom{ClearDriverCounters} instead! -\end{docCommand} +\begin{codeoptionsenum} + \item \oarg{options}: see \refCom{SetDocumentCounter} -\begin{docCommand}{ClearDriverCounters}{\oarg{options}}% + \item \marg{source counter} + Holds the name of the source counter. + \end{codeoptionsenum} +\end{docCommandArgs} -This clears completely the list of driver counters, such that no counters are regarded as being associated -- i.e. no driver is hold as being a driver counter. +\end{docCommand}% -The optional argument is not used as of version \packageversion. +\begin{dispExample}%[breakable=true] + \SetDocumentCounter{foocntr}{17} + \SetDocumentCounter{foobarcntr}{20} -\end{docCommand} +\begin{itemize} +\item Displaying counters + \thefoocntr\ and \thefoobarcntr +\item Swapping counters -\subsection[Query macros]{Commands for queries} \label{subsection::querycmds} + \SwapDocumentCounters{foocntr}{foobarcntr} -Sometimes it might be necessary to get information, whether a counter is regarded as a driver or as an associated counter. This section describes some query macros in order to obtain this information. + \thefoocntr\ and \thefoobarcntr +\item Step down counters -\begin{docCommand}{IsAssociatedToCounter}{\marg{driver counter}\marg{associated counter}\marg{True branch}\marg{False branch}} -This macro checks, whether a counter is associated to a particular given driver counter and expands the corresponding branch. If the internal driver counter list does not exist, the false branch will be used, since this also means, that the possibly associated counter is not associated at all. +\StepDownCounter{foocntr} +\StepDownCounter{foobarcntr} + \thefoocntr\ and \thefoobarcntr +\item Subtracting some value from the counters + \SubtractFromCounter{foocntr}{5} + \SubtractFromCounter{foobarcntr}{10} -\begin{docCommandArgs}{IsAssociatedToCounter}% + \thefoocntr\ and \thefoobarcntr +\end{itemize} +\end{dispExample} -\begin{codeoptionsenum} - \item \marg{driver counter} - Holds the name of the driver counter to which \marg{associated counter} the could possibly be associated. -\item \marg{associated counter} +\subsection[\protect\cs{IfIsDocumentCounter}-Queries]{Commands checking whether a name refers to a counter} - Contains the name of the possibly associated counter. +\CHDocPackage{\PackageDocName}\ provides three commands that are quite similar -- all check whether \marg{name} is an already defined \LaTeXe\ counter (name), in good tradition with the \CHDocPackage{xparse} - syntax: -\item \marg{True branch} +\begin{itemize} +\item \begin{docCommand}{IfIsDocumentCounterTF}{\oarg{}\marg{name}\marg{true branch}\marg{false branch}} +This macro performs the full branching +\end{docCommand} +\item - This code is expanded if the counter is associated to the driver, otherwise it is ignored. - -\item \marg{True branch} - - This code is expanded if the counter is \textbf{not} associated to the driver, otherwise it is ignored. - -\end{codeoptionsenum} -\end{docCommandArgs} - - -\begin{dispExample} -% Remove associated counter first for demonstration purposes -\RemoveAssociatedCounter{page}{anothertotalpages} -\IsAssociatedToCounter{page}{totalpages}{Yes, totalpages is associated}{No, totalpages is not associated} - -\IsAssociatedToCounter{page}{anothertotalpages}{Yes, anothertotalpages is associated}{No, anotherpages is not associated} -\end{dispExample} +\begin{docCommand}{IfIsDocumentCounterT}{\oarg{}\marg{name}\marg{\meta{long} true branch}} +This command executes only if the name is a counter. +\end{docCommand} -See also +\begin{docCommand}{IfIsDocumentCounterF}{\oarg{}\marg{name}\marg{true branch}} +This command executes only if the name is not a counter. +\end{docCommand} -\begin{itemize} - \item \refCom{IsAssociatedCounter} for checking whether a counter is associated - \item \refCom{IsDriverCounter} in order to check whether a counter is a driver. - \item \refCom{GetDriverCounter} returns the driver counter name for a given associated counter name \end{itemize} +The optional argument is not used as of version \packageversion\ for none of those three commands. -\end{docCommand} +\subsection[Information macros]{Information on counters} \label{subsection::informationcmds} -\begin{docCommand}{GetDriverCounter}{\marg{counter name}}% +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: -This commands returns the driver counter to which the counter name of the first argument is connected to. If the counter is not defined, the macro returns nothing. +\begin{docCommand}{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{itemize} - \item No check whether the counter name is defined is performed - \item No check whether the counter is associated at all is performed. Usage of this command in conjunction with \refCom{IsAssociatedCounter} is strongly encouraged. -\end{itemize} +\begin{dispExample} + \newcounter{SomeCounter} + + \addtocounter{SomeCounter}{10} + The last counter something added to was \LastAddedToCounter. +\end{dispExample}% +\end{docCommand}% -\begin{dispExample}% -totalpages is associated to the \textcolor{blue}{\textbf{\GetDriverCounter{totalpages}}} counter. -% Try with an undefined counter name -humptydumpty is associated to the \textcolor{blue}{\textbf{\GetDriverCounter{humptydumpty}}} counter. +\begin{marker} + Please note that \refCom{LastAddedToCounter} might fail! +\end{marker} -\end{dispExample}% -\end{docCommand}% +\begin{docCommand}{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} -\begin{docCommand}{IsAssociatedCounter}{\marg{counter name}\marg{True branch}\marg{False branch}}% + The last counter being stepped was \LastSteppedCounter. +\end{dispExample}% -This commands tests, whether a given counter name is an associated counter and expands correspondingly the true or the false branch. The command does not tell to which driver the counter it is associated -- this information can be obtained by \refCom{GetDriverCounter}. +\end{docCommand}% -\begin{docCommandArgs}{IfAssociatedCounter}% +\begin{docCommand}{LastRefSteppedCounter}{} -\begin{codeoptionsenum} -\item \marg{counter name}% +\begin{dispExample} + \begin{equation} + E = mc^2 \label{eq::einstein} + \end{equation} + % \stepcounter{SomeCounter} - Contains the name of the possibly associated counter + The last counter being refstepped was \LastRefSteppedCounter. +\end{dispExample}% -\item \marg{True branch} +\end{docCommand}% - This code is expanded if the counter is associated to a driver, otherwise it is ignored -\item \marg{True branch} - This code is expanded if the counter is \textbf{not} associated a driver, otherwise it is ignored -\end{codeoptionsenum} -\end{docCommandArgs} +\begin{docCommand}{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} -\IsAssociatedCounter{section}{Yes, section is an associated counter}{No, section counter does not have the associated counter properties} -\IsAssociatedCounter{totalpages}{Yes, totalpages is an associated counter}{No, totalpages counter does not have the associated counter properties} -\end{dispExample} - -\end{docCommand}% + \setcounter{SomeCounter}{21}% + The last counter being set was \LastSetCounter. +\end{dispExample}% +\end{docCommand}% -\begin{docCommand}{IsDriverCounter}{\marg{driver counter name}\marg{True branch}\marg{False branch}}% -This commands tests, whether a given counter name is a driver counter and expands correspondingly the true or the false branch. +\begin{docCommand}{LastCounterValue}{} +This command has no arguments and expands to the value of the very last change of a counter, i.e. using \cs{setcounter} etc. -\begin{docCommandArgs}{IfDriverCounter}% +\begin{dispExample} + \setcounter{SomeCounter}{100}% -\begin{codeoptionsenum} -\item \marg{driver counter name}% + The last counter being set was \LastSetCounter and it had the value \LastCounterValue{} then, where as \stepcounter{equation} will yield \fbox{\LastSteppedCounter} and \LastCounterValue! +\end{dispExample}% - Contains the name of the possible driver counter +The usage of \refCom{LastSetCounter} is best together with one of the other \cs{Last...} macros. -\item \marg{True branch} +\end{docCommand}% - This code is expanded if the counter is a driver, otherwise it is ignored +\begin{marker} +All of the \cs{Last...} macros are expandable, i.e. it is possible to store the value to an macro defined with \cs{edef} +\end{marker} -\item \marg{True branch} +\begin{dispExample} + \setcounter{SomeCounter}{50}% - This code is expanded if the counter is \textbf{not} a driver, otherwise it is ignored -\end{codeoptionsenum} -\end{docCommandArgs} + \edef\lastcounterset{\LastSetCounter} + \edef\lastcountervalue{\LastCounterValue} + + \setcounter{equation}{81}% -\begin{dispExample} -\IsDriverCounter{section}{Yes, section is a driver counter}{No, section counter does not have driver properties} -\end{dispExample} + The last counter being set was \fbox{\LastSetCounter} and it had the value \LastCounterValue{} then, but we changed \lastcounterset{} earlier and it had the value \lastcountervalue{} then. +\end{dispExample}% -\end{docCommand}% +\setcounter{equation}{1} -\begin{docCommand}{IsSuspendedCounter}{\marg{counter name}\marg{true branch}\marg{false branch}} -See \nameref{section::suspendedresumedcounters} on this topic. -This command checks, whether a counter is suspended, i.e. not updated at all and expands the corresponding branches. -%\begin{docCommandArgs}{IfSuspendedCounter}% -\begin{codeoptionsenum} -\item \marg{counter name}% +\begin{marker} +Please note, that all of this commands are only working in the current run of compilation, i.e. \underline{after} there has been some operation on the counters. They can't be used for information on the last changed counter in a previous run. +\end{marker} - Contains the name of counter presumed to be suspended -\item \marg{True branch} - This code is expanded if the counter is suspended, otherwise it is ignored -\item \marg{True branch} - This code is expanded if the counter is \textbf{not} suspended, otherwise it is ignored +\section{Counter reset lists} -\end{codeoptionsenum} -%\end{docCommandArgs} +The package \CHDocPackage{chngcntr} offers the possibility of add or remove counters to the reset list of a driver counter with the commands \cs{counterwithin} and \cs{counterwithout}, whereas the package \CHDocPackage{remreset} provides \cs{@removefromreset} as a counterpart to the \LaTeXe\ core command \cs{@addtoreset} macro. +\subsection[Addition and Removal]{Addition and Removal of counters from the reset list}\CHDocNew{1.0} +\begin{docCommand}[before={\CHDocNew{1.0}}\par]{RemoveFromReset}{\marg{counter name}\marg{driver counter name}} +This macro removes the counter given in the first argument from the reset list of the driver counter given in the 2nd argument. +If the 2nd argument does not point to a LaTeXe\ counter name an error message is shipped and the compilation fails. \end{docCommand} -\subsubsection[\cs{IfIsDocumentCounter}-Queries]{Commands checking whether a name refers to a counter} - -\CHDocPackage{\PackageDocName}\ provides three commands that are quite similar -- all check whether \marg{name} is an already defined \LaTeXe\ counter (name), in good tradition with the \CHDocPackage{xparse} - syntax: +\begin{docCommand}[before={\CHDocNew{1.0}}]{RemoveFromFullReset}{\marg{counter name}\marg{driver counter name}} +This macro removes the counter given in the first argument and all of its own reset list from the reset list of the driver counter given in the 2nd argument. -\begin{itemize} -\item \begin{docCommand}{IfIsDocumentCounterTF}{\oarg{}\marg{name}\marg{true branch}\marg{false branch}} -This macro performs the full branching +If the 2nd argument does not point to a LaTeXe\ counter name an error message is shipped and the compilation fails. \end{docCommand} -\item -\begin{docCommand}{IfIsDocumentCounterT}{\oarg{}\marg{name}\marg{\meta{long} true branch}} -This command executes only if the name is a counter. -\end{docCommand} +\begin{docCommand}[before={\CHDocNew{1.0}}]{AddToReset}{\marg{counter name}\marg{driver counter name}} +This macro adds the counter given in the first argument to the reset list of the driver counter given in the 2nd argument. -\begin{docCommand}{IfIsDocumentCounterF}{\oarg{}\marg{name}\marg{true branch}} -This command executes only if the name is not a counter. +If the 2nd argument does not point to a LaTeXe\ counter name an error message is shipped and the compilation fails. \end{docCommand} -\end{itemize} - -The optional argument is not used as of version \packageversion\ for none of those three commands. - -\subsection[Macros about the reset list]{Information macros about the counter reset list} +\subsection[Information macros about the reset list]{Information macros about the counter reset list} Sometimes it might be necessary or convenient to know how many counters are on a reset list of some other counters, i.e. added by \cs{newcounter}\textbraceleft counter\textbraceright[resetting counter] or \refCom{NewDocumentCounter}. @@ -908,6 +903,20 @@ This macro returns the number of counters being in the reset list of the counter If the counter has no other counters in its reset list, the value of 0 is returned. \end{docCommand} + +\begin{docCommand}[before={\CHDocNew{1.0}}\par]{CounterFullResetList}{\marg{counter name}} + This macro determines the full reset list of a counter as well of the counters being on the reset list, i.e. the list is tracked down until there are no counters left in a recursion. + + The counter names are stored internally in \CHDocPackage{expl3} - \cs{seq} - variable named \cs{xy\_fullresetlist\_seq} -- the \meta{xy} is replaced by the counter name, e.g. if the counter is named \CHDocCounter*{foo}, the identifier would be \cs{foo\_fullresetlist\_seq}. Unless \CHDocTag{expl3} features are not applied, the \refCom{CounterFullResetList} is not really useful on a document or package/class developing level. However, to loop through the full reset list with some action performed on the members of the sequence, the command \refCom{LoopFullCounterResetList} may be very useful. + +\begin{marker} +\begin{itemize} +\item The driver counter \CHDocCounter*{foo} is not added to the relevant sequence. +\item If the name given to \refCom{CounterFullResetList} does not indicate a \LaTeXe\ counter an error message is shipped and the compilation fails. +\end{itemize} +\end{marker} +\end{docCommand} + \begin{docCommand}{IfInResetListTF}{\oarg{}\marg{resetting counter}\marg{reset counter}\marg{true branch}\marg{false branch}} This command sequence tests whether the counter \meta{reset counter} is in the reset list of \meta{resetting counter} and expands the relevant branch then. See the short-circuit commands \refCom{IfInResetListT} and \refCom{IfInResetListF} as well. @@ -946,528 +955,748 @@ This command displays the reset list of a counter on the terminal as the \cs{sho \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. -\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: - -\begin{docCommand}{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} - \newcounter{SomeCounter} - - \addtocounter{SomeCounter}{10} - The last counter something added to was \LastAddedToCounter. -\end{dispExample}% -\end{docCommand}% +All macros concerning this feature use the first macro argument having a comma-separated list of counters. Whether there's a second argument depends on the specific nature of the operation that should be performed. \begin{marker} - Please note that \refCom{LastAddedToCounter} might fail! +\begin{itemize} +\item As of version \packageversion\ \PackageDocName\ does not check whether the names given in the first argument refer to counters. +\item All macros use the extended counter macros, i.e. are aware of associated counters and step them too if their driver counter is given in the argument list. If an associated counter itself is given in the list, this one is stepped or operated on too! +\end{itemize} \end{marker} -\begin{docCommand}{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}% +\begin{docCommand}[before={\CHDocNew{0.7}}]{LoopAddtoCounters}{\marg{counter1, counter2,\dots}\marg{counter increment/decrement}} -\end{docCommand}% +%\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}. -\begin{docCommand}{LastRefSteppedCounter}{} +\begin{codeoptionsenum} + \item \marg{counter1, counter2,\dots} + Holds the comma separated list of counter names + \item \marg{counter increment/decrement} + Specifies the value to be added or subtracted -\begin{dispExample} - \begin{equation} - E = mc^2 \label{eq::einstein} - \end{equation} - % \stepcounter{SomeCounter} + No check is performed whether \textbf{is} or \textbf{expands} to an integer value. + \end{codeoptionsenum} +%\end{docCommandArgs} - The last counter being refstepped was \LastRefSteppedCounter. -\end{dispExample}% +\end{docCommand} -\end{docCommand}% +\begin{docCommand}[before={\CHDocNew{0.7}}]{LoopResetCounters}{\marg{counter1, counter2,\dots}} +%\begin{docCommandArgs}{LoopResetCounters}% +All counters given in the first argument are set to zero using the regular \cs{setcounter}. This is a shorthand version of \refCom{LoopSetCounters} for this specific case. -\begin{docCommand}{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{codeoptionsenum} + \item \marg{counter1, counter2,\dots} + Holds the comma separated list of counter names + \end{codeoptionsenum} +%\end{docCommandArgs} -\begin{dispExample} - \setcounter{SomeCounter}{21}% +\end{docCommand} - The last counter being set was \LastSetCounter. -\end{dispExample}% -\end{docCommand}% +\begin{docCommand}[before={\CHDocNew{0.7}}]{LoopRefstepCounters}{\marg{counter1, counter2,\dots}} +%\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. -\begin{docCommand}{LastCounterValue}{} -This command has no arguments and expands to the value of the very last change of a counter, i.e. using \cs{setcounter} etc. +\begin{marker} + This macro is meant only to complete the number of \cs{Loop...Counters} but is not regarded as being really useful. +\end{marker} -\begin{dispExample} - \setcounter{SomeCounter}{100}% +\begin{codeoptionsenum} + \item \marg{counter1, counter2,\dots} + Holds the comma separated list of counter names + \end{codeoptionsenum} +%\end{docCommandArgs} - The last counter being set was \LastSetCounter and it had the value \LastCounterValue{} then, where as \stepcounter{equation} will yield \fbox{\LastSteppedCounter} and \LastCounterValue! -\end{dispExample}% +\end{docCommand} -The usage of \refCom{LastSetCounter} is best together with one of the other \cs{Last...} macros. -\end{docCommand}% -\begin{marker} -All of the \cs{Last...} macros are expandable, i.e. it is possible to store the value to an macro defined with \cs{edef} -\end{marker} +\begin{docCommand}[before={\CHDocNew{0.7}}]{LoopSetCounters}{\marg{counter1, counter2,\dots}\marg{new counter value}} -\begin{dispExample} - \setcounter{SomeCounter}{50}% +%\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}. - \edef\lastcounterset{\LastSetCounter} - \edef\lastcountervalue{\LastCounterValue} - - \setcounter{equation}{81}% +\begin{codeoptionsenum} + \item \marg{counter1, counter2,\dots} + Holds the comma separated list of counter names + \item \marg{new counter value} + Specifies the value to be set. + No check is performed whether \textbf{is} or \textbf{expands} to an integer value. + \end{codeoptionsenum} +%\end{docCommandArgs} - The last counter being set was \fbox{\LastSetCounter} and it had the value \LastCounterValue{} then, but we changed \lastcounterset{} earlier and it had the value \lastcountervalue{} then. -\end{dispExample}% +\end{docCommand} -\setcounter{equation}{1} +\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}. +\begin{codeoptionsenum} + \item \marg{counter1, counter2,\dots} + Holds the comma separated list of counter names + \end{codeoptionsenum} +\end{docCommandArgs} +\end{docCommand} -\begin{marker} -Please note, that all of this commands are only working in the current run of compilation, i.e. \underline{after} there has been some operation on the counters. They can't be used for information on the last changed counter in a previous run. -\end{marker} +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}} \CHDocNew{0.7} -\section[Suspending and Resuming]{Suspending and resuming (associated) counters}\label{section::suspendedresumedcounters} +\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. +\begin{codeoptionsenum} + \item \marg{counter1, counter2,\dots} + Holds the comma separated list of counter names + \item A macro name that is to be called and that operates on a counter. + \end{codeoptionsenum} +\end{docCommandArgs} +\end{docCommand} -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. -\CHDocNew{0.8} -\begin{marker} - Suspension and resuming counters can cause wrong hyper links if \CHDocPackage{hyperref} is used. -\end{marker} +\begin{dispExample} + % We assume we have the counters foocntr and foobarcntr + \newcommand{\showcountervalues}[2]{% + \textcolor{#1}{\csname the#2\endcsname}% Now, an extra empty line to show the values in rows + + } + % Note that the 2nd argument is not given here -- it's added by the \LoopCountersFunction macro + \LoopCountersFunction{foocntr,foobarcntr}{\showcountervalues{blue}} +\end{dispExample} -\begin{docCommand}{SuspendCounters}{\oarg{options}\marg{counters list}}% -\begin{docCommandArgs}{SuspendCounters}% +\begin{docCommand}[before={\CHDocNew{1.0}}\par]{LoopFullCounterResetList}{\marg{counter name}\marg{counter operation macro}} +This macro determines the full reset list of a counter, i.e. it cascades down the reset list and tracks the reset lists of all 'sub'-counters too and performs the counter operation macro on this. \begin{codeoptionsenum} -\item \oarg{options}% - - Not used so far, reserved for later usage. + \item \marg{counter name} -\item \marg{counters list}% + Holds the comma separated list of counter names + \item \marg{counter operation macro} + A macro name that is to be called and that expects the name of a counter as the last argument. + \end{codeoptionsenum} - Contains the name of counters to be suspended, separated by commas (CSV - list) -\end{codeoptionsenum} -\end{docCommandArgs} -\end{docCommand}% +See the macro \refCom{CounterFullResetList} for more information about the internal storage of the full reset list. -\begin{docCommand}{CascadeSuspendCounters}{\oarg{options}\marg{counters list}}\CHDocNew{0.8} +\end{docCommand} -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. + +\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} - 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. +None of the commands checks whether the argument refers to counter name. \end{marker} +\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. -\begin{docCommandArgs}{CascadeSuspendCounters}% +\end{docCommand} -\begin{codeoptionsenum} -\item \oarg{options}% +\begin{docCommand}{hexValue}{\marg{counter name}} \CHDocNew{0.7} - Not used so far, reserved for later usage. +This command will print the value of the counter using lowercase hexadecimal digits. -\item \marg{counters list}% +\end{docCommand} - Contains the name of counters to be suspended, separated by commas (CSV - list) -\end{codeoptionsenum} -\end{docCommandArgs} -\end{docCommand}% +\begin{docCommand}{HexValue}{\marg{counter name}} \CHDocNew{0.7} +This command will print the value of the counter using uppercase hexadecimal digits. -\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}} \CHDocNew{0.8} - As of version \packageversion\ the optional argument is not used and reserved for later purposes. - This command revokes all suspended counters. +\begin{docCommand}{OctalValue}{\marg{counter name}} \CHDocNew{0.7} + +This command will print the value of the counter using uppercase hexadecimal digits. + \end{docCommand} -\begin{marker} -If a driver counter is suspended, all counters associated to it are suspended too! -\end{marker} +\clearpage +\part{Features} -\setcounter{totalequations}{0} -\setcounter{equation}{0} +\parttoc + +\section{Associated counters} +\tcbset{color command={blue}} + +The main purpose of this package is co-stepping of counters, but there are some helper commands in addition to macros provided \LaTeXe\ already, see section \nameref{section::additions_to_l2e}. + +\begin{itemize} + \item Section \nameref{subsection::associatedcounterscmds} describes the most important macros for setting up associated counters + \item Section \nameref{subsection::drivercounterscmds} informs about the macros for setting up, removing or clearing driver counters + \item Section \nameref{subsection::querycmds} deals with query command sequences about counters being a driver or an associated counters + \item Section \nameref{subsection::informationcmds} contains routines that show which counters have been changed last +\end{itemize} + + + +\subsection[Association macros]{Associated counters commands}\label{subsection::associatedcounterscmds} + +All macros have the general rule, that the driver counter is specified as 1st mandatory argument to the macro, which is in almost all cases the 2nd argument of the macro. + + +\begin{docCommand}{DeclareAssociatedCounters}{\oarg{options}\marg{driver counter}\marg{associated counters list}} +This command is the main macro of the package. It declares the counter names being specified in comma - separated - list (CSV) which should be stepped simultaneously when the driver counter is increased by \cs{stepcounter}. If only counter is to be associated, omit a trailing ","! + +%\begin{docCommandArgs}{DeclareAssociatedCounters} + +\begin{codeoptionsenum} + \item \oarg{options}: %As of \packageversion, the optional argument \oarg{options} is not used so far, but is reserved for later purposes. + \begin{docKey}[][]{autodefine}{=\meta{choice}}{initially none} + This choice - key can be specified if the specified counters should be defined if they not already available. + Possible values are + \begin{itemize} + \item \texttt{none} -- no counter is autodefined + \item \texttt{all} -- all counters will be autodefined + \item \texttt{driver} -- only driver counters will be autodefined + \item \texttt{associated} -- only associated counters will be autodefined + \end{itemize} + \end{docKey} + Default is \texttt{none} + \begin{docKey}[][]{sloppy}{}{} + If \refKey{autodefine} key is used, the \texttt{sloppy} key disables the check whether a counter is defined already. + \end{docKey} + + \item \marg{driver counter} + + Holds the name of the driver counter to which the list of counters should be associated +\item \marg{associated counters list} + + A comma separated list of counter names that should be associated to the driver counter +\end{codeoptionsenum} +%\end{docCommandArgs} + + +\begin{itemize} +\item This command is a preamble command, i.e. it can be used in the preamble of the document or within other packages or class files only. +\item This command should be used as early as possible, i.e. in the preamble of the document, since the driven counters are not increased as long as they are not associated to the driver counter. On the hand, it is possible or may be required to control the starting point of the association at any position in the body of the document, when the association should start later on. Use the command \refCom{AddAssociatedCounters} if counters should be associated within the document body. +\end{itemize} + + +% Relax for documentation purposes \renewcommand{\DeclareAssociatedCounters}[3][]{\relax}% \begin{dispExample} -\textbf{This example shows 4 equations, but only two of them are counted} +%%%% The association of anothertotalpages in this example just takes place here, so the stepping of the counter will start from here and providing a 'wrong' value. +%%%% +\DeclareAssociatedCounters{page}{totalpages,anothertotalpages}% +This document has \number\totvalue{totalpages} (note: \number\totvalue{anothertotalpages}) pages. +\end{dispExample} -\begin{equation} -E_{0} = mc^2 -\end{equation} +\begin{itemize} + \item Current version (\packageversion) rules: + \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! + \CHDocUpdate{0.6} -Now suspend the equations: + 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. -\SuspendCounters{equation} -\begin{equation} -E^2 = \left({ pc}\right)^2 + E^{2}_{0} -\end{equation} + A contrary feature are the \CHDocTag{coupled counters} -- If some counters should share a common base, i.e. increasing one arbitrary member counter of a group of counters then all should be increased, this called coupling of counters -- all group members are on an equal footing. See \cref{sec::coupledcounters} about this feature. -\begin{equation} - m(v) = \frac{m_{0}}{\sqrt{1-\frac{v^2}{c^2}}} -\end{equation} + On the other side, \CHDocTag{associated counters} belong to a hierarchy. The driver counter dominates the associated counters. + + \end{itemize} + \item A self-association of the driver counter to itself is ignored internally as this would lead to inconsistent counter values. + \item The order of the specification of associated counters in the 2nd arguments is of no importance. + \item Specifing an associated counter name multiple times has no effect, only the first occurence of the name will be used. +\end{itemize} -And resume it: \ResumeSuspendedCounters{equation} +\end{docCommand} -\begin{equation} - E = h \nu -\end{equation} -There are \number\totvalue{totalequations}~equations in here! +\begin{docCommand}{AddAssociatedCounters}{\oarg{options}\marg{driver counter}\marg{associated counters list}} +The usage of this macro is similar to \refCom{DeclareAssociatedCounters}; if it is called in the document preamble (or in package file), \refCom{AddAssociatedCounters} falls back to +\begin{center}\refCom{DeclareAssociatedCounters},\end{center} having the same optional argument functionality with \refKey{autodefine} and \refKey{sloppy}; if it is called in the document body, this command adds some counters to the associated counter list for a specific driver counter -- if this list does not exists, the \LaTeX{} run will issue a warning, but add the driver counter to the driver list and the associated counters analogously. +\marginnote{\bcbombe} + +Using \refCom{AddAssociatedCounters} in the document body automated generation of counters is disabled. + +% You have to use \refCom{DeclareAssociatedCounters} first, to set up the driver counter hook. + + +\begin{docCommandArgs}{AddAssociatedCounters} + +\begin{codeoptionsenum} + \item \oarg{options}: As of version \packageversion, the optional argument \oarg{options} are the same as for \refCom{DeclareAssociatedCounters}, see \refKey{autodefine} and \refKey{sloppy}. + + \item \marg{driver counter} + + Holds the name of the driver counter to which the list of counters should be associated + \item \marg{associated counters list} + A comma separated list of counter names that should be associated to the driver counter +\end{codeoptionsenum} +\end{docCommandArgs} + + +% macro of the package. It declares the counter names being specified in comma - separated - list (CSV) which should be stepped simultaneously when the driver counter is increased by \cs{stepcounter}. + +\end{docCommand}% + +\begin{docCommand}{RemoveAssociatedCounter}{\marg{driver counter}\marg{associated counter}} +This command removes a counter from the existing list for a driver counter, i.e. the counter will not be increased any longer by \cs{stepcounter}. It can be increased however manually, of course. +\end{docCommand} + + + +\begin{dispExample} +\RemoveAssociatedCounter{page}{anothertotalpages} +This document has \number\totvalue{totalpages} (beware: \number\totvalue{anothertotalpages}) pages. \end{dispExample} -\section[Additions and extensions to standard commands]{Additions and extensions to standard counter related commands}\label{section::additions_to_l2e} +\begin{docCommand}{RemoveAssociatedCounters}{\marg{driver counter}\marg{list of associated counters}} +This command removes the comma-separated-value list of counters from the existing list for a driver counter, i.e. the counters will not be increased any longer by \cs{stepcounter}. They can be increased however manually, of course. -\subsection{Extension of \LaTeXe\ commands}\label{subsection::extension_of_l2e_commands} +Take care not to confuse the commands \refCom{RemoveAssociatedCounters} +and{}\linebreak \refCom{RemoveAssociatedCounter} +\end{docCommand} -\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. +\begin{docCommand}{ClearAssociatedCounters}{\oarg{options}\marg{driver counter}} +This command clears the internal list for all counters associated to the \marg{driver counter}. The counters will not be increased automatically any longer. -As of \packageversion, there is only one option used: -\begin{docKey}[][after={\CHDocNew{0.9}}]{wrap}{=\meta{true/false}}{initially true} +The optional argument is not used as of version \packageversion. - 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} +Please note that the driver counter is not removed from the list of driver counters -- this simplifies reassociating of (other) counters to this one later on with the macro \refCom{AddAssociatedCounters} and suppress the relevant warning. +If the driver counter and all its associated counters should be removed, use \refCom{RemoveDriverCounter} instead. \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. - - \begin{docKey}{initial}{=\meta{integer value}}{initially 0} - This is used for the start value of the new counter. - \end{docKey} +\clearpage -\end{docCommand}% -\begin{docCommand}{DeclareDocumentCounter}{\oarg{options}\marg{counter}\oarg{resetting counter}} - This command is the preamble-only version of \refCom{NewDocumentCounter}. +\subsection[Driver macros]{Driver counter commands} \label{subsection::drivercounterscmds} + + +\begin{docCommand}{AddDriverCounter}{\oarg{options}\marg{driver counter name}} + +\begin{docCommandArgs}{AddDriverCounter}% + +\begin{codeoptionsenum} +\item \oarg{options}: As of \packageversion, the optional argument \oarg{options} is not used so far, but is reserved for later purposes. + + \item \marg{driver counter name} + + Holds the name of the driver counter that should be added to the list of driver counters. +\end{codeoptionsenum} +\end{docCommandArgs} + \end{docCommand}% -\begin{docCommand}{SetDocumentCounter}{\oarg{options}\marg{counter}\marg{counter value}} -This command behaves like the standard macro \cs{setcounter}, but has an additional optional 1st argument. %which is not used as of version \packageversion. -% This optional argument can be used to enable the setting of the driver counter value as well as the associated counter values at once. +\begin{docCommand}{RemoveDriverCounter}{\oarg{options}\marg{driver counter}} +This command clears the internal list for all counters associated to the \marg{driver counter}. The counters will not be increased automatically any longer. -\begin{docCommandArgs}{SetDocumentCounter}% +The optional argument is not used as of version \packageversion. + +If all driver counters should be unregistered, use \refCom{ClearDriverCounters} instead! +\end{docCommand} + + +\begin{docCommand}{ClearDriverCounters}{\oarg{options}}% + +This clears completely the list of driver counters, such that no counters are regarded as being associated -- i.e. no driver is hold as being a driver counter. + +The optional argument is not used as of version \packageversion. + +\end{docCommand} +\subsection[Query macros]{Commands for queries} \label{subsection::querycmds} + +Sometimes it might be necessary to get information, whether a counter is regarded as a driver or as an associated counter. This section describes some query macros in order to obtain this information. + + +\begin{docCommand}{IsAssociatedToCounter}{\marg{driver counter}\marg{associated counter}\marg{True branch}\marg{False branch}} +This macro checks, whether a counter is associated to a particular given driver counter and expands the corresponding branch. If the internal driver counter list does not exist, the false branch will be used, since this also means, that the possibly associated counter is not associated at all. + + + +\begin{docCommandArgs}{IsAssociatedToCounter}% + \begin{codeoptionsenum} - \item \oarg{options}: %As of version \packageversion, this option is not used% the key value argument + \item \marg{driver counter} - \begin{docKey}{associatedtoo}{=\meta{true/false}}{initially false} - If enabled (\meta{true}), \refCom{SetDocumentCounter} will use the counter value for \underline{all} counters associated to this driver counter as well. Initially, this option is set to \meta{false}. - \end{docKey} + Holds the name of the driver counter to which \marg{associated counter} the could possibly be associated. +\item \marg{associated counter} - \begin{docKey}{onlycounters}{=\meta{comma separated list of counters}}{initially empty} - If this key is used, only those associated counters are set as well that are given in the comma separated list. - - Names, that are either not referring to counters at all or to counters that are not associated to the given driver counter will be ignored silently. - \end{docKey} + Contains the name of the possibly associated counter. - +\item \marg{True branch} + This code is expanded if the counter is associated to the driver, otherwise it is ignored. +\item \marg{True branch} - \item \marg{counter} - Holds the name of the (driver) counter to be set. - \item \marg{counter value} - Holds the value to be set - \end{codeoptionsenum} + This code is expanded if the counter is \textbf{not} associated to the driver, otherwise it is ignored. + +\end{codeoptionsenum} \end{docCommandArgs} -Some notes on \refCom{SetDocumentCounter} + +\begin{dispExample} +% Remove associated counter first for demonstration purposes +\RemoveAssociatedCounter{page}{anothertotalpages} +\IsAssociatedToCounter{page}{totalpages}{Yes, totalpages is associated}{No, totalpages is not associated} + +\IsAssociatedToCounter{page}{anothertotalpages}{Yes, anothertotalpages is associated}{No, anotherpages is not associated} +\end{dispExample} + +See also + \begin{itemize} - \item The option keys \refKey{associatedtoo} and \refKey{onlycounters} are mutually exclusive! % - \item The counter to be set can be either a driver counter or an otherwise associated counter. + \item \refCom{IsAssociatedCounter} for checking whether a counter is associated + \item \refCom{IsDriverCounter} in order to check whether a counter is a driver. + \item \refCom{GetDriverCounter} returns the driver counter name for a given associated counter name \end{itemize} -\end{docCommand}% -\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}. +\end{docCommand} -\begin{docCommandArgs}{StepDownCounter}% +\begin{docCommand}{GetDriverCounter}{\marg{counter name}}% -\begin{codeoptionsenum} - \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument - \item \marg{counter} - Holds the name of the first counter. - \end{codeoptionsenum} -\end{docCommandArgs} +This commands returns the driver counter to which the counter name of the first argument is connected to. If the counter is not defined, the macro returns nothing. -\end{docCommand}% +\begin{itemize} + \item No check whether the counter name is defined is performed + \item No check whether the counter is associated at all is performed. Usage of this command in conjunction with \refCom{IsAssociatedCounter} is strongly encouraged. +\end{itemize} -\begin{docCommand}{SubtractFromCounter}{\oarg{options}\marg{counter}\marg{delta value}}\CHDocNew{0.4} +\begin{dispExample}% +totalpages is associated to the \textcolor{blue}{\textbf{\GetDriverCounter{totalpages}}} counter. +% Try with an undefined counter name +humptydumpty is associated to the \textcolor{blue}{\textbf{\GetDriverCounter{humptydumpty}}} counter. -This macro subtracts the (positive) delta value from the counter and is the counterpart of \cs{addtocounter} +\end{dispExample}% -\begin{docCommandArgs}{SubtractFromCounter}% +\end{docCommand}% + + +\begin{docCommand}{IsAssociatedCounter}{\marg{counter name}\marg{True branch}\marg{False branch}}% + +This commands tests, whether a given counter name is an associated counter and expands correspondingly the true or the false branch. The command does not tell to which driver the counter it is associated -- this information can be obtained by \refCom{GetDriverCounter}. +\begin{docCommandArgs}{IfAssociatedCounter}% \begin{codeoptionsenum} - \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument +\item \marg{counter name}% - \item \marg{counter 1} - Holds the name of the first counter. - \item \marg{delta value} - Holds the (positive) value to be subtracted from the counter value. - \end{codeoptionsenum} + Contains the name of the possibly associated counter + +\item \marg{True branch} + + This code is expanded if the counter is associated to a driver, otherwise it is ignored + +\item \marg{True branch} + + This code is expanded if the counter is \textbf{not} associated a driver, otherwise it is ignored + +\end{codeoptionsenum} \end{docCommandArgs} + +\begin{dispExample} +\IsAssociatedCounter{section}{Yes, section is an associated counter}{No, section counter does not have the associated counter properties} +\IsAssociatedCounter{totalpages}{Yes, totalpages is an associated counter}{No, totalpages counter does not have the associated counter properties} +\end{dispExample} + \end{docCommand}% -\begin{docCommand}{CopyDocumentCounters}{\oarg{options}\marg{source counter}\marg{target counter}} -This document copies the counter value from the source counter in argument 2 to the target counter in argument 3. +\begin{docCommand}{IsDriverCounter}{\marg{driver counter name}\marg{True branch}\marg{False branch}}% -\begin{docCommandArgs}{CopyDocumentCounters}% +This commands tests, whether a given counter name is a driver counter and expands correspondingly the true or the false branch. +\begin{docCommandArgs}{IfDriverCounter}% \begin{codeoptionsenum} - \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument +\item \marg{driver counter name}% - \item \marg{source counter} - Holds the name of the source counter. - \item \marg{target counter} - Holds the name of the target counter. - \end{codeoptionsenum} + Contains the name of the possible driver counter + +\item \marg{True branch} + + This code is expanded if the counter is a driver, otherwise it is ignored + +\item \marg{True branch} + + This code is expanded if the counter is \textbf{not} a driver, otherwise it is ignored +\end{codeoptionsenum} \end{docCommandArgs} + +\begin{dispExample} +\IsDriverCounter{section}{Yes, section is a driver counter}{No, section counter does not have driver properties} +\end{dispExample} + \end{docCommand}% -\begin{docCommand}{SwapDocumentCounters}{\oarg{options}\marg{counter 1}\marg{counter 2}} -This macro swaps the values of the counters given in arguments 2 and 3 +\section[Counter backup/restoration]{Backup and restore of counter values}\label{section::new_backuprestore}\CHDocNew{1.0} -\begin{docCommandArgs}{SwapDocumentCounters}% +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. -\begin{codeoptionsenum} - \item \oarg{options}: As of version \packageversion, this option is not used% the key value argument +\begin{marker} + Since version \CHDocFullVersion{1.0} the commands and feature behaviour of backup and restoration of counter values has changed. - \item \marg{counter 1} - Holds the name of the first counter. - \item \marg{counter 2} - Holds the name of the second counter. - \end{codeoptionsenum} -\end{docCommandArgs} + The old behaviour is still available using the macros \cs{Former...} prefixed macros, see \cref{section::old_backuprestore} for this. +\end{marker} -\end{docCommand}% +\subsection{Key philosophy in backup/restore} +The basic idea is to provide a scheme that allows easy storage and restoration of counter values. For a single counter this is quite easy, using some other temporary counter, storing the old value there and copy the values back at the right position -- if many counters should be controlled to have a backup this procedure might get tedious, however. -\begin{docCommand}{SyncCounters}{\oarg{options}\marg{driver counter}} +\CHDocPackage{xassoccnt} provides some tools to define groups of counters that should be under control of backup and restoration. A backup counter group can be used multiple times, each using an individual ID, this allows maintaining 'complete' counter states and reinjecting them at any position later on. -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. +Those are the basic steps (in pseudo code) to use the backup feature: -\begin{docCommandArgs}{SyncCounters}% +\begin{enumerate} + \item Define a symbolic backup counter group name + Note that counter group names are providing something like a namespace. A group of coupled counters (see \namecref{sec::coupledcounters} \nameref{sec::coupledcounters}) may have the same name as a group of counters designed to be backed up -- however, each feature has its own namespace. In each namespace there can be only one counter group with a specific name, duplicates are not allowed within the same feature namespace. + \item Populate the counter group name with counter names + \item Define a backup state and a corresponding id + \item Restore at any place +\end{enumerate} -\begin{codeoptionsenum} - \item \oarg{options}: see \refCom{SetDocumentCounter} +\subsection{The default counter group "scratch"} - \item \marg{source counter} - Holds the name of the source counter. - \end{codeoptionsenum} -\end{docCommandArgs} +There is a default counter group for backup named "scratch", if no specific counter group name is given using the \refKey{name} option (see \cref{subsubsec::common_options_backuprestore} for a detailed description of available backup/restore options). -\end{docCommand}% +\subsection{Description of basic backup/restore macros} -\begin{dispExample}%[breakable=true] - \SetDocumentCounter{foocntr}{17} - \SetDocumentCounter{foobarcntr}{20} +\subsubsection{Common options to (most) of the backup/restore macros} \label{subsubsec::common_options_backuprestore} \begin{itemize} -\item Displaying counters +\item + \begin{docKey}[][]{resetbackup}{=\meta{true/false}}{initially true} + This key decides whether \textbf{all} counters in the backup list should be reset to zero or should keep the current value when the backup command is given. The default value is \meta{true}. + \end{docKey} +\item \begin{docKey}[][]{cascading}{=\meta{true/false}}{initially false} + This key decides whether all counters in the reset list of a driver counter shall be added to the counter group -- the driver counter is added itself too. If the driver counter has no reset list, it is added nevertheless. + + Please note that the reset lists of the individual counters are tracked as well -- this is done recursively. + + This provides a very convenient feature to backup and restore the value of a certain sectioning level, say \cs{chapter}. Using \refKey{cascading} this would mean\footnote{Assuming \CHDocClass{book} is used, for example!} that \CHDocCounter{chapter}, \CHDocCounter{section}, \CHDocCounter{subsection},\CHDocCounter{subsubsection}, \CHDocCounter{paragraph}, \CHDocCounter{subparagraph}, \CHDocCounter{equation}, \CHDocCounter{figure} and \CHDocCounter{table} would be added to the counter group. + \end{docKey} + \item \begin{docKey}[][]{backup-id}{=string}{no default value} + This key declares a string-like backup id under which the backup of a certain group is stored and can be retrieved later on. The id should be a string containing only alphanumeric characters. + \end{docKey} +\item + \begin{docKey}[][]{restore-id}{=string}{no default value} + This key declares a string-like restore id for unique \CHDocPackage{hyperref} names. The id should be a string containing only alphanumeric characters. \end{docKey} + This key is only needed if the same backup-id should be restored more than once and the package \CHDocPackage{hyperref} is used in order to provide unique hyper anchors. + \item \begin{docKey}[][]{keep-after-restore}{=\meta{true/false}}{initially false} + This key decides whether the values of a certain backup id (see \refKey{backup-id}) shall be kept after a restore has been issued. The default operation is to remove the \refKey{backup-id} and the values of the counters belonging to the given \refKey{backup-id}. + + This option is useful if the same backup state (i.e. \refKey{backup-id}) is to be used more than once. - \thefoocntr\ and \thefoobarcntr -\item Swapping counters + Reusing the same counter group for restore after having restored them already with the \refKey{keep-after-restore} option being false will be ignored, i.e. the counter values are not changed. +\end{docKey} - \SwapDocumentCounters{foocntr}{foobarcntr} +\item \refKey{name} + The meaning of this key is basically the same as for the \nameref{sec::coupledcounters} feature. However, depending on the stage of the backup/restore process the precise action differs: + \begin{itemize} + \item If \refKey{name} is used in \refCom{AssignBackupCounters} the counters are added to group indicated by the value of \refKey{name}. + \item If \refKey{name} is used either for \refCom{BackupCounterGroup} or in \refCom{RestoreBackupCounterGroup} to indicate the counter group for a certain backup state, either for storing or restoring. + \end{itemize} +\end{itemize} - \thefoocntr\ and \thefoobarcntr +\subsubsection{Core backup/restore macros} -\item Step down counters +\begin{docCommand}[before={\CHDocNew{1.0}}]{BackupCounterGroup}{\oarg{options}\marg{counter group name}} + Concerning the backup feature this performs the storing of counter values at the position where the command is expanded! + A backup operation needs + \begin{itemize} + \item \refKey{backup-id} to be able to refer to a certain backup state + \item \refKey{name} to identify the group of counters + \end{itemize} +\end{docCommand} -\StepDownCounter{foocntr} -\StepDownCounter{foobarcntr} +\begin{docCommand}[before={\CHDocNew{1.0}}]{RestoreBackupCounterGroup}{\oarg{options}\marg{counter group name}} + This command restores the value of the given counter group. + Useful options are (see \nameref{subsubsec::common_options_backuprestore}) + \begin{itemize} + \item \refKey{backup-id} + \item \refKey{keep-after-restore} + \item \refKey{restore-id} + \item \refKey{name} + \end{itemize} +\end{docCommand} - \thefoocntr\ and \thefoobarcntr -\item Subtracting some value from the counters - \SubtractFromCounter{foocntr}{5} - \SubtractFromCounter{foobarcntr}{10} +\subsubsection{Declaring counter groups} - \thefoocntr\ and \thefoobarcntr -\end{itemize} -\end{dispExample} +\begin{docCommand}[before={\CHDocNew{1.0}}]{DeclareBackupCountersGroupName}{\oarg{}\marg{counter group name}} + This command declares (better: reserves a name for a backup counter group) -- the name has to be specified as first mandatory argument. + + A counter group name consists of alphanumeric characters, special symbols etc. are not allowed. The name must not contain commas! + + As of version \packageversion\ the optional argument is not used and reserved for later purposes. +\end{docCommand} -\section[Loops on multiple counter]{Performing the same action for many counters} \CHDocNew{0.7} +\subsubsection{Populating counter groups} -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. +\begin{docCommand}[before={\CHDocNew{1.0}}]{AssignBackupCounters}{\oarg{options}\marg{counter name1,counter name2,\dots}} + This macro populates the counter group (given as optional key - value \refKey{name}) with the comma separated list of counters from the first mandatory argument. The meaning of \refKey{name} is the same as in \nameref{sec::coupledcounters}, but the counter group names are not related to that feature -- the namespace is safe then. + + Some important notes about the behaviour of \refCom{AssignBackupCounters} + \begin{itemize} + \item If \refKey{name} is not given or empty, the default counter group "scratch" is used. + + \item If the counter group given to \refKey{name} does not exist, it will be created automatically. + \end{itemize} + +\end{docCommand} + + +\begin{docCommand}[before={\CHDocNew{1.0}}]{AddBackupCounter}{\oarg{options}\marg{counter name1,counter name2,\dots}} + This command is similar to \refCom{AssignBackupCounters}, adding counters to a counter group named by \refKey{name} option. If the counter group name does not exist, no action is performed, i.e. the adding operation is ignored. +\end{docCommand} -All macros concerning this feature use the first macro argument having a comma-separated list of counters. Whether there's a second argument depends on the specific nature of the operation that should be performed. +\subsubsection[Clearing backup states]{Clearing backup states}\label{subsubsec::clearingbackupstates} -\begin{marker} -\begin{itemize} -\item As of version \packageversion\ \PackageDocName\ does not check whether the names given in the first argument refer to counters. -\item All macros use the extended counter macros, i.e. are aware of associated counters and step them too if their driver counter is given in the argument list. If an associated counter itself is given in the list, this one is stepped or operated on too! -\end{itemize} -\end{marker} +It might be necessary to remove a certain backup state, i.e. a collection of counter values to be referred to with a \refKey{backup-id}. This can be done either for a certain counter (with \refCom{ClearCounterBackupState}) in a counter group only or for all counters in group (with \refCom{ClearBackupState}). +\begin{docCommand}[before={\CHDocNew{1.0}}]{ClearCounterBackupState}{\oarg{options}\marg{countergroup name}\marg{counter name}} + This macro removes the given backup-id state value for a specific counter only. Use the \refKey{backup-id} option in the first optional argument to specify which backup-id should be cleared. -\begin{docCommand}{LoopAddtoCounters}{\marg{counter1, counter2,\dots}\marg{counter increment/decrement}} \CHDocNew{0.7} + \begin{itemize} + \item If the backup-id does not exist, the operation is ignored silently. + \item The counter is still part of the group, but can't be restored to the previous state that was identified with \refKey{backup-id}. + \end{itemize} -\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}. + \marginnote{\bcbombe}Use this macro with care! + \smallskip +\end{docCommand} -\begin{codeoptionsenum} - \item \marg{counter1, counter2,\dots} - Holds the comma separated list of counter names - \item \marg{counter increment/decrement} - Specifies the value to be added or subtracted - No check is performed whether \textbf{is} or \textbf{expands} to an integer value. - \end{codeoptionsenum} -\end{docCommandArgs} +\begin{docCommand}[before={\CHDocNew{1.0}}]{ClearBackupState}{\oarg{options}\marg{countergroup name}} + This macro removes the given backup-id state value for a whole counter group. Use the \refKey{backup-id} option in the first optional argument to specify which backup-id should be cleared. + \begin{itemize} + \item If the backup-id does not exist, the operation is ignored silently. + \item The \refKey{backup-id} is removed from the list of possible backup-ids for the relevant countergroup. + \end{itemize} \end{docCommand} -\begin{docCommand}{LoopResetCounters}{\marg{counter1, counter2,\dots}} \CHDocNew{0.7} +\subsubsection[Clearing backup groups]{Clearing and deleting backup counter groups}\label{subsubsec::clearingdeletingbackupcountergroups} -\begin{docCommandArgs}{LoopResetCounters}% -All counters given in the first argument are set to zero using the regular \cs{setcounter}. This is a shorthand version of \refCom{LoopSetCounters} for this specific case. +From time to time it might be necessary to remove counters from a group or to clear the whole group or remove even the whole group. Those operations can be achieved with \refCom{RemoveCountersFromBackupGroup}, \refCom{ClearBackupCounterGroups} and \refCom{DeleteBackupCounterGroups}. All macros remove at least all stored values belonging to a counter group. A \refCom{RestoreBackupCounterGroup} call does nothing after any of the mentioned macros have been issued. +\begin{docCommand}[before={\CHDocNew{1.0}}]{RemoveCountersFromBackupGroup}{\oarg{options}\marg{countergroup name}\marg{counter name 1, counter name 2,\dots}} + This command removes the given counter names from a counter group. The stored values are deleted completely and are lost afterwards. A non-existing counter group name is ignored as well as counters that do not belong to the given group name. -\begin{codeoptionsenum} - \item \marg{counter1, counter2,\dots} - Holds the comma separated list of counter names - \end{codeoptionsenum} -\end{docCommandArgs} + As of version \packageversion\ the optional argument is not used and reserved for later purposes. -\end{docCommand} + If complete counter groups shall be deleted and be unavailable afterwards, use +\refCom{DeleteBackupCounterGroups} instead. +\end{docCommand} -\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. +\begin{docCommand}[before={\CHDocNew{1.0}}]{ClearBackupCounterGroups}{\oarg{options}\marg{countergroup name 1, countergroup name 2,\dots}} + This command removes all names of the counter groups given as comma separated list in the 2nd argument, the internal storage of counter values is removed as well, i.e. older counter values aren't available any longer. The counter group names remain valid, any subsequent call to \refCom{BackupCounterGroup} or \refCom{RestoreBackupCounterGroup} with one of the provided group names will be ignored. + + As of version \packageversion\ the optional argument is not used and reserved for later purposes. -\begin{marker} - This macro is meant only to complete the number of \cs{Loop...Counters} but is not regarded as being really useful. -\end{marker} + If counter groups shall be deleted and be unavailable, use \refCom{DeleteBackupCounterGroups}. +\end{docCommand} -\begin{codeoptionsenum} - \item \marg{counter1, counter2,\dots} - Holds the comma separated list of counter names - \end{codeoptionsenum} -\end{docCommandArgs} +\begin{docCommand}[before={\CHDocNew{1.0}}]{DeleteBackupCounterGroups}{\oarg{options}\marg{countergroup name 1, countergroup name 2,\dots}} + This command clears the counter groups given as comma separated list in the 2nd argument with \refCom{ClearBackupCounterGroups} and removes the names as well, i.e. those names are not available any longer. + + As of version \packageversion\ the optional argument is not used and reserved for later purposes. \end{docCommand} +\subsection{Query for backup features}\label{subsec::querybackupmacros}\CHDocNew{1.0} -\begin{docCommand}{LoopSetCounters}{\marg{counter1, counter2,\dots}\marg{new counter value}} \CHDocNew{0.7} +As usual, some macros to ask whether a certain counter is under backup control or whether a certain \refKey{backup-id} exists might be useful! -\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}. -\begin{codeoptionsenum} - \item \marg{counter1, counter2,\dots} - Holds the comma separated list of counter names - \item \marg{new counter value} - Specifies the value to be set. +\subsubsection{Querying for backup counter group existence}\label{subsec::querybackupcountergroup} - No check is performed whether \textbf{is} or \textbf{expands} to an integer value. - \end{codeoptionsenum} -\end{docCommandArgs} +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupCounterGroupTF}{\marg{counter group name}\marg{true branch}\marg{false branch}} +This macro tests if the given name is a backup counter group and expands to the \meta{true}/\meta{false} branch accordingly. There are two short-circuit commands: \refCom{IsBackupCounterGroupT} and \refCom{IsBackupCounterGroupF}. +\end{docCommand} +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupCounterGroupT}{\marg{counter group name}\marg{true branch}} +This macro tests if the given name is a backup counter group and expands to the \meta{true} branch accordingly. There are two related macros: \refCom{IsBackupCounterGroupF} and \refCom{IsBackupCounterGroupTF}. \end{docCommand} +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupCounterGroupF}{\marg{counter group name}\marg{false branch}} +This macro tests if the given name is a backup counter group and expands to the \meta{false} branch accordingly. There are two related macros: \refCom{IsBackupCounterGroupT} and \refCom{IsBackupCounterGroupTF}. +\end{docCommand} -\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}. -\begin{codeoptionsenum} - \item \marg{counter1, counter2,\dots} - Holds the comma separated list of counter names - \end{codeoptionsenum} -\end{docCommandArgs} +\subsubsection{Querying for backup counter entity}\label{subsec::querybackupmacros} +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupCounterTF}{\marg{counter name}\marg{true branch}\marg{false branch}} +This macro tests if a counter is under the administration of the backup counter commands and expands to the relevant \meta{true}/\meta{false} branch then. There are two short-circuit commands: \refCom{IsBackupCounterT} and \refCom{IsBackupCounterF}. \end{docCommand} +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupCounterT}{\marg{counter name}\marg{true branch}} +This macro tests if a counter is under the administration of the backup counter commands and expands to the \meta{true} branch then. There are related commands: \refCom{IsBackupCounterTF} and \refCom{IsBackupCounterF}. +\end{docCommand} -A more general command for doing "arbitrary" operations with counters (and more setup, for example) is +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupCounterF}{\marg{counter name}\marg{false branch}} +This macro tests if a counter is under the administration of the backup counter commands and expands to the \meta{false} branch if this not the case. There are related commands: \refCom{IsBackupCounterTF} and \refCom{IsBackupCounterT}. +\end{docCommand} -\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. +\subsubsection{Querying for backup state entity}\label{subsec::querybackupstate} -\begin{codeoptionsenum} - \item \marg{counter1, counter2,\dots} - Holds the comma separated list of counter names - \item A macro name that is to be called and that operates on a counter. - \end{codeoptionsenum} -\end{docCommandArgs} +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupStateTF}{\marg{counter group name}\marg{counter backup-id}\marg{true branch}\marg{false branch}} +This macro tests if the backup-id exists for the given counter group and executes the relevant \meta{true}/\meta{false} branch accordingly. There are two short-circuit commands: \refCom{IsBackupStateT} and \refCom{IsBackupStateF}. +\end{docCommand} + +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupStateT}{\marg{counter group name}\marg{counter backup-id}\marg{true branch}} +This macro tests if the backup-id exists for the given counter group and executes the relevant \meta{true} branch accordingly. There are two related: \refCom{IsBackupStateTF} and \refCom{IsBackupStateF}. +\end{docCommand} +\begin{docCommand}[after={\CHDocNew{1.0}\par}]{IsBackupStateF}{\marg{counter group name}\marg{counter backup-id}\marg{false branch}} +This macro tests if the backup-id exists for the given counter group and executes the relevant \meta{false} branch accordingly. There are two related: \refCom{IsBackupStateTF} and \refCom{IsBackupStateT}. \end{docCommand} -\begin{dispExample} - % We assume we have the counters foocntr and foobarcntr - \newcommand{\showcountervalues}[2]{% - \textcolor{#1}{\csname the#2\endcsname}% Now, an extra empty line to show the values in rows - - } - % Note that the 2nd argument is not given here -- it's added by the \LoopCountersFunction macro - \LoopCountersFunction{foocntr,foobarcntr}{\showcountervalues{blue}} -\end{dispExample} +\subsection{Some notes on the backup features} \label{subsec::backup_and_hyperref} + +Principally backing up counter values and restoring them later on is not really difficult -- with one exception: If the \CHDocPackage{hyperref} package is used, the counter values form up the hypertarget anchors, for example \texttt{chapter.1} for the first chapter. If the chapter counter is reset, there would be a chapter with number one again and as well an anchor name \texttt{chapter.1} -- \packagename{hyperref} will complain 'only' about this but it will put the wrong hyperlink as well, for example for the table of contents and the bookmarks -- this is an undesirable feature. +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. \refCom{BackupCounterGroup} does this resetting automatically in an unique way and \refCom{RestoreBackupCounterGroup} restores as well the old \cs{theH...} macros of all counters that are in the backup list. It tracks the number of calls to \refCom{BackupCounterGroup} and changes the relevant \cs{theH...} macro definitions to use unique anchor names then -- this way multiple \refCom{BackupCounterGroup} calls are possible without destroying the hyperlink facilities with \CHDocPackage{hyperref}. \section{Coupled counters}\label{sec::coupledcounters}\CHDocNew{0.5} @@ -1482,7 +1711,7 @@ 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}}{}\CHDocNew{0.6} +\begin{docKey}{name}{=\meta{name of a group}}{}\CHDocNew{0.6} This option has the name of the counter group that should be coupled, say ``figuretablegroup'' etc. \end{docKey} @@ -1626,55 +1855,209 @@ This defines the counter given in the first mandatory argument as a periodic cou \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{docCommand}[before={\CHDocNew{0.9}}]{RemovePeriodicCounter}{\oarg{options}\marg{counter name}} +This removes the counter given in the first mandatory argument as a periodic counter. The counter is reset unless the \refKey{reset} is set to \meta{false}. \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} +If all periodic counters should be removed, use the macro \refCom{RemoveAllPeriodicCounters} instead. + +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{1.0}}]{RemoveAllPeriodicCounters}{\oarg{options}} + This command removes all counters given in the first mandatory argument as a periodic counter. All counters are reset unless the \refKey{reset} option is set to \meta{false}. + +\begin{codeoptionsenum} +\item \oarg{options} + As of version \packageversion, there is only one option: \refKey{reset}, having the same meaning as in \refCom{RemovePeriodicCounter}. +\item \marg{counter name} -- the name of the counter that should be no periodic counter any longer. +\end{codeoptionsenum} + +If only a specific counter shall be removed from the periodic counter property use the command \refCom{RemovePeriodicCounter} instead. + \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. +\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[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. + + + +\begin{marker}[before=\CHDocNew{0.8}\par] + Suspension and resuming counters can cause wrong hyper links if \CHDocPackage{hyperref} is used. +\end{marker} + +\subsection{Macros for suspension and resume} + +\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}% + + 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}}\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. + +\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}% + + Contains the name of counters to be suspended, separated by commas (CSV - list) +\end{codeoptionsenum} +\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}} \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} + + +\subsection{Query suspension} +\begin{docCommand}[before={\CHDocNew{0.1}}\par]{IsSuspendedCounter}{\marg{counter name}\marg{true branch}\marg{false branch}} +See \nameref{section::suspendedresumedcounters} on this topic. + +This command checks, whether a counter is suspended, i.e. not updated at all and expands the corresponding branches. + +%\begin{docCommandArgs}{IfSuspendedCounter}% + +\begin{codeoptionsenum} +\item \marg{counter name}% + + Contains the name of counter presumed to be suspended + +\item \marg{True branch} + + This code is expanded if the counter is suspended, otherwise it is ignored + +\item \marg{True branch} + + This code is expanded if the counter is \textbf{not} suspended, otherwise it is ignored + +\end{codeoptionsenum} +%\end{docCommandArgs} + + +\end{docCommand} + + + +\begin{marker} +If a driver counter is suspended, all counters associated to it are suspended too! +\end{marker} + +\setcounter{totalequations}{0} +\setcounter{equation}{0} +\renewcommand{\DeclareAssociatedCounters}[3][]{\relax}% +\begin{dispExample} +\textbf{This example shows 4 equations, but only two of them are counted} + +\begin{equation} +E_{0} = mc^2 +\end{equation} + +Now suspend the equations: + +\SuspendCounters{equation} +\begin{equation} +E^2 = \left({ pc}\right)^2 + E^{2}_{0} +\end{equation} + +\begin{equation} + m(v) = \frac{m_{0}}{\sqrt{1-\frac{v^2}{c^2}}} +\end{equation} + +And resume it: \ResumeSuspendedCounters{equation} + +\begin{equation} + E = h \nu +\end{equation} + +There are \number\totvalue{totalequations}~equations in here! + +\end{dispExample} + -\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}} -Similarly to the package \CHDocPackage{totcount} or the features of \CHDocPackage{totalcount} by Axel Sommerfeldt this package provides the possibility of defining a counter that stores its finally value to the auxiliary file and starts from this value then, if not set otherwise to another value. -%In order to prevent namespace pollution, the counters have a different name internally, it's possible to have a counter of the name \texttt{foo} and a total counter named \texttt{foo} under the control of the total counter macros. + +Similarly to the package \CHDocPackage{totcount} or the features of \CHDocPackage{totalcount} by Axel Sommerfeldt this package provides the possibility of defining a counter that stores its finally value to the auxiliary file and starts from this value then, if not set otherwise to another value. The declaration of a total counter is a preamble - only event and \refCom{NewTotalDocumentCounter} is a preamble-only command in order to prevent counter register confusion. If a certain existing counter should be treated with total counter features, use \refCom{RegisterTotalDocumentCounter} instead. @@ -1682,6 +2065,7 @@ The declaration of a total counter is a preamble - only event and \refCom{NewTot \tcbdocmarginnote{\bcbombe}The standard \LaTeXe\ commands \cs{stepcounter}, \cs{addtocounter} and \cs{setcounter} support the specification of a total counter, but \cs{refstepcounter} will fail since the usage of a total counter for labelling purposes is most probably of no use (as of version \packageversion) \end{marker} +\subsection{Defining total counters} \begin{docCommand}{RegisterTotalDocumentCounter}{\oarg{options}\marg{total counter name}}\CHDocNew{0.5} \begin{codeoptionsenum} @@ -1708,6 +2092,10 @@ This command reports the internal name of a total counter or the usual name if t \TotalCounterInternalName{foototal} \end{dispExample} +\begin{docCommand}[before={\CHDocExpCommand\par\CHDocNew{1.0}}]{TotalCounterInternalNameExp}{\marg{counter name}} +This command is the expandable version of \refCom{TotalCounterInternalName} +\end{docCommand} + \stepcounter{foototal} @@ -1723,6 +2111,8 @@ Total value of the foototal total counter: \TotalValue{foototal} \end{docCommand} +\subsection{Queries about total counters} + \begin{docCommand}{IsTotalCounterTF}{\marg{counter name}\marg{true branch}\marg{false branch}} This macro tests if a counter is under the administration of the total counter commands and expands to the relevant branch then. There are two short-circuit commands \refCom{IsTotalCounterT} and \refCom{IsTotalCounterF}. \end{docCommand} @@ -1756,6 +2146,8 @@ This macro checks if a counter is under the administration of the total counter \section{Super total counters}\label{section:supertotalcounters} \tcbdocmarginnote{\tcbdocnew{2015-11-25}} In addition to the concept of a total counter, there is also the possibility of using super total counters -- those counters survive the reset at the beginning of a compilation, i.e. the value of a super total counter might be stepped in each run and as such the number of compilation runs etc. can be tracked. The values of the last run are persistent as long as the \CHDocFileExt{.aux} file isn't deleted. +\subsection{Defining super total counters} + \begin{docCommand}{NewTotalDocumentCounter}{\oarg{options}\marg{total counter name}} This macro defines a new counter (which mustn't exist before of course) and puts it under control of the total counter features. \begin{codeoptionsenum} @@ -1772,6 +2164,7 @@ use \refCom{RegisterTotalDocumentCounter} instead. \end{docCommand} +\subsection{Queryies about super total counters} \begin{docCommand}{IsSuperTotalCounterTF}{\marg{counter name}\marg{true branch}\marg{false branch}} This macro tests if a counter is under the administration of the super total counter commands and expands to the relevant branch then. There are two short-circuit commands \refCom{IsSuperTotalCounterT} and \refCom{IsSuperTotalCounterF}. @@ -1801,164 +2194,34 @@ 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. +\clearpage{ +\part{Meta-Information} -\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. - -\subsection[Macros for backup/restoration]{Description of backup and restoring macros for counter values} - -\begin{docCommand}{BackupCounterValues}{\oarg{options}\marg{counter name1, counter name2,...}} - This macro adds counter names (separated by a comma) to a list and stores the current values of the counters to another list. The values are used from the current state where this command is used, not a previous or a later state is stored. - - \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. \CHDocNew{0.5} - \end{itemize} - -\begin{docKey}[][]{resetbackup}{=\meta{true/false}}{initially true} -This key decides whether \textbf{all} counters in the backup list should be reset to zero or should keep the current value. The default value is \meta{true}. -\end{docKey} - -Please note: If a name does not belong to a counter register the compilation aborts with an error message! - -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.\CHDocNew{0.4} -\end{marker} - -\begin{marker} - Strangely enough, a counter name like \CHDocCounter{foo*} is possible, but \cs{thefoo*} would fail. Be careful about choosing counter names for new counters -- just restrict yourself to the usual letters (and if really needed, using \makeatletter @\makeatother) -\end{marker} -\end{docCommand}% - - -\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. - -The backup list is cleared after the restoring has been finished. -\end{docCommand} - -\begin{marker} -The \refCom{RestoreAllCounterValues} was previously called \refCom{RestoreCounterValues} -- that macro is now reserved for updating only particular -counters, not all in a row. -\end{marker} - - - -\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. - -%The backup list is cleared after the restoring has been finished. -\end{docCommand} - -\begin{dispExample} - - \captionof{figure}{A dummy figure} - - \captionof{table}{A dummy table} - - -\BackupCounterValues{figure,table*} - - \captionof{figure}{Another dummy figure} - - \captionof{table}{Another dummy table} - - \captionof{figure}{Even another dummy figure} - - \captionof{table}{Even another dummy table} - -Before restoring: \thefigure\ and \thetable - -\RestoreAllCounterValues - -Restored the values: \thefigure\ and \thetable - -\captionof{figure}{Yet another dummy figure} -\captionof{table}{Yet another dummy table} - - -\end{dispExample} - -\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,...}} \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. - -As of version \packageversion\ the optional argument isn't used and reserved for later purposes. - -\end{docCommand} - - -\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. - -As of version \packageversion\ the optional argument isn't used and reserved for later purposes. -\end{docCommand} - -\subsection{Some notes on the backup features} \label{subsec::backup_and_hyperref} - -Principally backing up counter values and restoring them later on is not really difficult -- with one exception: If the \packagename{hyperref} package is used, the counter values form up the hypertarget anchors, for example \texttt{chapter.1} for the first chapter. If the chapter counter is reset, there would be a chapter with number one again and as well an anchor name \texttt{chapter.1} -- \packagename{hyperref} will complain 'only' about this but it will put the wrong hyperlink as well, for example for the table of contents and the bookmarks -- this is an undesirable feature. - -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} \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}[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}} \CHDocNew{0.7} - -This command will print the value of the counter using lowercase hexadecimal digits. - -\end{docCommand} - -\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}} \CHDocNew{0.7} - -This command will print the value of the counter using uppercase hexadecimal digits. - -\end{docCommand} - +\parttoc \clearpage \section{To - Do list} \begin{itemize} +\item Merging of counter groups, removing counters from counter groups +\item Backup and restoration of individual counters not being member of a counter group \item Switch to the container support for all features -- this is a major task and will be done in (tiny) steps. -\item Add counter group support for the \CHDocTag{backup} feature, i.e. define a symbolic name for a group of counters that should be controlled by the backup feature. This will allow multiple backup groups, which might be necessary. \item Better counter definition/copy counter routines \(\longrightarrow\) another package perhaps \item More examples \item Some macro names might be non-intuitive \item Improve documentation \item Hooks for conditionals on \CHDocCounter*{numberofruns} (see \cref{subsection:numberofruns}) + + +\end{itemize} + +Some issues that have been addressed partially are: + +\begin{itemize} +\item \CHDocNew{1.0} Add counter group support for the \CHDocTag{backup} feature, i.e. define a symbolic name for a group of counters that should be controlled by the backup feature. This will allow multiple backup groups, which might be necessary. \end{itemize} + If you \begin{itemize} @@ -2000,9 +2263,19 @@ write this documentation. \section{Version history} \begin{itemize}[itemsep=15pt] +\item \CHDocFullVersion{1.0a} +\begin{itemize} +\item \CHDocNew{1.0} Restructured the \CHDocPackage{xassoccnt} manual file. +\item \CHDocNew{1.0} Added some improvements for counter reset lists macros +\item \CHDocNew{1.0} Added new backup/restore features, with cascading counters possibility -- the old backup/restore macros are still available but renamed with a prefix \cs{Former...} +\item \CHDocNew{1.0} Added the \refCom{RemoveAllPeriodicCounters} -- it was missing in the \CHDocTag{periodic counter} features -- see \nameref{section:periodic_counters} for more information on this. +\item \CHDocNew{1.0} Added the expandable version of \refCom{TotalCounterInternalName} named + + \refCom{TotalCounterInternalNameExp}. +\end{itemize} \item \CHDocFullVersion{0.9} \begin{itemize} - \item \CHDocUpdate{0.9}\refCom{TotalValue} is an expandable command now. + \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} @@ -2067,11 +2340,15 @@ Improved \cs{stepcounter} to remove some incompatibilities with the \CHDocPackag \end{itemize} \clearpage \phantomsection -\appendix\label{examplesappendix} +\part{Appendix}\label{examplesappendix} +\setcounter{section}{0} +\renewcommand{\theHsection}{appendix.\thesection} +\renewcommand{\thesection}{\Alph{section}} Note: The \cs{DeclareAssociatedCounters} command have to be used in the preamble of the document. It's missing here for the sake of a compact example. + \section[Total number of sections]{Example: Total number of sections} In this example, all sections of this document are counted, i.e. the current one as well as all following ones. \begin{dispExample} @@ -2125,6 +2402,113 @@ There are \number\value{equation}~equations in here! \end{dispExample} +\section[Former Backup/Restore Feature]{Former backup and restore of counter values}\label{section::old_backuprestore} \CHDocUpdate{1.0} + +\subsection[Macros for backup/restoration]{Description of backup and restoring macros for counter values} + +\begin{docCommand}{FormerBackupCounterValues}{\oarg{options}\marg{counter name1, counter name2,...}} + This macro adds counter names (separated by a comma) to a list and stores the current values of the counters to another list. The values are used from the current state where this command is used, not a previous or a later state is stored. + + \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. \CHDocNew{0.5} + \end{itemize} + +\begin{docKey}[][]{resetbackup}{=\meta{true/false}}{initially true} +This key decides whether \textbf{all} counters in the backup list should be reset to zero or should keep the current value. The default value is \meta{true}. +\end{docKey} + +Please note: If a name does not belong to a counter register the compilation aborts with an error message! + +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.\CHDocNew{0.4} +\end{marker} + +\begin{marker} + Strangely enough, a counter name like \CHDocCounter{foo*} is possible, but \cs{thefoo*} would fail. Be careful about choosing counter names for new counters -- just restrict yourself to the usual letters (and if really needed, using \makeatletter @\makeatother) +\end{marker} +\end{docCommand}% + + +\begin{docCommand}{FormerRestoreAllCounterValues}{\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. + +The backup list is cleared after the restoring has been finished. +\end{docCommand} + +\begin{marker} +The command \refCom{FormerRestoreAllCounterValues} was previously called \refCom{FormerRestoreCounterValues} -- that macro is now reserved for updating only particular +counters, not all in a row. +\end{marker} + + + +\begin{docCommand}{FormerRestoreCounterValues}{\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. + +%The backup list is cleared after the restoring has been finished. +\end{docCommand} + +\begin{dispExample} + + \captionof{figure}{A dummy figure} + + \captionof{table}{A dummy table} + + +\FormerBackupCounterValues{figure,table*} + + \captionof{figure}{Another dummy figure} + + \captionof{table}{Another dummy table} + + \captionof{figure}{Even another dummy figure} + + \captionof{table}{Even another dummy table} + +Before restoring: \thefigure\ and \thetable + +\FormerRestoreAllCounterValues + +Restored the values: \thefigure\ and \thetable + +\captionof{figure}{Yet another dummy figure} +\captionof{table}{Yet another dummy table} + + +\end{dispExample} + +\begin{docCommand}{FormerAddBackupCounter}{\oarg{options}\marg{counter name1,counter name2,...}} \CHDocNew{0.5} +This is similar to \refCom{FormerBackupCounterValues}, but adds the counter names to an existing global list and can be applied after \refCom{FormerBackupCounterValues}. + +\end{docCommand} + + +\begin{docCommand}{FormerRemoveBackupCounters}{\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{FormerRemoveBackupCounters*} 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. + +As of version \packageversion\ the optional argument isn't used and reserved for later purposes. + +\end{docCommand} + + + +\begin{docCommand}{FormerRemoveBackupCounters*}{\oarg{options}\marg{counter name}} \CHDocNew{0.5} + +This command is basically similar to \refCom{FormerRemoveBackupCounters}, but does not restore the counter value right at the place the macro is used. + +As of version \packageversion\ the optional argument isn't used and reserved for later purposes. +\end{docCommand} + + + \clearpage \markboth{\indexname}{\indexname} %%%% Index of commands etc. diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf index 50209f1e1c4..38795f5406f 100644 Binary files a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex index 615e49406d4..c463401af5d 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex @@ -1,9 +1,9 @@ -%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) %% Driver file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016 by Dr. Christian Hupfer +%% Copyright (c) 2015 -- 2016 by Dr. Christian Hupfer %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -21,7 +21,6 @@ \documentclass{book} -\usepackage{graphicx} \usepackage{xcolor} \usepackage{totcount} \usepackage{calc} @@ -192,22 +191,6 @@ Internal name: \TotalCounterInternalName{equations} \end{table} -\BackupCounterValues{chapter,section,equation} - -\chapter{A new chapter} - -\begin{equation} - E=mc^2 -\end{equation} - -\RestoreAllCounterValues - -\chapter{Another new chapter} - -\begin{equation} - E=mc^2 -\end{equation} - diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf index 788ce9bac06..718f8cfafd7 100644 Binary files a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex index f5d9fd41a1f..2045a13e5ba 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex @@ -1,9 +1,9 @@ -%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) %% Example file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016 by Dr. Christian Hupfer +%% Copyright (c) 2015 -- 2016 by Dr. Christian Hupfer %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -43,7 +43,6 @@ % 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 index c5e1e356251..e4e8a5292d0 100644 Binary files a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex index fa40a6e109a..3d73c470b9a 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) %% Example file for periodic counters file for xassoccnt.sty %% %% @@ -56,7 +56,6 @@ Value of foocntr is \thefoocntr\ now! \section{My nice section \x} } -%\RemovePeriodicCounter[resetperiodic=false]{section} \clearpage @@ -74,5 +73,15 @@ Value of foocntr is \thefoocntr\ now! } +\clearpage + +Now removing all periodic counters, but don't reset them +\RemoveAllPeriodicCounters[reset=false]% + +\foreach \x in {1,...,22} {% + \section{Section after removing periodic counters \x} +} + + \end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf new file mode 100644 index 00000000000..0beff930ee2 Binary files /dev/null and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex new file mode 100644 index 00000000000..800a130d827 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex @@ -0,0 +1,75 @@ +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) +%% Example file for reset list features file for xassoccnt.sty +%% +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2016 by Dr. Christian Hupfer +%% ------------------------------------------------------------------------------------------- +%% +%% 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{chngcntr} + +\usepackage{xassoccnt} + +\newcommand{\showfullresetlist}[1]{% +\item Counter name: #1 \hfill \csname the#1\endcsname%\leavevmode% +} + +\begin{document} + +\chapter{First} + +\section{First section} +\begin{itemize} + \LoopFullCounterResetList{chapter}{\showfullresetlist} +\end{itemize} + +\begin{figure} +\caption{A dummy figure} +\end{figure} + +\RemoveFromFullReset{section}{chapter} + + +\chapter{Second Chapter} + +\section{First section in 2nd chapter} +\begin{itemize} + \LoopFullCounterResetList{chapter}{\showfullresetlist} +\end{itemize} + +\begin{figure} +\caption{Another dummy figure} +\end{figure} + + +\AddToReset{section}{chapter} + + +\chapter{Third Chapter} + +\section{First section in 3rd chapter} +\begin{itemize} + \LoopFullCounterResetList{chapter}{\showfullresetlist} +\end{itemize} + +\begin{figure} +\caption{Another dummy figure} +\end{figure} + + +\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 index 81e04e2f750..0a21b82596a 100644 Binary files a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf differ 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 7eb2cfaf3a8..3be58383f1d 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.9 (2016/06/19 -- 08/11/05) +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) %% 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 index ea8135abd0a..bce7c3f905c 100644 Binary files a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf and b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf differ diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex index 16d895b7701..058fed07182 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex @@ -1,9 +1,9 @@ -%% LaTeX package xassoccnt - version 0.9 (2016/06/19 -- 08/11/05) +%% LaTeX package xassoccnt - version 1.0 (2016/07/28 -- 21/05/18) %% Example file for total counters file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2016 by Dr. Christian Hupfer +%% Copyright (c) 2015 -- 2016 by Dr. Christian Hupfer %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -31,6 +31,9 @@ The total value of section is \TotalValue{section} +The real name is \TotalCounterInternalNameExp{section}% + + \ifnum\TotalValue{section} > 1\relax Hooray \else only one section found\fi \blinddocument -- cgit v1.2.3