annotate chngcntr.sty @ 5:303fa01dce67

added Makefile
author meillo@marmaro.de
date Wed, 16 Jan 2008 11:46:50 +0100
parents 662d647b9e94
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
1 % chngcntr.sty
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
2 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
3 % Provides commands to change the resetting of counters.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
4 % Instructions for use are at the end of this file.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
5 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
6 % author: Peter Wilson (CUA)
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
7 % (now at peter.r.wilson@boeing.com)
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
8 % Released under the Latex Project Public License
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
9 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
10 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
11 \NeedsTeXFormat{LaTeX2e}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
12 \ProvidesPackage{chngcntr}[2001/03/30 v1.0 change counter resetting]
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
13 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
14 % This package uses David Carlisle's \@removefromreset command as
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
15 % specified in the remreset package available from CTAN as
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
16 % macros/latex/contrib/supported/carlisle/remreset.sty
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
17 % It is \provided here as a convenience to the user, and with
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
18 % David Carlisle's permission.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
19 % START OF DAVID CARLISLE'S CODE
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
20 \providecommand{\@removefromreset}[2]{{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
21 \expandafter\let\csname c@#1\endcsname\@removefromreset
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
22 \def\@elt##1{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
23 \expandafter\ifx\csname c@##1\endcsname\@removefromreset
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
24 \else
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
25 \noexpand\@elt{##1}%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
26 \fi}%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
27 \expandafter\xdef\csname cl@#2\endcsname{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
28 \csname cl@#2\endcsname}}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
29 % END OF DAVID CARLISLE'S CODE
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
30
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
31 %%\@ifbothc@t@s{<package>}{<counter>}{<within>}{<code when both are counters>}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
32 \newcommand{\@ifbothc@t@s}[4]{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
33 \@ifundefined{c@#2}{% counter undefined
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
34 \PackageError{#1}{#2 is not a counter}{\@eha}}%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
35 {% else counter is defined
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
36 \@ifundefined{c@#3}{% within undefined
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
37 \PackageError{#1}{#3 is not a counter}{\@eha}}%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
38 {% else both counter and within are defined
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
39 #4}}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
40
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
41 %%\counterwithout*{<counter>}{<within>}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
42 \newcommand{\counterwithout}{\@ifstar{\c@t@soutstar}{\c@t@sout}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
43 \newcommand{\c@t@soutstar}[2]{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
44 \@ifbothc@t@s{chngcntr}{#1}{#2}{\@removefromreset{#1}{#2}}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
45 \newcommand{\c@t@sout}[2]{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
46 \@ifbothc@t@s{chngcntr}{#1}{#2}{\@removefromreset{#1}{#2}%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
47 \@namedef{the#1}{\arabic{#1}}}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
48
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
49
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
50 %%\counterwithin*{<counter>}{<within>}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
51 \newcommand{\counterwithin}{\@ifstar{\c@t@sinstar}{\c@t@sin}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
52 \newcommand{\c@t@sinstar}[2]{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
53 \@ifbothc@t@s{chngcntr}{#1}{#2}{\@addtoreset{#1}{#2}}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
54 \newcommand{\c@t@sin}[2]{%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
55 \@ifbothc@t@s{chngcntr}{#1}{#2}{\@addtoreset{#1}{#2}%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
56 \@namedef{the#1}{\@nameuse{the#2}.\arabic{#1}}}}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
57
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
58
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
59 \endinput
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
60
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
61 %%%%%%%%%%%%%%%%%%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
62 % USAGE
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
63 %%%%%%%%%%%%%%%%%%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
64 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
65 % In LaTeX, a new counter called, say `ctr', is created by the command
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
66 % \newcounter{ctr}[within]. If the optional within argument is given
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
67 % the the counter `ctr' is reset to zero each time the counter `within'
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
68 % changes. The command \thectr typesets the value of the counter ctr.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
69 % This is automatically defined by \newcounter and is initialised
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
70 % to typeset arabic numerals.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
71 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
72 %%%%%%%%%%%%%%%%%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
73 % \counterwithin
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
74 % \counterwithin*
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
75 %%%%%%%%%%%%%%%%%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
76 % It is sometimes desireable to change a counter that has been defined
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
77 % by \newcounter{ctr} to act as though it had been defined as
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
78 % \newcounter{ctr}[within]. The package provides the command
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
79 % \counterwithin{ctr}{within} that accomplishes this. By default,
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
80 % it also redefines the \thectr command so that it typesets values
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
81 % in the style \thewithin.\arabic{ctr}. The starred version of the
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
82 % command suppresses the redefinition of \thectr
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
83 % (e.g., \counterwithin*{ctr}{within}).
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
84 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
85 %%%%%%%%%%%%%%%%%%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
86 % \counterwithout
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
87 % \counterwithout*
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
88 %%%%%%%%%%%%%%%%%%
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
89 % Likewise, the command \counterwithout{ctr}{within} changes a
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
90 % counter that has been created by \newcounter{ctr}[within] to act
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
91 % as though it had been created by \newcounter{ctr}. By default it
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
92 % also redefines the \thectr command so that it just typesets an arabic
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
93 % numeral. The starred version of the command suppresses the redefinition
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
94 % of \thectr.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
95 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
96 % Any number of \counterwithin{ctr}{...} and \counterwithout{ctr}{...}
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
97 % commands can be issued for a given counter, ctr, if you wish to toggle
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
98 % between the two styles. The current value of ctr is unaffected by
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
99 % \counterwithin and \counterwithout. If you want to change the value
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
100 % after one of these commands, use \setcounter{ctr}{...}, and to change
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
101 % the typeseting style use \renewcommand{\thectr}{...}.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
102 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
103 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
104 % Peter W.
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
105 % 2001/03/30
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
106 %
662d647b9e94 initial commit
meillo@marmaro.de
parents:
diff changeset
107