summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-11-15 23:54:09 +0000
committerKarl Berry <karl@freefriends.org>2015-11-15 23:54:09 +0000
commit3c77a0b2cd0c8da653ad55d5b6c0c44a567e249f (patch)
tree835eadf598cc1073a73d354a4e72f3a92e706710 /Master/texmf-dist
parent3dc8864da1f30b905db0e9a10a5cad3478907bab (diff)
xassoccnt (14nov15)
git-svn-id: svn://tug.org/texlive/trunk@38868 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/xassoccnt/README38
-rw-r--r--Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdfbin220014 -> 223961 bytes
-rw-r--r--Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex174
-rw-r--r--Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdfbin63062 -> 64941 bytes
-rw-r--r--Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex50
-rw-r--r--Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdfbin68837 -> 68837 bytes
-rw-r--r--Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex36
-rw-r--r--Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty160
8 files changed, 283 insertions, 175 deletions
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/README b/Master/texmf-dist/doc/latex/xassoccnt/README
index 7d638ee2d5b..58962724610 100644
--- a/Master/texmf-dist/doc/latex/xassoccnt/README
+++ b/Master/texmf-dist/doc/latex/xassoccnt/README
@@ -1,8 +1,10 @@
-%% LaTeX package xassoccnt - version 0.1 (2015/11/07)
+%% LaTeX package xassoccnt - version 0.2 (2015/11/14 -- 16/08/33)
+%% README file for xassoccnt.sty
+%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2015 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de>
-%% ------------------------------------------------------------------------------------------
+%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -12,9 +14,9 @@
%% 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 `maintained'.
%%
-%% This work consists of all files listed in README
+%% This work has the LPPL maintenance status `author-maintained`
+%%
%%
@@ -24,31 +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 2015/11/07 xassoccnt does not supersedes the package assoccnt by the same author, however,
-the older package isn't declared obsolete as of 2015/11/07.
-
-
-This first version provides a complete rewrite using `expl3` features
-
--- better handling of options (compared to assoccnt) and more macros
--- prevention of cross-association of driver and (already) associated counters
--- disabled self-association of a counter
--- better checking if the macro arguments are counters
--- an autodefinition of counters if needed
--- improved suspension and resuming of counters
--- syncing of driver counters and associated counters after some special change
--- Improved documentation (compared to assoccnt)
-
-Some notes:
-
--- calc and xassoccnt work together only if calc is loaded before `xassoccnt`
--- The `\PrettyCounterInfo` macros etc. has been removed.
-
+As of 2015/11/14 xassoccnt does not supersede the package assoccnt by the same author, however,
+the older package isn't declared obsolete as of 2015/11/14
-Directory listing:
- xassoccnt_driver.pdf 63062 11/07/15 02:16:55
- xassoccnt_driver.tex 3352 11/07/15 02:16:22
- xassoccnt_example.pdf 68837 11/07/15 02:16:51
- xassoccnt_example.tex 4390 11/07/15 02:16:22
- xassoccnt.sty 25921 11/07/15 02:16:56
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf
index 53681d349e4..7836955581c 100644
--- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf
+++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex
index 955eb7aed63..9e398d173f7 100644
--- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex
+++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex
@@ -1,6 +1,5 @@
-%% LaTeX package assoccnt - version 0.1 (2015/11/07)
-%% Documentation for assoccnt.sty
-%%
+%% LaTeX package xassoccnt - version 0.2 (2015/11/14 -- 16/08/33)
+%% Documentation file for xassoccnt.sty
%%
%%
%% -------------------------------------------------------------------------------------------
@@ -15,27 +14,71 @@
%% 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'.
%%
-%% This work consists of all files listed in README
+%% This work has the LPPL maintenance status `author-maintained`
+%%
%%
-
\documentclass[12pt,paper=a4]{article}
+
+
\usepackage[lmargin=2cm,rmargin=2cm,headheight=15pt]{geometry}
-\usepackage{savesym}%
-\usepackage{bbding}%
-\savesymbol{Cross}%
+\usepackage{savesym}
+\usepackage{bbding}
+\savesymbol{Cross}
+
+\usepackage{blindtext}
+\usepackage[x11names]{xcolor}
+\usepackage{imakeidx}
+
+\usepackage[most,documentation]{tcolorbox}
+
+
+
+\usepackage[tikz]{bclogo}
+\usepackage{marginnote}
+\usepackage{fancyhdr}
+\usepackage{datetime}
+\usepackage{array}
+
+
+
+\usepackage{totcount}
+\usepackage{enumitem}%
+\usepackage{microtype}
+\usepackage[scaled=0.92]{helvet}
+
+\newlist{codeoptionsenum}{enumerate}{1}
+\setlist[codeoptionsenum,1]{label={\textcolor{blue}{\#\arabic*}}}
+
+
+\newcommand{\packagename}[1]{\fbox{\textcolor{blue}{\textbf{\ding{41}~#1}}}\index{Package!#1}}%
+\newcommand{\classname}[1]{\fbox{\textcolor{brown}{\textbf{\Writinghand~#1}}}\index{Class!#1}}%
+\newcommand{\handrightnote}{\tcbdocmarginnote{\ding{43}}}
+
+
+\fancypagestyle{plain}{%
+\fancyfoot[L]{\begin{tabular}[t]{l}\PackageDocName\ \packageversion \tabularnewline \textcopyright\ Dr. Christian Hupfer\end{tabular}}%
+\fancyfoot[C]{\thepage}%
+\fancyfoot[R]{\today}%
+\renewcommand{\headrule}{{\color{blue}%
+\hrule width\headwidth height\headrulewidth \vskip-\headrulewidth}}
+\renewcommand{\footrule}{{\color{blue}\vskip-\footruleskip\vskip-\footrulewidth
+\hrule width\headwidth height\footrulewidth\vskip\footruleskip}}
+\renewcommand{\footrulewidth}{2pt}
+\renewcommand{\headrulewidth}{2pt}
+}
+
+
+\newtcolorbox{docCommandArgs}[1]{colbacktitle={blue},coltitle={white},title={Description of arguments of command \cs{#1}}}
-\usepackage{blindtext}%
-\usepackage[x11names]{xcolor}%
-\usepackage{imakeidx}%
-\usepackage[all]{tcolorbox}
+\newcommand{\tcolorboxdoclink}{http://mirrors.ctan.org/macros/latex/contrib/tcolorbox/tcolorbox.pdf}
% 'Stolen' from tcolorbox documentation ;-)
+
\newtcolorbox{marker}[1][]{enhanced,
before skip=2mm,after skip=3mm,
boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
@@ -50,69 +93,31 @@
drop fuzzy shadow,#1}
+\usepackage[autodefinecounters=true]{xassoccnt}
-\usepackage[tikz]{bclogo}
-\usepackage{marginnote}
-\usepackage{fancyhdr}
-\usepackage{datetime}%
-
-
-\usepackage{array}%
-
-
-
-\usepackage{amsmath}%
-\usepackage{amsthm}%
-
-\usepackage{calc} % Only for testing
-\usepackage{totcount}%
-\usepackage{enumitem}%
-\usepackage{microtype}
-\usepackage[scaled=0.92]{helvet}
-\usepackage[autodefinecounters=true]{xassoccnt}%
-
-\hypersetup{breaklinks=true,
- pdftitle={xassoccnt_doc.pdf},
- pdfauthor={Dr. Christian Hupfer},
- pdfsubject={Documentation of xassoccnt package},
- pdfkeywords={LaTeX, counters}
-}
-\usepackage{bookmark}%
+\usepackage{bookmark}
\usepackage{cleveref}
-\newlist{codeoptionsenum}{enumerate}{1}
-\setlist[codeoptionsenum,1]{label={\textcolor{blue}{\#\arabic*}}}
+\newcommand{\PackageDocName}{xassoccnt}%
-\renewcommand{\rmdefault}{\sfdefault}
-\newcommand{\packagename}[1]{\textcolor{blue}{\textbf{\Envelope~#1}}\index{Package!#1}}%
\newcommand{\mymailtoaddress}{%
christian.hupfer@yahoo.de
}
-\newcommand{\MarkupPackageName}[2][lightgray]{%
-\colorbox{#1}{\textcolor{black}{#2}}%
-}%
-
-\newcommand{\MarkupCounterName}[2][yellow]{%
-\colorbox{#1}{\textcolor{black}{\texttt{#2}}}%
-}%
-
-
-\let\DeclareAssociatedCountersOrig\DeclareAssociatedCounters
-
-\newtcolorbox{docCommandArgs}[1]{colbacktitle={blue},coltitle={white},title={Description of arguments of command \cs{#1}}}
+\let\DeclareAssociatedCountersOrig\DeclareAssociatedCounters % -> for use in examples only
\def\packageversion{\xassoccntpackageversion}%
-
\makeindex[intoc]
-\newcommand{\PackageDocName}{xassoccnt}%
+
+\renewcommand{\rmdefault}{\sfdefault}
+
\newtotcounter{totalpages}%
@@ -134,6 +139,15 @@
\DeclareAssociatedCounters{page}{totalpages,anothertotalpages}%
+\hypersetup{breaklinks=true,
+ pdftitle={\jobname.pdf -- version \packageversion},
+ pdfauthor={Dr. Christian Hupfer},
+ pdfsubject={Documentation of \PackageDocName\ package},
+ pdfkeywords={LaTeX, counters},
+ pdfcreator={LaTeX}
+}
+
+
\begin{document}
\mmddyyyydate
@@ -148,7 +162,7 @@
\large \bfseries%
\begin{center}%
\begin{tabular}{c}%
-\textsc{\PackageDocName} \tabularnewline
+\scshape \PackageDocName \tabularnewline
\tabularnewline
Associated counters stepping simultaneously \tabularnewline
\tabularnewline
@@ -175,17 +189,6 @@ Author: Christian Hupfer\(^\mathrm{\fnsymbol{footnote}}\)
-\fancypagestyle{plain}{%
-\fancyfoot[L]{\begin{tabular}[t]{l}\PackageDocName\ \packageversion \tabularnewline \textcopyright\ Dr. Christian Hupfer\end{tabular}}%
-\fancyfoot[C]{\thepage}%
-\fancyfoot[R]{\today}%
-\renewcommand{\headrule}{{\color{blue}%
-\hrule width\headwidth height\headrulewidth \vskip-\headrulewidth}}
-\renewcommand{\footrule}{{\color{blue}\vskip-\footruleskip\vskip-\footrulewidth
-\hrule width\headwidth height\footrulewidth\vskip\footruleskip}}
-\renewcommand{\footrulewidth}{2pt}
-\renewcommand{\headrulewidth}{2pt}
-}
\pagestyle{plain}
@@ -194,10 +197,10 @@ Author: Christian Hupfer\(^\mathrm{\fnsymbol{footnote}}\)
\section*{Preface}
-This package is the successor and a complete rewrite of \packagename{assoccnt}. Not all features of that package are implemented yet -- if some functionality of your document depends on \packagename{assoccnt}, continue using the older version and shift gradually to \packagename{xassoccnt} please.
+This package is the successor and a complete rewrite of \packagename{assoccnt}. Not all features of that package are implemented yet -- if some functionality of your document depends on \packagename{assoccnt}, continue using the older version and shift gradually to \packagename{\PackageDocName} please.
\begin{marker}
-Most times class and package authors will benefit of this package, but there might be usual documents that need the features of |xassoccnt|
+Most times class and package authors will benefit of this package, but there might be usual documents that need the features of |\PackageDocName||
\end{marker}
\section{Introduction}
@@ -239,7 +242,20 @@ Please note, that this package does not provide means for simultaneous stepping
\begin{itemize}
-\item This package does not work really well with the \packagename{calc} package if that one is loaded after \packagename{\PackageDocName}. Load \packagename{calc} \textbf{before} \packagename{\PackageDocName}! \marginnote{\bcbombe}
+\item This package does not work really well with the \packagename{calc} package if that one is loaded after \packagename{\PackageDocName}. Load \packagename{calc} \textbf{before} \packagename{\PackageDocName}!
+
+\begin{marker}
+\tcbdocmarginnote{\bcbombe\tcbdocupdated{2015-11-10}}
+ As of version \packageversion\ \packagename{\PackageDocName} will abort compilation if \packagename{calc} is loaded after this package, but will issue a warning only if \packagename{calc} is loaded first.
+\end{marker}
+\item \packagename{\PackageDocName} and \packagename{perpage} are not compatible completely. As of version \packageversion\ it is not possible to use the command \cs{AddAbsoluteCounter} from \packagename{perpage} -- this feature is provided already by this package.
+\tcbdocmarginnote{\tcbdocnew{2015-11-10}}
+
+\begin{marker}
+ It is not recommended to use counters under control of \packagename{perpage} with the association method!
+\end{marker}
+
+% is somewhat similar to \refCom{AddAssociatedCounters} from this package but unless changed manually, the values of and \texttt{perpage} - absolute counter and an associated counter by this package differ by one, since \cs{AddAbsoluteCounter} initializes the counter value to the value of 1.
%\item This package does not work together when the Package \packagename{xifthen} is included. As of version \packageversion~I could not figure out, where the strange behaviour comes in. It's most likely an incompatibility between \packagename{etoolbox} and \packagename{xifthen}
%\marginnote{\bcbombe}
\end{itemize}
@@ -990,6 +1006,16 @@ write this documentation.
\section{Version history}
+\begin{itemize}
+
+\item
+Version 0.2
+
+Improved \cs{stepcounter} to remove some incompatibilities with the \packagename{perpage}. This is only partially managed so far.
+
+
+\item
+
Version: 0.1
A major bug fixed due to some error in usage together with \packagename{calc} when the driven counters are not stepped any longer.
@@ -999,7 +1025,7 @@ Version: 0.1
This however lead to some internal inconsistencies and it was decided to rewrite \packagename{assoccnt} with \packagename{expl3} and the features of the new \LaTeX\ 3 - Syntax.
-
+\end{itemize}
\clearpage
\phantomsection
\appendix\label{examplesappendix}
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf
index ca264e0755f..ac6b26ff116 100644
--- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf
+++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex
index 3a5b64b14dc..2d0d8f5fd8b 100644
--- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex
+++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver.tex
@@ -1,5 +1,5 @@
-%% LaTeX package xassoccnt driver file - version 0.1 (2015/11/07)
-%%
+%% LaTeX package xassoccnt - version 0.2 (2015/11/14 -- 16/08/33)
+%% Driver file for xassoccnt.sty
%%
%%
%% -------------------------------------------------------------------------------------------
@@ -14,20 +14,19 @@
%% 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'.
%%
-%% This work consists of all files listed in README
+%% This work has the LPPL maintenance status `author-maintained`
+%%
%%
-
\documentclass{book}
\usepackage{xcolor}
-
+\usepackage{totcount}
\usepackage{calc}
\usepackage[autodefinecounters=true]{xassoccnt}
-\usepackage{totcount}
+
\usepackage{hyperref}
\usepackage{cleveref}
@@ -35,15 +34,15 @@
\newcounter{totalpages}
\newtotcounter{totalsections}
\newcounter{othersections}
-
+\newtotcounter{totaltables}
\DeclareAssociatedCounters[autodefine=none]{section}{totalsections,othersections}
-\AddAssociatedCounters[autodefine=associated]{section}{totalsections}
+\AddAssociatedCounters{section}{totalsections}
\DeclareAssociatedCounters{page}{totalpages}
-\DeclareAssociatedCounters[autodefine=associated,sloppy=false]{table}{totaltables}
+\DeclareAssociatedCounters{table}{totaltables}
@@ -61,6 +60,16 @@ In \cref{section::dummylabel} we will see that
\end{table}
+\begin{table}
+\caption{table}
+\end{table}
+
+
+\begin{table}
+\caption{table}
+\end{table}
+
+
\section{Other}
\section{Third}
@@ -82,7 +91,7 @@ In \cref{section::dummylabel} we will see that
\section{First section of 2nd chapter} \label{section::dummylabel}
-\thesection\ \total{totalsections}\ \theothersections\ \thetotaltables\
+\thesection\ \total{totalsections}\ \theothersections\ \fbox{\color{blue}{\thetotaltables}}
\IsSuspendedCounter{totalsections}{Yes, it's suspended}{Nope, it's not suspended}
@@ -114,7 +123,7 @@ Value of counterother: \thecounterother
-\thesection\ \thetotalsections\ \theothersections\ \thetotaltables\
+\thesection\ \thetotalsections\ \theothersections\ \fbox{\color{blue}{\thetotaltables}}\
\SyncCounters[onlycounters={totalsections}]{section}
@@ -133,7 +142,22 @@ Value of counterother: \thecounterother
\item There are \getresetlistcount\ counters in the reset list of chapter
\item \IfInResetListTF{chapter}{figure}{Yes, figure is in the reset list of chapter}{No, figure is not in the reset list of chapter}
\item \IfInResetListTF{chapter}{page}{Yes, page is in the reset list of chapter}{No, page is not in the reset list of chapter}
- \item Values: \thesection\ \thetotalsections\ \theothersections\ \thetotaltables\ \thecounterother.
+ \item Values: \thesection\ \total{totalsections}\ \theothersections\ \fbox{\color{blue}{\total{totaltables}}}\ \thecounterother.
\end{itemize}
+\begin{table}
+\caption{table}
+\end{table}
+
+
+\chapter{First}
+
+
+\begin{table}
+\caption{table}
+\end{table}
+
+
+
+
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf
index 75a1fa5699d..696e5c5c432 100644
--- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf
+++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex
index c655098204b..6acb4663c00 100644
--- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex
+++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex
@@ -1,4 +1,25 @@
-%% Example file for xassoccnt.sty (2015/11/07)
+%% LaTeX package xassoccnt - version 0.2 (2015/11/14 -- 16/08/33)
+%% Example file for xassoccnt.sty
+%%
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2015 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de>
+%% -------------------------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%%
+%% This work has the LPPL maintenance status `author-maintained`
+%%
+%%
+
+%% Example file for xassoccnt.sty v0.2 (2015/11/10)
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2015 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de>
@@ -22,16 +43,13 @@
% Some packages only for output and dummy pages
-\usepackage{blindtext}%
-\usepackage{forloop}%
-\usepackage[svgnames]{xcolor}%
+\usepackage{blindtext}
+\usepackage{forloop}
+\usepackage[svgnames]{xcolor}
\usepackage{tcolorbox}
-\usepackage{totcount}%
-\usepackage{xassoccnt}%
-
-
-
+\usepackage{totcount}
+\usepackage{xassoccnt}
diff --git a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty
index af5d532a123..2ca160fb86d 100644
--- a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty
+++ b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty
@@ -1,16 +1,42 @@
-\def\xassoccntpackageversion{0.1}
+%% LaTeX package xassoccnt - version 0.2 (2015/11/14 -- 16/08/33)
+%% Source file for xassoccnt.sty
+%%
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2015 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot de>
+%% -------------------------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%%
+%% This work has the LPPL maintenance status `author-maintained`
+%%
+%%
+
+\def\xassoccntpackageversion{0.2}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{xassoccnt}[2015/11/07 - v\xassoccntpackageversion]
+\ProvidesPackage{xassoccnt}[2015/11/14 - v\xassoccntpackageversion]
\RequirePackage{xcolor}
\RequirePackage{xparse}
\RequirePackage{l3keys2e}
+
\ExplSyntaxOn
% First some local or global values
+\str_const:Nn \c__xassoccnt_modulename_str {xassoccnt}
+
+\bool_new:N \l__xassoccnt_calcpackage_loaded
+
\int_new:N \l__xassoccnt_initialcountervalue_int
\int_new:N \g__xassoccnt_lastcountervalue_int
@@ -29,6 +55,7 @@
\bool_new:N \l__xassoccnt_countertype_associated
+\seq_new:N \l__xassoccnt_counterreset_seq
\cs_new:Nn \__xassoccnt_toggle_bool:n {%
\bool_if:nTF{#1}{\bool_set_false:n {#1}}{\bool_set_false:n {#1}}
@@ -115,7 +142,22 @@
---~#2~---
}
-\cs_new:Nn \__xassoccnt_stpelt:n{\global\csname c@#1\endcsname \c_minus_one\xassoccnt_addtocounter{#1}{\c_one}}%
+
+\msg_new:nnn{xassoccnt}{incompatiblepackagenonfatal}{%
+ Warning:~Package~"#1"~is~loaded~--~this~is~not~recommended~for~\c__xassoccnt_modulename_str\\
+}
+
+\msg_new:nnn{xassoccnt}{packageloadedafterfatal}{%
+ Error:~Package~"#1"~is~loaded~after~\c__xassoccnt_modulename_str~\\
+ This~is~an~error!
+}
+
+
+
+\cs_new:Nn \__xassoccnt_stpelt:n{\global\csname c@#1\endcsname\c_minus_one\xassoccnt_addtocounter{#1}{\c_one}}%
+
+%\cs_new:Nn \__xassoccnt_stpelt:n{\global\csname c@#1\endcsname\c_minus_one\xassoccnt_addtocounter{#1}{\c_one}}%
+
\cs_new:Nn \__xassoccnt_intinc:n {\int_gincr:N \l_xassoccnt_resetlist_counter}%
@@ -138,6 +180,30 @@
\cs_set_eq:NN \xassoccnt_standardaddtocounter \addtocounter
\cs_set_eq:NN \xassoccnt_standardsetcounter \setcounter
+% A little patch for perpage
+
+\@ifpackageloaded{perpage}{%
+ \msg_warning:nnn{xassoccnt}{incompatiblepackagenonfatal}{perpage}% Warning
+ \def\pp@cl@end@iii\xassoccnt_standardstepcounter#1{}
+}{}
+
+\AtEndOfPackage{
+ \@ifpackageloaded{calc}{%
+ \msg_warning:nnn{xassoccnt}{incompatiblepackagenonfatal}{calc}% Warning
+ \bool_set_true:N \l__xassoccnt_calcpackage_loaded
+ }{}%
+}
+
+\AtBeginDocument{%
+ % Recheck if `calc` isn't loaded after this package
+ \@ifpackageloaded{calc}{%
+ \bool_if:nF { \l__xassoccnt_calcpackage_loaded } {%
+ \msg_error:nnn{xassoccnt}{packageloadedafterfatal}{calc}% Error!
+ }%
+ }{}%
+}
+
+
\cs_new_nopar:Nn \__xassoccnt_laststeppedcounter: {}
\cs_new_nopar:Nn \__xassoccnt_lastrefsteppedcounter: {}
\cs_new_nopar:Nn \__xassoccnt_lastaddtocounter: {}
@@ -580,31 +646,44 @@
-\RenewDocumentCommand{\stepcounter}{m}{%
+
+
+\cs_new:Nn \__xassoccnt_step_associatedcounters:n {%
+ \seq_if_exist:cT { \__xassoccnt_drivercontainer:n{#1} }
+ { \seq_map_inline:cn {\__xassoccnt_drivercontainer:n{#1} }
+ { \xassoccnt_addtocounter{##1}{\c_one} }
+ }
+ % End of \seq_if_exist
+}
+
+
+
+
+\RenewDocumentCommand{\stepcounter}{m}{%
\xassoccnt_is_suspendedcounter:nF{#1}{%
\cs_gset_nopar:Nn \__xassoccnt_laststeppedcounter: {#1}%
\xassoccnt_countersinresetlist:n{#1}%
- \int_compare:nTF{%
- \l_xassoccnt_resetlist_counter > \c_zero
- }{%
- \xassoccnt_standardaddtocounter{#1}{\c_one}%
- \begingroup
- \cs_set_eq:NN \@elt \__xassoccnt_stpelt:n
- \use:c{cl@#1}
- \endgroup
- }{%
+ \__xassoccnt_getresetlist:n {#1}%
+ \seq_if_empty:NTF \l__xassoccnt_counterreset_seq
+ {%
+ \xassoccnt_standardaddtocounter{#1}{\c_one}% Use the original one!
+ \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{#1}}%
+ \__xassoccnt_step_associatedcounters:n {#1}
+ }{ % reset list is not empty!
+ % This is the replacement of \csname cl@#1\endcsname
\xassoccnt_standardaddtocounter{#1}{\c_one}
- }
- \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{#1}}%
- \seq_if_exist:cT { \__xassoccnt_drivercontainer:n{#1} }
- { \seq_map_inline:cn {\__xassoccnt_drivercontainer:n{#1} }
- { \xassoccnt_addtocounter{##1}{\c_one} }
- }% End of \seq_if_exist
- }%
+ \seq_map_inline:Nn \l__xassoccnt_counterreset_seq {%
+ \csname c@##1\endcsname\c_minus_one
+ \xassoccnt_standardstepcounter{##1}%{\c_one}%
+ }
+ \__xassoccnt_step_associatedcounters:n {#1} % step the remaining associated counters
+ }% End of not empty reset list
+ } % end of not suspended counter
}
+
\NewDocumentCommand{\xassoccnt_addtocounter}{mmO{}}{%
% Only add to a counter if this counter isn't on the suspended counters list!
\xassoccnt_is_suspendedcounter:nF{#1}{%
@@ -658,36 +737,18 @@
\int_zero:N \l_tmpa_int
}
-
-
-
-
-% Extended support layer for counters
-\NewDocumentCommand{\SetDocumentCounterOld}{O{associatedtoo=false}mm}{%
- \xassoccnt_standardsetcounter{#2}{#3}%
- \clist_clear:N \l__xassoccnt_onlycounters_clist
- \keys_set:nn {xassoccnt}{#1}%
- \bool_if:nTF {\l__xassoccnt_setcounter_associated } {%
- \seq_if_exist:cT { \__xassoccnt_drivercontainer:n{#2} }
- { \seq_map_inline:cn {\__xassoccnt_drivercontainer:n{#2} }
- { \xassoccnt_standardsetcounter{##1}{#3} }
- }% End of \seq_if_exist
- }{%
- % Check whether the `onlycounters` - clist is empty -- if not, loop through the list
- \clist_if_empty:NF \l__xassoccnt_onlycounters_clist {%
- \seq_if_exist:cT { \__xassoccnt_drivercontainer:n{#2} }
- {
- \clist_map_inline:Nn \l__xassoccnt_onlycounters_clist
- { % Check first if ##1 is associated to #2 at all
- \xassoccnt_is_associatedtocounter:nnT {#2} {##1} { \xassoccnt_standardsetcounter{##1}{#3} }
- }
- }
- }
- }
- \cs_gset_nopar:Nn \__xassoccnt_lastsetdocumentcounter: {#2}%
- \int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{#2}}%
+\cs_new:Nn \__xassoccnt_getresetlist:n {%
+ \begingroup
+ \seq_gclear:N \l__xassoccnt_counterreset_seq
+ \def\@elt##1{\seq_gput_right:Nn \l__xassoccnt_counterreset_seq {##1} }
+ \use:c{cl@#1}
+ \endgroup
}
+\newcommand{\showresetlist}[1]{%
+ \__xassoccnt_getresetlist:n {#1}
+ \seq_use:Nn \l__xassoccnt_counterreset_seq {\par}
+}
\NewDocumentCommand{\SetDocumentCounter}{O{associatedtoo=false}mm}{%
\__xassoccnt_setdocumentcounter:nnn {#1}{#2}{#3} % copy the driver counter value to all associated counters
@@ -711,6 +772,7 @@
\RenewDocumentCommand{\refstepcounter}{m}{%
\cs_gset_nopar:Nn \__xassoccnt_lastrefsteppedcounter: {#1}
+% \stepcounter{#1}%
\xassoccnt_standardrefstepcounter{#1}%
\int_gset:Nn \g__xassoccnt_lastcountervalue_int {\number\value{#1}}%
}
@@ -743,7 +805,6 @@
\newcommand{\LastCounterValue}{%
-%\NewDocumentCommand{\LastCounterValue}{}{%
\int_use:N \g__xassoccnt_lastcountervalue_int
}
@@ -768,6 +829,7 @@
}
+
\newcommand{\countersresetlistcount}[1]{%
\int_zero:N \l_xassoccnt_resetlist_counter%
\xassoccnt_countersinresetlist:n{#1}%