summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/exsheets/cntformats.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets/cntformats.sty')
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/cntformats.sty62
1 files changed, 37 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty
index dcf99e3b027..f97ca6147e0 100644
--- a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty
@@ -23,14 +23,13 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-% The cntformats package consists of the files
-% - cntformats.sty
+% The cntformats package is part of the exsheets bundle
% --------------------------------------------------------------------------
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-\def\@cntfmts@date{2012/11/08}
-\def\@cntfmts@version{v0.4}
+\def\@cntfmts@date{2012/04/23}
+\def\@cntfmts@version{v0.5}
\ProvidesPackage{cntformats}[\@cntfmts@date\space \@cntfmts@version\space A different way to read counters.]
\RequirePackage{etoolbox}
@@ -67,7 +66,7 @@
% if you happen to read this code and notice some obvious reasons why these
% macros shoudn't be used like this, please send me your improved version
% (seriously! But please explain why yours is better)
-\def\ifintl#1#2{%
+\long\def\@cntfmts@ifintl#1#2{%
\def\@cntfmts@intl@tmpa##1#2{}%
\expandafter\if\expandafter\relax\expandafter
\detokenize\expandafter{\@cntfmts@intl@tmpa#1{}{}#2}\relax%
@@ -76,11 +75,11 @@
\expandafter\@firstoftwo
\fi
}
-\def\ifintlcs#1{%
- \expandafter\ifintl\expandafter{#1}}
+\long\def\@cntfmts@ifintlcs#1{%
+ \expandafter\@cntfmts@ifintl\expandafter{#1}}
-\long\def\replaceonceincs#1#2#3{%
- \ifintlcs#1{#2}%
+\long\def\@cntfmts@replaceonceincs#1#2#3{%
+ \@cntfmts@ifintlcs#1{#2}%
{\@cntfmts@replace@once@incs#1{#2}{#3}}{}%
}
\long\def\@cntfmts@replace@once@incs#1#2#3{%
@@ -89,21 +88,21 @@
\expandafter\@cntfmts@replo@tmpa#1\q@stop
}
-\long\def\replaceallin#1#2#3{%
+\long\def\@cntfmts@replaceallin#1#2#3{%
\def\@cntfmts@repla@tmpa{#1}%
- \replaceonceincs\@cntfmts@repla@tmpa{#2}{#3}%
- \ifintlcs\@cntfmts@repla@tmpa{#2}%
- {\expandafter\replaceallin\expandafter{\@cntfmts@repla@tmpa}{#2}{#3}}%
+ \@cntfmts@replaceonceincs\@cntfmts@repla@tmpa{#2}{#3}%
+ \@cntfmts@ifintlcs\@cntfmts@repla@tmpa{#2}%
+ {\expandafter\@cntfmts@replaceallin\expandafter{\@cntfmts@repla@tmpa}{#2}{#3}}%
{\expandonce\@cntfmts@repla@tmpa}%
}
-\long\def\replaceallincs#1#2#3{%
- \replaceonceincs#1{#2}{#3}%
- \ifintlcs#1{#2}{\replaceallincs#1{#2}{#3}}{}%
+\long\def\@cntfmts@replaceallincs#1#2#3{%
+ \@cntfmts@replaceonceincs#1{#2}{#3}%
+ \@cntfmts@ifintlcs#1{#2}{\@cntfmts@replaceallincs#1{#2}{#3}}{}%
}
% ----------------------------------------------------------------------------
% expansion tools
-% heavily inspired by expl3's \exp_args:N<spec>
+% heavily inspired by expl3's \exp_args:N<spec> -- one might say: copied
\long\def\@cntfmts@getnextbraced#1#2#3{#2\@cntfmts@firstofone{#3{#1}}}
\long\def\@cntfmts@firstofone#1{#1}
\long\def\@cntfmts@braced@unexpanded#1\@cntfmts@firstofone#2#3{%
@@ -158,7 +157,7 @@
% #2: counter
% #3: id
\newcommand*\@cntfmts@add@counter@pattern[3][cntfmts]{%
- \ifcsdef{the#2}
+ \ifcsdef{c@#2}
{}{\@cntfmts@err@unknown@counter{#2}}%
\ifcsdef{@#1@#2@counter}
{\@cntfmts@err@pattern@defined{#1}{#2}}
@@ -264,7 +263,7 @@
% #1: module
% #2: pattern-key
\def\@cntfmts@replace@pattern#1#2{%
- \replaceallincs\@cntfmts@parsed@pattern
+ \@cntfmts@replaceallincs\@cntfmts@parsed@pattern
{#2}{{}\csuse{@#1@read@#2@counter}}}
\newrobustcmd*\ReadCounterPattern[2][cntfmts]{%
@@ -310,15 +309,28 @@
\NewPatternFormat{r}{\@roman}
\NewPatternFormat{R}{\@Roman}
-\ifdef\theparagraph
+\ifdef\c@paragraph
{\AddCounterPattern{paragraph}{pg}}{}
-\ifdef\thesubsubsection
+\ifdef\c@subsubsection
{\AddCounterPattern{subsubsection}{ssse}}{}
-\ifdef\thesubsection
+\ifdef\c@subsection
{\AddCounterPattern{subsection}{sse}}{}
-\ifdef\thesection
+\ifdef\c@section
{\AddCounterPattern{section}{se}}{}
-\ifdef\thechapter
+\ifdef\c@chapter
{\AddCounterPattern{chapter}{ch}}{}
-\endinput \ No newline at end of file
+\endinput
+
+% HISTORY:
+2012/09/30 v0.2beta - first version (as part of the `exsheets' bundle)
+2012/11/08 v0.4 - stepped number with `exsheets' until now; next stepping
+ won't synchronize but will step to whatever deems
+ appropriate
+2012/04/23 v0.5 - changed tests for heading commands to test explicitly for
+ the associated counters
+ - change test for counter in \@cntfmts@add@counter@pattern
+ from \the<ounter> to \c@<ounter>
+ - rename tokenlist test macros to use cntformats'
+ namespace
+ \ No newline at end of file