texlive[42980] Master/texmf-dist: xcntperchap
commits+karl at tug.org
commits+karl at tug.org
Tue Jan 17 23:24:06 CET 2017
Revision: 42980
http://tug.org/svn/texlive?view=revision&revision=42980
Author: karl
Date: 2017-01-17 23:24:06 +0100 (Tue, 17 Jan 2017)
Log Message:
-----------
xcntperchap
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/xcntperchap/README
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_doc.pdf
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_doc.tex
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_driver.pdf
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_driver.tex
trunk/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.pdf
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.tex
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.pdf
trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.tex
Modified: trunk/Master/texmf-dist/doc/latex/xcntperchap/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xcntperchap/README 2017-01-17 22:23:47 UTC (rev 42979)
+++ trunk/Master/texmf-dist/doc/latex/xcntperchap/README 2017-01-17 22:24:06 UTC (rev 42980)
@@ -1,9 +1,9 @@
-%% LaTeX package xcntperchap - version 0.2 (2016/06/07 -- 09/05/23)
+%% LaTeX package xcntperchap - version 0.3 (2017/01/13 -- 23:24:36)
%% README file for xcntperchap.sty
%%
%%
%% -------------------------------------------------------------------------------------------
-%% Copyright (c) 2016 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de>
+%% Copyright (c) 2016 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
@@ -22,7 +22,7 @@
The package xcntperchap provides a way of investigating how many subsections per chapter etc. are in a certain chapter etc beforehand, i.e. at the begin of the second compilation run this is information is available.
-As of 2016/06/07 xcntperchap does not supersede the package cntperchap by the same author, however,
-the older package isn't declared obsolete as of 2016/06/07
+As of 2017/01/13 xcntperchap does not supersede the package cntperchap by the same author, however,
+the older package isn't declared obsolete as of 2017/01/13
Added: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.pdf 2017-01-17 22:23:47 UTC (rev 42979)
+++ trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.pdf 2017-01-17 22:24:06 UTC (rev 42980)
Property changes on: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_basicusage.tex 2017-01-17 22:24:06 UTC (rev 42980)
@@ -0,0 +1,67 @@
+%% LaTeX package xcntperchap - version 0.3 (2017/01/13 -- 23:24:36)
+%% Basic usage example file for xcntperchap.sty
+%%
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
+%% -------------------------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%%
+%% This work has the LPPL maintenance status `author-maintained`
+%%
+%%
+
+\documentclass{article}
+
+\usepackage{xcntperchap}
+\usepackage{enumitem}
+
+
+
+\RegisterCounters{section}{enumi}
+\RegisterCounters{subsection}{enumi}
+
+\begin{document}
+\tableofcontents
+
+\section{Section 1 -- with \ObtainTrackedValueExp{section}{enumi} items}
+ \begin{enumerate}[resume]
+ \item Item 1
+ \item Item 2
+ \item Item 3
+ \end{enumerate}
+
+\subsection{Another subsection with \ObtainTrackedValueExp{subsection}{enumi} items}
+
+\begin{enumerate}[resume]
+\item Item 4
+\item Item 5
+\end{enumerate}
+
+
+\section{Section 2 -- with \ObtainTrackedValueExp{section}{enumi} items}
+\begin{enumerate}[resume]
+\item Item 6
+\item Item 7
+\end{enumerate}
+
+\subsection{Another subsection with \ObtainTrackedValueExp[2]{subsection}{enumi} Items } % Second total subsection to be used.
+
+\begin{enumerate}[resume]
+\item Item 8
+\item Item 9
+\item Item 10
+\item Item 11
+\item Item 12
+\item Item 13
+\end{enumerate}
+
+\end{document}
Modified: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_doc.tex 2017-01-17 22:23:47 UTC (rev 42979)
+++ trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_doc.tex 2017-01-17 22:24:06 UTC (rev 42980)
@@ -1,9 +1,9 @@
-%% LaTeX package xcntperchap - version 0.2 (2016/06/07 -- 09/05/23)
+%% LaTeX package xcntperchap - version 0.3 (2017/01/13 -- 23:24:36)
%% Documentation file for xcntperchap.sty
%%
%%
%% -------------------------------------------------------------------------------------------
-%% Copyright (c) 2016 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de>
+%% Copyright (c) 2016 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
@@ -29,6 +29,7 @@
\usepackage{bbding}
\savesymbol{Cross}
+\usepackage{graphicx}
\usepackage{blindtext}
\usepackage[x11names]{xcolor}
\usepackage{imakeidx}
@@ -77,7 +78,11 @@
\@namedef{xcntperchapversion0.1}{v0.1 2016-05-22}
\@namedef{xcntperchapversion0.2}{v0.2 2016-06-07}
+\@namedef{xcntperchapversion0.3}{v0.3 2017-01-09}
+\newcommand{\authorname}{Autor}
+
+
\makeatother
@@ -127,7 +132,7 @@
\today \tabularnewline
\tabularnewline
\addtocounter{footnote}{2}
- Author: \KVchdocpackageauthor\(^\mathrm{\fnsymbol{footnote}}\)
+ \authorname: \KVchdocpackageauthor\(^\mathrm{\fnsymbol{footnote}}\)
\tabularnewline
\end{tabular}
\end{center}
@@ -242,15 +247,57 @@
\end{itemize}
}
+
+
+\renewcommand{\tcbdocnew}[1]{#1}%
+\renewcommand{\tcbdocupdated}[1]{#1}%
+
+\newcommand{\CHDocNew}[1]{%
+ \tcbdocmarginnote[doclang/new={N},
+ colframe=blue,
+ halign=left,
+ colback={blue!20!white},
+ fontupper={\tiny}
+ ]{%
+ \chdocextractversion{xcntperchapversion#1}%
+ }%
+}
+
+
+
+\newcommand{\CHDocUpdate}[1]{\tcbdocmarginnote[doclang/updated={},colback={yellow},colframe={yellow!50!red}, fontupper={\tiny}
+]{%
+ \tcbdocupdated{\chdocextractversion{xcntperchapversion#1}}%
+}%
+}
+
+
+
+\newcommand{\CHDocFullVersion}[1]{Version \chdocextractversion{xcntperchapversion#1}}
+
+
+\newcommand{\CHDocExpCommand}[1][Expandable]{%
+ \tcbdocmarginnote[doclang/new={N},
+ colframe=green!50!blue,
+ halign=left,
+ colback={green!90!blue},
+ fontupper={\tiny}
+ ]{%
+ #1%
+ }%
+}
+
+
+
\usepackage{xcntperchap}
+\usepackage{cleveref}
-
\newcommand{\PackageDocName}{xcntperchap}%
\newcommand{\mymailtoaddress}{%
- christian.hupfer at yahoo.de
+ typography.with.latex at gmail.com
}
@@ -258,7 +305,7 @@
\makeindex[intoc]
-\RegisterCounters{section}{subsection,subsubsection,table,figure}
+\RegisterTrackCounter{section}{subsection,subsubsection,table,figure}
\hypersetup{breaklinks=true}
@@ -297,7 +344,7 @@
\section{Disclaimer}
-This package as of its version \packageversion\ is a rewrite of the former \CHDocPackage{cntperchap} by the same author, is under constant development and as such subject to macro interface changes as well as renaming of macros. Not all features of the previous package has been incorporated so far -- if some functionality of your document depends on \CHDocPackage{assoccnt}, continue using the older version and shift gradually to \CHDocPackage{\PackageDocName} please.
+This package as of its version \packageversion\ is a rewrite of the former \CHDocPackage{cntperchap} by the same author, is under constant development and as such subject to macro interface changes as well as renaming of macros. Not all features of the previous package has been incorporated so far -- if some functionality of your document depends on \CHDocPackage{assoccnt}, continue using the older version and shift gradually to \CHDocPackage{\PackageDocName} please, which uses the newer \CHDocPackage{xassoccnt}.
\begin{marker}
Most times class and package authors will benefit of this package, but there might be usual documents that need the features of |\PackageDocName||
@@ -331,6 +378,7 @@
Since \CHDocPackage{\PackageDocName} is written using \CHDocPackage{expl3}, it requires the \CHDocPackage{xparse} package. It relies on the features of associated counters introduced by \CHDocPackage{xassoccnt}, this package is also needed%
\begin{itemize}
+\item \CHDocPackage{zref}%
\item \CHDocPackage{expl3}%
\item \CHDocPackage{xparse}%
\item \CHDocPackage{xassoccnt}%
@@ -352,11 +400,11 @@
\subsection{Preamble only commands}
-\begin{docCommand}{RegisterCounters}{\marg{track counter}\marg{counter1, counter2,...}} \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xcntperchapversion0.1}}}
+\begin{docCommand}{RegisterTrackCounter}{\marg{track counter}\marg{counter1, counter2,...}} \CHDocNew{0.3}
This provides the means to let the package know that the counters should be tracked for values inside a certain track level -- specify this in the document preamble.
-\begin{docCommandArgs}{RegisterCounters}%
+\begin{docCommandArgs}{RegisterTrackCounter}%
\begin{itemize}
\item \marg{track counter}
This contains the counter name which is the track level, e.g. \CHDocCounter*{section}
@@ -368,10 +416,37 @@
\end{docCommand}%
+
+\begin{docCommand}{RegisterMultipleTrackCounters}{\marg{track counter 1, track counter 2,...}\marg{counter1, counter2,...}} \CHDocNew{0.3}
+
+This provides the means to let the package know that the counters should be tracked for values inside multiple track levels -- specify this in the document preamble.
+
+All counters in the 2nd mandatory argument will be tracked by \textbf{all} track levels.
+
+\begin{docCommandArgs}{RegisterMultipleTrackCounters}%
+ \begin{itemize}
+ \item \marg{track level 1, track level 2,...}
+ This list contains the counters which are track levels
+ \item \marg{counter1, counter2,...}
+ This marks the counters to be tracked inside of each(!) track level.
+\end{itemize}
+\end{docCommandArgs}
+
+\end{docCommand}%
+
+
+
+\begin{docCommand}{RegisterCounters}{\marg{track counter}\marg{counter1, counter2,...}} \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xcntperchapversion0.1}}}
+
+\refCom{RegisterCounters} has the some meaning like \refCom{RegisterTrackCounter} and is the old name for this. Use the newer version for new documents since this command will be removed one day.
+\end{docCommand}%
+
+
+
\section{User commands}
-\begin{docCommand}{ObtainTrackedValue}{\oarg{counter value}\marg{track level}\marg{tracked counter}} \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xcntperchapversion0.1}}}
+\begin{docCommand}[doc new={\chdocextractversion{xcntperchapversion0.1}}]{ObtainTrackedValue}{\oarg{counter value}\marg{track level}\marg{tracked counter}}% \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xcntperchapversion0.1}}}
This command prints the value of the tracked counter of a track counter, i.e. the number of subsections in a specific chapter, say, the 5th chapter can be obtained by
@@ -392,15 +467,79 @@
\end{marker}
\end{docCommand}
-\clearpage
-\begin{docCommand}{ObtainTrackedValueExp}{\oarg{counter value}\marg{track level}\marg{tracked counter}} \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xcntperchapversion0.2}}}
+\begin{docCommand}[before={\CHDocExpCommand}]{ObtainTrackedValueExp}{\oarg{counter value}\marg{track level}\marg{tracked counter}} \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xcntperchapversion0.2}}}
-This command is the expandable version of \refCom{ObtainTrackedValue} and should be used if are calculations, comparisions and write - operations to files are requested.
+This command is the expandable version of \refCom{ObtainTrackedValue} and should be used if calculations, comparisions and write - operations to files are requested.
The meaning of arguments is the same as in \refCom{ObtainTrackedValue}.
\end{docCommand}
+
+
+
+\section{Experimental features}\CHDocNew{0.3}
+
+\begin{marker}
+The content and description of the features are marked as experimental as of version \packageversion. Features are subject to changes as well as macro names might be revised in future versions.
+\end{marker}
+
+The tracking of counters with respect to some fixed number of a track level counter might get tedious, i.e. it is not very convenient to remember a special section number of which counter \CHDocCounter{foo} should be tracked. \CHDocPackage{\PackageDocName} provides the possibility to add a label to some track level counter and obtaining the running total number of the relevant counter by using \refCom{ObtainTrackedValueByLabel}.
+
+
+\begin{docCommand}{tracklabel}{\oarg{counter name}\marg{label name}} \CHDocNew{0.3}
+ \cs{tracklabel} provides a label given in the first mandatory argument to a track level counter -- the counter is being auto detected with \cs{LastRefSteppedCounter} from \CHDocPackage{xassoccnt}.
+
+In addition, the a label with the same name is set with the usual \cs{label} command. Use \refCom{tracklabel*} to suppress the generation of such labels.
+
+\begin{codeoptionsenum}
+\item \oarg{counter name}: This is only used as an optional argument to the \cs{label} command as provided by \CHDocPackage{cleveref}.
+\item \marg{label name}: A label for a track level counter.
+\end{codeoptionsenum}
+
+\end{docCommand}
+
+\begin{docCommand}{tracklabel*}{\oarg{counter name}\marg{label name}} \CHDocNew{0.3}
+This is the starred version of \refCom{tracklabel} but does not generate a usual label of the name given with the first mandatory argument. The optional argument is ignored as of version \packageversion.
+\end{docCommand}
+
+
+
+\begin{marker}
+Please note that the usability of \refCom{tracklabel} is restricted to track level counters that have been used with \cs{refstepcounter} as of version \packageversion!
+
+\end{marker}
+
+
+\begin{docCommand}[before={\CHDocExpCommand}]{ObtainTrackedValueByLabel}{\oarg{counter name}\marg{label name}\marg{tracked counter}} \CHDocNew{0.3}
+
+This command uses a label given with \refCom{tracklabel} to some track level counter usage and will return the relevant number of the tracked counter. The underlying track level counter is autodetected using \CHDocPackage{zref} properties.
+\begin{codeoptionsenum}
+\item \oarg{counter name}: Use this to override the auto detection of the track level counter. This might cause unpredictable logical errors, however.
+\item \marg{label name}: A label for a track level counter.
+\item \marg{tracked counter}: The name of a counter being in the tracking list of the (auto detected) track level counter.
+\end{codeoptionsenum}
+
+\begin{itemize}
+\item If the given label is not defined, a \texttt{??} is printed instead. As of version \packageversion\ there is no warning or error message.
+\item This command is expandable!
+\end{itemize}
+\end{docCommand}
+
+See \Cref{packageexample::tracking_by_label} for an example using the tracking - by - label - feature.
+
+
+
+\begin{docCommand}{AddToTrackedCounters}{\marg{tracked counters}\marg{counter value}} \CHDocNew{0.3}
+ This macro adds the same value to a comma separated list of tracked counters without using \cs{stepcounter}.
+ \begin{codeoptionsenum}
+ \item \marg{tracked counters}: A comma separated list of counter names.
+ \item \marg{counter value}: An integer value
+ \end{codeoptionsenum}
+\end{docCommand}
+
+
+
\section{Examples}
\subsection[Item count of enumerate]{Count the items of an enumerate}
@@ -457,6 +596,65 @@
\end{dispListing}
+\subsection[Item count of enumerate -- alternate version]{Count the items of an enumerate -- with label reference}\label{packageexample::tracking_by_label}
+
+
+\tcbset{breakable}
+\begin{dispListing}
+\documentclass{article}
+
+\usepackage{xcntperchap}
+\usepackage{enumitem}
+
+
+
+\RegisterCounters{section}{enumi}
+\RegisterCounters{subsection}{enumi}
+
+\begin{document}
+\tableofcontents
+
+\section{Section 1 -- with \ObtainTrackedValueExp{section}{enumi} items} \tracklabel{sectionlabel}
+ \begin{enumerate}[resume]
+ \item Item 1
+ \item Item 2
+ \item Item 3
+ \end{enumerate}
+
+\subsection{Another subsection with \ObtainTrackedValueExp{subsection}{enumi} items}
+
+\begin{enumerate}[resume]
+\item Item 4
+\item Item 5
+\end{enumerate}
+
+
+\section{Section 2 -- with \ObtainTrackedValueExp{section}{enumi} items}
+\begin{enumerate}[resume]
+\item Item 6
+\item Item 7
+\end{enumerate}
+
+\subsection{Another subsection with \ObtainTrackedValueExp[2]{subsection}{enumi} Items } \tracklabel{subsec::somelabel}
+
+
+However, you can use a label as well: \ObtainTrackedValueByLabel{subsec::somelabel}{enumi} Items
+
+\begin{enumerate}[resume]
+\item Item 8
+\item Item 9
+\item Item 10
+\item Item 11
+\item Item 12
+\item Item 13
+\end{enumerate}
+
+\end{document}
+\end{dispListing}
+
+
+
+
\clearpage
\section{To-Do list}\label{section::todo}
@@ -508,7 +706,13 @@
\section{Version history}
-\begin{itemize}
+\begin{itemize}[itemsep=15pt]
+\item \CHDocFullVersion{0.3}
+ \begin{itemize}
+ \item \CHDocNew{0.3} Support for obtaining a tracked value level by using labels with \refCom{tracklabel}, \refCom{tracklabel*} and \refCom{ObtainTrackedValueByLabel}
+ \item \CHDocNew{0.3} Added the \refCom{RegisterTrackCounter} and \refCom{RegisterMultipleTrackCounters} as a replacement of \refCom{RegisterCounters}.
+ \item Added \refCom{AddToTrackedCounters} macro to circumvent counter value update problems for specific tracked counters.
+ \end{itemize}
\item
Version \chdocextractversion{xcntperchapversion0.2} \tcbdocmarginnote{\tcbdocnew{\chdocextractversion{xcntperchapversion0.2}}}
\begin{itemize}
Modified: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_driver.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_driver.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_driver.tex 2017-01-17 22:23:47 UTC (rev 42979)
+++ trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_driver.tex 2017-01-17 22:24:06 UTC (rev 42980)
@@ -1,3 +1,24 @@
+%% LaTeX package xcntperchap - version 0.3 (2017/01/13 -- 23:24:36)
+%% Driver examples file for xcntperchap.sty
+%%
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2016 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
+%% -------------------------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%%
+%% This work has the LPPL maintenance status `author-maintained`
+%%
+%%
+
%% LaTeX package xcntperchap - version 0.2 (2016/06/07 -- 09/05/23)
%% Driver file for xcntperchap.sty
%%
Added: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.pdf 2017-01-17 22:23:47 UTC (rev 42979)
+++ trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.pdf 2017-01-17 22:24:06 UTC (rev 42980)
Property changes on: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xcntperchap/xcntperchap_labelusage.tex 2017-01-17 22:24:06 UTC (rev 42980)
@@ -0,0 +1,71 @@
+%% LaTeX package xcntperchap - version 0.3 (2017/01/13 -- 23:24:36)
+%% Label usage example file for xcntperchap.sty
+%%
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
+%% -------------------------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%%
+%% This work has the LPPL maintenance status `author-maintained`
+%%
+%%
+
+\documentclass{article}
+
+\usepackage{xcntperchap}
+\usepackage{enumitem}
+
+
+
+\RegisterCounters{section}{enumi}
+\RegisterCounters{subsection}{enumi}
+
+\begin{document}
+\tableofcontents
+
+\section{Section 1 -- with \ObtainTrackedValueExp{section}{enumi} items} \tracklabel{sectionlabel}
+ \begin{enumerate}[resume]
+ \item Item 1
+ \item Item 2
+ \item Item 3
+ \end{enumerate}
+
+\subsection{Another subsection with \ObtainTrackedValueExp{subsection}{enumi} items}
+
+\begin{enumerate}[resume]
+\item Item 4
+\item Item 5
+\end{enumerate}
+
+
+\section{Section 2 -- with \ObtainTrackedValueExp{section}{enumi} items}
+\begin{enumerate}[resume]
+\item Item 6
+\item Item 7
+\end{enumerate}
+
+\subsection{Another subsection with \ObtainTrackedValueExp[2]{subsection}{enumi} Items } \tracklabel{subsec::somelabel}
+
+
+However, you can use a label as well: \ObtainTrackedValueByLabel{subsec::somelabel}{enumi}{} Items
+
+\begin{enumerate}[resume]
+\item Item 8
+\item Item 9
+\item Item 10
+\item Item 11
+\item Item 12
+\item Item 13
+\end{enumerate}
+
+\end{document}
+
Modified: trunk/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty 2017-01-17 22:23:47 UTC (rev 42979)
+++ trunk/Master/texmf-dist/tex/latex/xcntperchap/xcntperchap.sty 2017-01-17 22:24:06 UTC (rev 42980)
@@ -1,9 +1,9 @@
-%% LaTeX package xcntperchap - version 0.2 (2016/06/07 -- 09/05/23)
+%% LaTeX package xcntperchap - version 0.3 (2017/01/13 -- 23:24:36)
%% Source file for xcntperchap.sty
%%
%%
%% -------------------------------------------------------------------------------------------
-%% Copyright (c) 2016 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de>
+%% Copyright (c) 2016 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
@@ -19,11 +19,12 @@
%%
%%
-\def\xcntperchappackageversion{0.2}
+\def\xcntperchappackageversion{0.3}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{xcntperchap}[2016/06/07 - v\xcntperchappackageversion]
+\ProvidesPackage{xcntperchap}[2017/01/13 - v\xcntperchappackageversion]
+\RequirePackage[counter]{zref}
\RequirePackage{xparse}
\RequirePackage{l3keys2e}
\RequirePackage[nonumberofruns]{xassoccnt}
@@ -33,6 +34,7 @@
\let\latex@@stepcounter\stepcounter
+\let\latex@@addtocounter\addtocounter
\cs_generate_variant:Nn \int_set:Nn {NV, Nx}
@@ -57,10 +59,25 @@
\seq_new:c {g_xcntperchap_tracklevel_#1_seq}% Creating a new container for the counter names to be tracked
\prop_new:c {g_xcntperchap_tracklevel_#1_prop}% Creating a new property list for the counter names to be tracked
\seq_new:c {g_xcntperchap_tracklevelstored_#1_seq}% Creating a new container for the stored counter values (used later on)
+ \IfIsDocumentCounterF{cps@@#1trackleveltotal}{%
+ \NewDocumentCounter{cps@@#1trackleveltotal}%
+ }
+ \DeclareAssociatedCounters{#1}{cps@@#1trackleveltotal}
+ \zref at newprop{cps#1total}{\number\value{cps@@#1trackleveltotal}}
}%
}
-\NewDocumentCommand{\RegisterCounters}{mm}{%
+
+
+\NewDocumentCommand{\RegisterMultipleTrackCounters}{mm}{%
+ \clist_set:Nn \l_tmpa_clist {#1}%
+ \clist_map_inline:Nn \l_tmpa_clist {%
+ \RegisterTrackCounter{##1}{#2}%
+ }
+}
+
+
+\NewDocumentCommand{\RegisterTrackCounter}{mm}{%
\xcntperchap_add_tracklevel:n {#1}
\seq_set_from_clist:cn {g_xcntperchap_tracklevel_#1_seq} {#2}
\seq_remove_duplicates:c {g_xcntperchap_tracklevel_#1_seq}
@@ -71,11 +88,12 @@
\NewDocumentCounter{cps@@#1total##1}%
\AddAssociatedCounters{##1}{cps@@#1total##1}% Define associated counters
}
- \prop_put:cnV {g_xcntperchap_tracklevel_#1_prop} {##1} {\l_tmpa_int} % New Version 0.2
- }
+ \prop_put:cnV {g_xcntperchap_tracklevel_#1_prop} {##1} \l_tmpa_int % New Version 0.2
+ }
}
+
\cs_new:Nn \xcntperchap_storetracked_values:n{%
\tl_clear:N \l_tmpa_tl
\int_zero:N \l_tmpa_int
@@ -93,7 +111,7 @@
\iow_now:Nx \g_trackfile_storage_write {\l_tmpa_tl}%
}
\seq_map_inline:cn {g_xcntperchap_tracklevel_#1_seq} {
- \setcounter{cps@@#1total##1}{0}% Reset the total counter values
+ \setcounter{cps@@#1total##1}{\c_zero}% Reset the total counter values
}
}
}
@@ -109,7 +127,7 @@
% Must get reset list first
\__xassoccnt_getresetlist:n{#1}%
\seq_map_inline:Nn \g_xcntperchap_tracklevel_seq {%
- \seq_if_in:NnT \l__xassoccnt_counterreset_seq {##1} {
+ \seq_if_in:NnT \l__xassoccnt_counterreset_seq {##1} {%
\StoreCounterValues{##1}%
}
}
@@ -118,7 +136,17 @@
}
+\NewDocumentCommand{\AddToTrackedCounters}{mm}{%
+ \seq_set_from_clist:Nn \l_tmpa_seq {#1}
+ \seq_map_inline:Nn \l_tmpa_seq {%
+ \prg_replicate:nn {#2} {\stepcounter{##1}}
+ }
+}
+
+
+
+
\cs_new_nopar:Nn \xcntperchap_trackcounters: {%
\seq_map_inline:cn {g_xcntperchap_tracklevel_seq} {%
\xcntperchap_storetracked_values:n{##1}%
@@ -143,7 +171,15 @@
}
+\cs_new:Nn \l_xcntperchap_numberoftracks:n {%
+ \seq_if_exist:cTF { g_xcntperchap_tracklevelstored_#1_seq} {%
+ \int_eval:n {\seq_count:c {g_xcntperchap_tracklevelstored_#1_seq} / \seq_count:c {g_xcntperchap_tracklevel_#1_seq}}
+ }{
+ \c_zero
+ }
+}
+
\cs_new:Nn \xcntperchap_open_trackfile_for_read:n {%
\ior_open:Nn \g_trackfile_storage_read {#1}
}
@@ -217,25 +253,7 @@
%%%%% 0.2 Expandable Version
-\cs_new:Nn \xcntperchap_obtaintrackedvalue_exp_orig:nnn {%
- \int_set:Nx \l_tracklevelunit_int {#1}
- \seq_if_in:cnT {g_xcntperchap_tracklevel_#2_seq} {#3}
- {
- \int_set:Nx \l_tracklevel_tracked_int {\seq_count:c {g_xcntperchap_tracklevel_#2_seq}}
- \int_zero:N \l_tmpa_int
- \seq_map_inline:cn {g_xcntperchap_tracklevel_#2_seq} {%
- \int_incr:N \l_tmpa_int
- \tl_if_eq:nnT { ##1 } {#3 } {
- \seq_map_break:
- }
- }
- \int_set:NV \l_tmpb_int { \l_tmpa_int }
- \int_set:Nx \l_tmpa_int { \l_tracklevel_tracked_int * (\l_tracklevelunit_int -1) + \l_tmpb_int }
- \seq_item:cn {g_xcntperchap_tracklevelstored_#2_seq} {\int_use:N \l_tmpa_int}
- }%
-}
-
\cs_new:Nn \xcntperchap_obtaintrackedvalue_exp:nnn {% Needs some error checking!!!
\seq_if_exist:cTF {g_xcntperchap_tracklevel_#2_seq} {
\seq_item:cn {g_xcntperchap_tracklevelstored_#2_seq} { \seq_count:c {g_xcntperchap_tracklevel_#2_seq} * \int_eval:n{#1-1}+\prop_item:cn {g_xcntperchap_tracklevel_#2_prop} {#3}}
@@ -259,9 +277,60 @@
+
\ExplSyntaxOff
+\newif\if at cpscleverefloaded
+
+\AtBeginDocument{%
+ \@ifpackageloaded{cleveref}{%
+ \@cpscleverefloadedtrue
+ }{%
+ \@cpscleverefloadedfalse
+ }
+}
+
+
+\NewDocumentCommand{\tracklabel}{som}{%
+ \zref at labelbyprops{#3}{counter,cps\LastRefSteppedCounter total}% The counter property is for safety here!
+ \IfBooleanF{#1}{% No starred version, generate the usual \label
+ % Check first whether we're using cleveref
+ \IfValueTF{#2}{%
+ \@ifcleverefloadedtrue
+ \label[#2]{#3}%
+ \else
+ % ignore the optional argument provided by tracklabel, it's of use since cleveref is not loaded.
+ \label{#3}%
+ \fi
+ }{% No optional argument
+ \label{#3}%
+ }%
+ }% End of checking for starred command
+}
+
+
+
+\DeclareExpandableDocumentCommand{\ObtainTrackedValueByLabel}{omm}{%
+ \zref at ifrefundefined{#2}{??}{%
+ \IfValueTF{#1}{%
+ \ObtainTrackedValueExp[\zref at extract{#2}{cps#1total}]{#1}{#3}%
+ }{%
+ \ObtainTrackedValueExp[\zref at extract{#2}{cps\zref at extract{#2}{counter}total}]{\zref at extract{#2}{counter}}{#3}%
+ }%
+ }%
+}
+
+
+\NewDocumentCommand{\RegisterCounters}{mm}{%
+ \RegisterTrackCounter{#1}{#2}%
+}
+
+
+
+\@onlypreamble\RegisterTrackCounter
+\@onlypreamble\RegisterMultipleTrackCounters
\@onlypreamble\RegisterCounters
+
\makeatother
More information about the tex-live-commits
mailing list