blob: 651c5e29f3551e5b8b8f3e40556b361a4ca5d5a8 (
plain)
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
|
%%
%% This is file `count1to.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% count1to.dtx (with options: `package')
%%
%% Copyright (c) 1994–2009 Martin Schröder, 2024 Marei Peischl (peiTeX) <marei@peitex.de>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% 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.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is
%% Marei Peischl <marei@peitex.de>.
%%
%% This work consists of the files count1to.dtx and count1to.ins
%% and the derived file count1to.sty.
%%
%% \iffalse meta-comment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{count1to}
[2024-06-13 v2.11 Count1to9 Package (MS)]
\newif\if@have@part
\newif\if@have@chapter
\newif\if@have@section
\newif\if@have@subsection
\newif\if@have@subsubsection
\newif\if@have@paragraph
\newif\if@have@subparagraph
\newcommand*{\@countItoIX@ifs}{
\@ifundefined{c@part} {}{\@have@parttrue}
\@ifundefined{c@chapter} {}{\@have@chaptertrue}
\@ifundefined{c@section} {}{\@have@sectiontrue}
\@ifundefined{c@subsection} {}{\@have@subsectiontrue}
\@ifundefined{c@subsubsection} {}{\@have@subsubsectiontrue}
\@ifundefined{c@paragraph} {}{\@have@paragraphtrue}
\@ifundefined{c@subparagraph} {}{\@have@subparagraphtrue}
}
\newcommand*{\@countItoIX@bugfix}{
\if@have@part
\@addtoreset{section} {part}
\@addtoreset{subsection} {part}
\@addtoreset{subsubsection}{part}
\@addtoreset{paragraph} {part}
\@addtoreset{subparagraph} {part}
\fi
\if@have@chapter
\@addtoreset{subsection} {chapter}
\@addtoreset{subsubsection}{chapter}
\@addtoreset{paragraph} {chapter}
\@addtoreset{subparagraph} {chapter}
\fi
\if@have@section
\@addtoreset{subsubsection}{section}
\@addtoreset{paragraph} {section}
\@addtoreset{subparagraph} {section}
\fi
\if@have@subsection
\@addtoreset{paragraph} {subsection}
\@addtoreset{subparagraph} {subsection}
\fi
\if@have@subsubsection
\@addtoreset{subparagraph} {subsubsection}
\fi
}
\newcommand*{\@countItoIX@init}{%
\message{ABD: Count1to9 initializing macros}%
\@countItoIX@ifs\let\@countItoIX@ifs\undefined
\@countItoIX@bugfix\let\@countItoIX@bugfix\undefined
}
\AddToHook{begindocument}[count1to-init]{\@countItoIX@init}
\newcommand*{\@countItoIX@shipout}{
\global\advance \count1 by 1
\if@have@part \count2\value{part} \fi
\if@have@chapter \count3\value{chapter} \fi
\if@have@section \count4\value{section} \fi
\if@have@subsection \count5\value{subsection} \fi
\if@have@subsubsection \count6\value{subsubsection} \fi
\if@have@paragraph \count7\value{paragraph} \fi
\if@have@subparagraph \count8\value{subparagraph} \fi
\ifodd\count1\count9=1 \else\count9=0 \fi
}
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
\IfFormatAtLeastTF{2020/10/01}{
\AddToHook{shipout/before}[count1to-shipout]{\@countItoIX@shipout}
}{
\RequirePackage{everyshi}
\EveryShipount{\@countItoIX@shipout}
}
\endinput
%%
%% End of file `count1to.sty'.
|