From 942f0cacc577ae897adcaf7f1705b0a864223002 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 22 Sep 2014 22:17:11 +0000 Subject: assoccnt (22sep14) git-svn-id: svn://tug.org/texlive/trunk@35231 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/assoccnt/README | 24 ++-- .../doc/latex/assoccnt/assoccnt_example.pdf | Bin 77420 -> 77420 bytes .../doc/latex/assoccnt/assoccnt_example.tex | 20 +++ .../texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf | Bin 254717 -> 264685 bytes .../texmf-dist/doc/latex/assoccnt/assoccntdoc.tex | 141 ++++++++++++++++++--- Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty | 67 ++++++++-- 6 files changed, 212 insertions(+), 40 deletions(-) diff --git a/Master/texmf-dist/doc/latex/assoccnt/README b/Master/texmf-dist/doc/latex/assoccnt/README index a3211634d6f..14001d01bde 100644 --- a/Master/texmf-dist/doc/latex/assoccnt/README +++ b/Master/texmf-dist/doc/latex/assoccnt/README @@ -1,4 +1,4 @@ -%% LaTeX package assoccnt - version 0.4 (2014/09/04) +%% LaTeX package assoccnt - version 0.5a (2014/09/22) %% %% ------------------------------------------------------------------------------------------- %% Copyright (c) 2014 by Dr. Christian Hupfer @@ -28,18 +28,16 @@ Further improvements will follow This version provides --- a revised scheme -- \addtocounter is used instead of \stepcounter --- \setcounter is redefined to obtain an optional argument, which holds - a list of associated counters, which should be set to the value as well. --- Suspension/resuming of counter is possible, i.e. the counting can be put on hold - and resumed later on. --- some new routines for queries on the properties of counters - whether they are drivers or associated counters and a better documentation. +-- Informational routines for the last counter being stepped, refstepped, added or set + +-- A section on minimal requirements and incompatibilities with other packages + +-- Improved manual (reordered descriptions) Directory listing: - assoccntdoc.pdf 254717 09/04/14 03:19:44 - assoccntdoc.tex 29162 09/04/14 03:19:45 -assoccnt_example.pdf 77420 09/04/14 03:19:45 -assoccnt_example.tex 3955 09/04/14 03:15:58 - assoccnt.sty 14299 09/04/14 03:15:58 + assoccntdoc.pdf 264685 09/22/14 14:14:36 + assoccntdoc.tex 32859 09/22/14 14:14:37 +assoccnt_example.pdf 77420 09/22/14 14:14:37 +assoccnt_example.tex 4769 09/22/14 14:14:32 + assoccnt.sty 15709 09/22/14 14:11:28 diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf index 63fe2a67cbe..5e3a1142c71 100644 Binary files a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf and b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.pdf differ diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex index 462ed9f7d08..a7669731ba5 100644 --- a/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex +++ b/Master/texmf-dist/doc/latex/assoccnt/assoccnt_example.tex @@ -1,3 +1,23 @@ +%% Example file for assoccnt.sty +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2014 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'. +%% +%% This work consists of all files listed in README +%% + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf index d820aa2d4fd..f7a93013d6d 100644 Binary files a/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf and b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.pdf differ diff --git a/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex index 6688576aaaa..3039d9c46ee 100644 --- a/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex +++ b/Master/texmf-dist/doc/latex/assoccnt/assoccntdoc.tex @@ -1,6 +1,32 @@ +%% Documentation for assoccnt.sty +%% +%% +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2014 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'. +%% +%% This work consists of all files listed in README +%% + + \documentclass[12pt,paper=a4]{ltxdoc} \usepackage[lmargin=2cm,rmargin=2cm]{geometry} +\usepackage{savesym}% +\usepackage{bbding}% +\savesymbol{Cross}% + \usepackage{blindtext}% \usepackage{xcolor} \usepackage{imakeidx}% @@ -19,15 +45,20 @@ \usepackage{array}% + \usepackage{amsmath}% \usepackage{amsthm}% \usepackage{totcount}% -\usepackage[globalsuspend=false]{assoccnt}% +\usepackage[globalsuspend=true]{assoccnt}% \usepackage{bookmark}% +\newcommand{\packagename}[1]{\textcolor{blue}{\textbf{\Envelope~#1}}\index{Paket!#1}}% + + + \newcommand{\MarkupPackageName}[2][lightgray]{% \colorbox{#1}{\textcolor{black}{#2}}% }% @@ -43,7 +74,7 @@ \newtcolorbox{docCommandArgs}[1]{colbacktitle={blue},coltitle={white},title={Description of arguments of command \cs{#1}}} -\def\packageversion{0.4}% +\def\packageversion{0.5a}% \makeindex @@ -86,14 +117,14 @@ Version \packageversion \tabularnewline \today \tabularnewline \tabularnewline \addtocounter{footnote}{2} -Author: Christian Hupfer\(^\mathrm{\fnsymbol{footnote}}\)% }{\makeatletter christian.hupfer@siebenfelsen.de} +Author: Christian Hupfer\(^\mathrm{\fnsymbol{footnote}}\)% }{\makeatletter christian.hupfer@yahoo.de} \tabularnewline \end{tabular} \end{center} \end{tcolorbox} \makeatletter \renewcommand{\thefootnote}{\fnsymbol{footnote}}% -\footnotetext{christian.hupfer@siebenfelsen.de}% +\footnotetext{christian.hupfer@yahoo.de}% \makeatother \end{center} @@ -135,7 +166,7 @@ Please note, that this package does not provide means for simultaneous stepping \section{Package options}% -As of version \packageversion~ the package has only one option, regarding the suspending of counters globally, regardless, whether they are drivers or associated counters (more on this facility of the package, see \ref{section::suspendedresumedcounters}. +As of version \packageversion~ the package has only one option, regarding the suspending of counters globally, regardless, whether they are drivers or associated counters (more on this facility of the package, see \ref{section::suspendedresumedcounters}). \begin{docKey}{globalsuspend}{=\meta{true/false}}{initially false} If this key is set to \meta{true}, a a general driver can be set to the suspended list, i.e, it is not updated via \cs{addtocounter}. If unsure, do not use this option or say explicitly @@ -147,6 +178,21 @@ As of version \packageversion~ the package has only one option, regarding the su +\section{Requirements and incompatibilities}% + +\subsection{Required packages} + +\begin{itemize} +\item \packagename{etoolbox} +\item \packagename{xkeyval} +\item \packagename{xcolor}% +\end{itemize} + +\subsection{Incompatibilities} + +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} + + \section{Documentation of Macros} \tcbset{color command={blue}} @@ -182,10 +228,12 @@ This command behaves like the standard macro \cs{setcounter}, but has an additio \end{docCommand}% -All macros have the general rule, that the driver counter is specified as 1st argument to the macro. \subsection{Associated counters commands} +All macros have the general rule, that the driver counter is specified as 1st argument to 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}. @@ -319,7 +367,6 @@ The optional argument is not used as of version \packageversion. 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. @@ -438,7 +485,6 @@ This commands tests, whether a given counter name is a driver counter and expand \item \marg{True branch} This code is expanded if the counter is \textbf{not} a driver, otherwise it is ignored - \end{enumerate} \end{docCommandArgs} @@ -502,6 +548,64 @@ This command is purposed for statistics only, for package/class authors for exam \end{docCommand}% +\subsection{Information on counters} + +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 \PrettyPrintCounterName{\LastAddedToCounter}. +\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} + + The last counter being stepped was \PrettyPrintCounterName{\LastSteppedCounter}. +\end{dispExample}% + +\end{docCommand}% + +\begin{docCommand}{LastRefSteppedCounter}{} + +\begin{dispExample} + \begin{equation} + E = mc^2 \label{eq::einstein} + \end{equation} + % \stepcounter{SomeCounter} + + The last counter being refstepped was \PrettyPrintCounterName{\LastRefSteppedCounter}. +\end{dispExample}% + +\end{docCommand}% + + + + + +\begin{docCommand}{LastSetCounter}{} +This command has no arguments and expands to the name of the counter which was set last using \refCom{setcounter}. There is no further typesetting done with the countername. + +\begin{dispExample} + \setcounter{SomeCounter}{21}% + + The last counter being stepped was \PrettyPrintCounterName{\LastSetCounter}. +\end{dispExample}% + +\end{docCommand}% + +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. + \subsection{Minor macros} For the informational output on counter properties in conjunction with the macro @@ -569,6 +673,12 @@ Rather than remove an associated counter from the list, it is possible to suspen \end{enumerate} \end{docCommandArgs} +\end{docCommand}% + +\begin{docCommand}{ResumeSuspendedCounters}{} + This command has no arguments and revokes the suspension of \textbf{all} counters. +\end{docCommand} + Some remarks: @@ -604,18 +714,10 @@ And resume it: \ResumeSuspendedCounters E = h \nu \end{equation} -There are \number\totvalue{totalequations}~ equations in here! - - +There are \number\totvalue{totalequations}~equations in here! \end{dispExample} -\end{docCommand}% - -\begin{docCommand}{ResumeSuspendedCounters}{} - This command has no arguments and revokes the suspension of \textbf{all} counters. -\end{docCommand} - \section{Internals commands} @@ -708,13 +810,16 @@ This macro generates a list from the driver counter name and the driver counter \clearpage -\section{To do list} +\section{To-Do list} \begin{itemize} +\item Better counter definition/copy counter routines \(\longrightarrow\) another package perhaps \item Check the existence of driver and associated counters \item Provide a better internal list organization \item Some macro names might be non-intuitive \item Improve documentation +\item Allow for specific counter to be resumed from suspension instead of resuming all +\item Allow for an associated counter to have multiple masters \end{itemize} If you diff --git a/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty b/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty index 1a08056afd3..3c736ac9288 100644 --- a/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty +++ b/Master/texmf-dist/tex/latex/assoccnt/assoccnt.sty @@ -1,19 +1,18 @@ \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{assoccnt}[2014/09/01 v0.4 -- Associate counters stepping]% +\ProvidesPackage{assoccnt}[2014/09/22 v0.5a -- Associate counters stepping]% %%% -%% License: LaTeX Project Public License +%% License: LaTeX Project Public License version 1.3 %% Copyright (2014) Dr. Christian Hupfer %% Author: Christian Hupfer christian.hupfer@yahoo.de %% %%%% -%%% Some options later on -%%%% \def\@@assoccnt@@keys{assoccntkeyfamily}% \def\@@assoccnt@@packagename{assoccnt.sty}% \def\@@assoccnt@@keyprefix{@@assoccnt@@pkg@@}% +\RequirePackage{xcolor}% \RequirePackage{etoolbox}[2011/01/03 2.2]% \RequirePackage{xkeyval}[2012/10/14 v2.6b]% \RequirePackage{xstring}% @@ -43,6 +42,13 @@ \newcounter{@@assoccnt@@internalcounter}% + +\gdef\@@assoccnt@@storagemacro@@laststeppedcounter{}% +\gdef\@@assoccnt@@storagemacro@@lastrefsteppedcounter{}% +\gdef\@@assoccnt@@storagemacro@@lastaddtocounter{}% +\gdef\@@assoccnt@@storagemacro@@lastsetcounter{}% + + \let\@@assoccnt@@standardstepcounter\stepcounter% \let\@@assoccnt@@standardrefstepcounter\refstepcounter% \let\@@assoccnt@@standardsetcounter\setcounter% @@ -59,7 +65,7 @@ AssociatedCountersList% %%% Internal macro to generate the name of the list of associated counters \newcommand{\@@assoccnt@@generatelistname}[1]{% % #1 Name of the driver counter -@@#1@@\@@assoccnt@@associatedcounterslistsuffix + @@#1@@\@@assoccnt@@associatedcounterslistsuffix }% \newcommand{\@@assoccnt@@drivercounterlist}{% @@ -398,11 +404,19 @@ AssociatedCountersList% %%% This is just for convenience, if the command as to be improved/extended later on in future \newcommand{\@@assoccnt@@stepcounter}[1]{% \@@assoccnt@@standardstepcounter{#1}% + \gdef\@@assoccnt@@storagemacro@@laststeppedcounter{#1}% +% \gdef\@@assoccnt@@storagemacro@@laststeppedcounter{#1}% }% +\renewcommand{\stepcounter}[1]{% + \@@assoccnt@@stepcounter{#1}% +}% + + %%% The setcounter wrapper \newcommand{\@@assocccnt@@setcounter}[2]{% \@@assoccnt@@standardsetcounter{#1}{#2}% + \gdef\@@assoccnt@@storagemacro@@lastsetcounter{#1}% }% %%% addtocounter wrapper -- needs to switch the arguments for the command for the list usage!!! @@ -411,11 +425,13 @@ AssociatedCountersList% % Now, there are suspended counters -- do not update them! \IsSuspendedCounter{#2}{% % Nothing to be done - }{% - \@@assoccnt@@standardaddtocounter{#2}{#1}% - }% + }{% + \@@assoccnt@@standardaddtocounter{#2}{#1}% + \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#2}% + }% }{% \@@assoccnt@@standardaddtocounter{#2}{#1}% + \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#2}% }% }% @@ -431,10 +447,14 @@ AssociatedCountersList% %%% Not needed so far -\newcommand{\@@assoccnt@@refstepcounter}[1]{% +\newcommand{\@@assoccnt@@refstepcounter}[1]{% % \@@assoccnt@@standardrefstepcounter{#1}% + \gdef\@@assoccnt@@storagemacro@@lastrefsteppedcounter{#1}% }% +\renewcommand{\refstepcounter}[1]{% + \@@assoccnt@@refstepcounter{#1}% +}% \renewcommand{\addtocounter}[2]{% @@ -443,9 +463,11 @@ AssociatedCountersList% % No, do nothing at all% }{% \@@assoccnt@@standardaddtocounter{#1}{#2}% + \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#1}% } }{% \@@assoccnt@@standardaddtocounter{#1}{#2}% + \gdef\@@assoccnt@@storagemacro@@lastaddtocounter{#1}% }% \ifcsdef{\@@assoccnt@@generatelistname{#1}}{% Check first, whether the list exists at all, \forlistcsloop{\@@assoccnt@@addtocounter{#2}}{\@@assoccnt@@generatelistname{#1}}% March through the list @@ -479,6 +501,8 @@ AssociatedCountersList% \renewcommand{\setcounter}[3][]{% \@@assoccnt@@standardsetcounter{#2}{#3}% + \gdef\@@assoccnt@@storagemacro@@lastsetcounter{#2}% + %\gdef\assoccnt@@storagemacro@@lastsetcounter{#2}% \setkeys{\@@assoccnt@@keys}{AssociatedToo=false,#1}% \ifKV@assoccntkeyfamily@AssociatedToo \@@assoccnt@@setcounterwrapper{#2}{#3}{\@@assoccnt@@generatelistname{#2}}% @@ -492,4 +516,29 @@ AssociatedCountersList% \fi% }% + + +\newcommand{\LastSteppedCounter}{% + \ifdef{% + \@@assoccnt@@storagemacro@@laststeppedcounter% + }{% + \@@assoccnt@@storagemacro@@laststeppedcounter\typeout{Hello}% + }{% + Undefined/unknown% + }% +}% + +\newcommand{\LastSetCounter}{% + \@@assoccnt@@storagemacro@@lastsetcounter% +}% + +\newcommand{\LastRefSteppedCounter}{% + \@@assoccnt@@storagemacro@@lastrefsteppedcounter% +}% + +\newcommand{\LastAddedToCounter}{% + \@@assoccnt@@storagemacro@@lastaddtocounter% +}% + + \endinput% \ No newline at end of file -- cgit v1.2.3