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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
%% LaTeX package xassoccnt - version 2.0 (2021/11/21 -- 12:14:58)
%% Driver file for xassoccnt.sty
%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2015 -- 2021 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 `unmaintained`
%%
%%
\documentclass{book}
\usepackage{xcolor}
\usepackage{totcount}
\usepackage{calc}
\usepackage[autodefinecounters=false]{xassoccnt}
\usepackage{hyperref}
\usepackage{cleveref}
\newcounter{newtotalpages}
\newtotcounter{totalsections}
\newcounter{othersections}
\newtotcounter{totaltables}
\NewTotalDocumentCounter{equations}
\DeclareAssociatedCounters[autodefine=none]{section}{totalsections,othersections,equations}
\AddAssociatedCounters{section}{totalsections}
\DeclareAssociatedCounters{page}{newtotalpages}
\DeclareAssociatedCounters{table}{totaltables}
\begin{document}
\chapter{First}
In \cref{section::dummylabel} we will see that
\section{First}
\begin{table}
\caption{table}
\end{table}
\begin{table}
\caption{table}
\end{table}
\begin{table}
\caption{table}
\end{table}
\section{Other}
\section{Third}
\begin{table}
\caption{Other table}
\end{table}
\begin{equation}
E=mc^2
\end{equation}
\begin{equation}
E=mc^2
\end{equation}
\TotalValue{equations}
\chapter{Second chapter}
\section{First section of 2nd chapter} \label{section::dummylabel}
\thesection\ \total{totalsections}\ \theothersections\ \fbox{\color{blue}{\thetotaltables}}
\IsSuspendedCounter{totalsections}{Yes, it's suspended}{Nope, it's not suspended}
\IsAssociatedCounter{totalsections}{Yes, it's associated}{Nope, it's not associated}
\IsSuspendedCounter{equation}{Yes, it's suspended}{Nope, it's not suspended}
\IsAssociatedCounter{equation}{Yes, it's associated}{Nope, it's not associated}
\TotalValue{equations}
\TotalValue{equations}
\SetDocumentCounter{section}{28}
\SetDocumentCounter{totalsections}{100}
\NewDocumentCounter[initial=151]{counterother}[section]
Value of counterother: \thecounterother
\section{Another one}
Value of counterother: \thecounterother
\thesection\ \thetotalsections\ \theothersections\ \fbox{\color{blue}{\thetotaltables}}\
\SyncCounters[onlycounters={totalsections}]{section}
\IfIsDocumentCounterTF{section}{%
Yes, it's a counter
}{%
No, it's no counter
}
\IsSuperTotalCounterT{numberofruns}{%
Yes, numberofruns is a super total counter
}
\IsSuperTotalCounterF{chapter}{%
No, chapter is not a super total counter
}
\countersresetlistcount{chapter}
\SetDocumentCounter{counterother}{\getresetlistcount}
\begin{itemize}
\item There are \getresetlistcount\ counters in the reset list of chapter
\item \IfInResetListTF{chapter}{figure}{Yes, figure is in the reset list of chapter}{No, figure is not in the reset list of chapter}
\item \IfInResetListTF{chapter}{page}{Yes, page is in the reset list of chapter}{No, page is not in the reset list of chapter}
\item Values: \thesection\ \total{totalsections}\ \theothersections\ \fbox{\color{blue}{\total{totaltables}}}\ \thecounterother.
\end{itemize}
Total value of equations: \TotalValue{equations}
Internal name: \TotalCounterInternalName{equations}
\begin{table}
\caption{table}
\end{table}
%\stepcounter{equations}
\chapter{Another chapter}
\PrettyPrintCounterName{countertype=general}{equation}
\PrettyPrintCounterName{countertype=driver}{chapter}
\PrettyPrintCounterName{countertype=associated}{totalsections}
\PrettyPrintCounterName{countertype=total}{equations}
\begin{table}
\caption{table}
\end{table}
\chapter{A new chapter}
\begin{equation}
E=mc^2
\end{equation}
\chapter{Another new chapter}
\begin{equation}
E=mc^2
\end{equation}
\end{document}
|