File: counters.dtx

package info (click to toggle)
texlive-lang 2022.20230122-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,447,264 kB
  • sloc: perl: 61,377; xml: 53,781; makefile: 4,525; sh: 4,338; ansic: 2,892; python: 2,861; ruby: 1,031; lisp: 750; awk: 649; java: 159; sed: 142; csh: 25
file content (131 lines) | stat: -rw-r--r-- 4,478 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

% \iffalse
%%% From File: counters.dtx
% \fi
%
%    \begin{macrocode}

%<*counters>
%    \end{macrocode}
%
% \subsection{   }
%
%    ,   
% (   |\part|, |\chapter|  |\section|).
% \DescribeCounter{tocdepth}
%    \begin{macrocode}
\setcounter{tocdepth}{1}
%    \end{macrocode}
%     
% (   |\part|, |\chapter|, |\section|  |\subsection|).
% \DescribeCounter{secnumdepth}
%    \begin{macrocode}
\setcounter{secnumdepth}{2}

%    \end{macrocode}
%
% \DescribeCounter{part}
% \DescribeCounter{chapter}
% \DescribeCounter{section}
% \DescribeCounter{subsection}
% \DescribeCounter{subsubsection}
% \DescribeCounter{paragraph}
% \DescribeCounter{subparagraph}
%    \begin{macrocode}
\newcounter{part}
\newcounter{chapter}
\newcounter{section}[chapter]
\newcounter{subsection}[section]
\newcounter{subsubsection}[subsection]
\newcounter{paragraph}[subsubsection]
\newcounter{subparagraph}[paragraph]

%    \end{macrocode}
%
% \DescribeCounter{figure}
% \DescribeCounter{table}
%    \begin{macrocode}
\newcounter{figure}[chapter]
\newcounter{table}[chapter]

%    \end{macrocode}
%
%      .
% \DescribeMacro{\thepart}\index{!\verb*+\thepart+}
% \DescribeMacro{\thechapter}\index{!\verb*+\thechapter+}
% \DescribeMacro{\theappendix}\index{!\verb*+\theappendix+}
% \DescribeMacro{\thesection}\index{!\verb*+\thesection+}
% \DescribeMacro{\thesubsection}\index{!\verb*+\thesubsection+}
% \DescribeMacro{\thesubsubsection}\index{!\verb*+\thesubsubsection+}
% \DescribeMacro{\theparagraph}\index{!\verb*+\theparagraph+}
% \DescribeMacro{\thesubparagraph}\index{!\verb*+\thesubparagraph+}
%    \begin{macrocode}

\renewcommand\thepart{\Roman{part}}
\renewcommand\thechapter{\arabic{chapter}}
\newcommand\theappendix{\Asbuk{chapter}}
\renewcommand\thesection{%
\ifnum\c@chapter > \z@
  \thechapter.\arabic{section}%
\else\arabic{section}\fi}
\renewcommand\thesubsection{\thesection.\arabic{subsection}}
\renewcommand\thesubsubsection{\thesubsection.\arabic{subsubsection}}
\renewcommand\theparagraph{\arabic{paragraph}}
\renewcommand\thesubparagraph{\theparagraph.\arabic{subparagraph}}

%    \end{macrocode}
%      .
% \DescribeMacro{\tocthepart}\index{!\verb*+\tocthepart+}
% \DescribeMacro{\tocthechapter}\index{!\verb*+\tocthechapter+}
% \DescribeMacro{\toctheappendix}\index{!\verb*+\toctheappendix+}
% \DescribeMacro{\tocthesection}\index{!\verb*+\tocthesection+}
% \DescribeMacro{\tocthesubsection}\index{!\verb*+\tocthesubsection+}
% \DescribeMacro{\tocthesubsubsection}\index{!\verb*+\tocthesubsubsection+}
% \DescribeMacro{\toctheparagraph}\index{!\verb*+\toctheparagraph+}
% \DescribeMacro{\tocthesubparagraph}\index{!\verb*+\tocthesubparagraph+}
%    \begin{macrocode}
\providecommand\tocthepart{\thepart}
\providecommand\tocthechapter{\thechapter}
\providecommand\toctheappendix{\theappendix}
\providecommand\tocthesection{\thesection}
\providecommand\tocthesubsection{\thesubsection}
\providecommand\tocthesubsubsection{\thesubsubsection}
\providecommand\toctheparagraph{\theparagraph}
\providecommand\tocthesubparagraph{\thesubparagraph}

%    \end{macrocode}
%
%     .
% \DescribeMacro{\default@the}\index{!\verb*+\default"@the+}
%    \begin{macrocode}
\newcommand\default@the{%
%    \end{macrocode}
%         .
%    \begin{macrocode}
  \@addtoreset{footnote}{chapter}
  \@addtoreset{equation}{chapter}

%    \end{macrocode}
%   .
% \DescribeMacro{\theequation}\index{!\verb*+\theequation+}
%    \begin{macrocode}
  \renewcommand\theequation{%
    \ifnum\c@chapter > \z@\thechapter.\fi%
    \@arabic\c@equation}
%    \end{macrocode}
%   .
% \DescribeMacro{\thetable}\index{!\verb*+\thetable+}
%    \begin{macrocode}
  \renewcommand\thetable{%
    \ifnum \c@chapter>\z@\thechapter.\fi%
    \@arabic\c@table}
%    \end{macrocode}
%   .
% \DescribeMacro{\thefigure}\index{!\verb*+\thefigure+}
%    \begin{macrocode}
  \renewcommand\thefigure{%
    \ifnum \c@chapter>\z@\thechapter.\fi%
    \@arabic\c@figure}
}
%</counters>
%    \end{macrocode}