summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cntperchap/cntperchap_example.tex
blob: cb154640e00018cf13594bb82562fde77a06508a (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
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
%% Example file for cntperchap.sty
%%
%% License: LaTeX Project Public License version 1.3 
%% Copyright (2015) Dr. Christian Hupfer 
%% Author: Christian Hupfer christian.hupfer@yahoo.de
%%
%% 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 `maintained'.
%%
%% This work consists of all files listed in README
%%
%%%%


\documentclass[verbose]{scrbook}


\usepackage{tcolorbox}
\usepackage{cntperchap}

\usepackage{amsthm}
\usepackage{blindtext}
\usepackage{pgffor}



% Register the most important counters
\RegisterCounters{equation,figure,table,section,subsection,subsubsection,paragraph,subparagraph,enumi,enumii,enumiii,enumiv}

% generate the counter automatically by using 'autodefine=true' otherwise the registration would fail
% Define some theorem for using a non-standard-counter
\newtheorem{theorem}{theorem}

\newtheorem{lemma}{lemma}
\RegisterCounter{lemma}


% To show/number the lower levels too
\setcounter{secnumdepth}{5}

\begin{document}
\begin{tcolorbox}[title={Document statistics for demonstration},colbacktitle=red,coltitle=black]
There are \numberofstoredcounters\ counters tracked. 

  \Fullstatistics
\end{tcolorbox}

\tableofcontents
\listoffigures
\listoftables


\chapter{First}
\ShowStatistics[1]

\begin{enumerate}
\item Groucho
\item Zeppo
\item Harpo
\item Chico
\end{enumerate}

\begin{equation}
  c^2 = a^2 + b^2 
\end{equation}

but

\ShowStatistics[4]
\section{First}


\begin{enumerate}
\item This 
\item \begin{enumerate}
  \item is
    \begin{enumerate}
    \item a 
      \begin{enumerate}
      \item useless
      \end{enumerate}
    \end{enumerate}
  \end{enumerate}
\item List \theenumiv
\end{enumerate}




\begin{table}
\caption{faketable}
\caption{other faketable}

\end{table}
\section{Second}

\chapter{Second}
\ShowStatistics

\section{First}
\section{Second}
\section{Third}
\section{Fourth}



% Now a really large chapter
\chapter*{Third}
\ShowStatistics

\foreach \x in {1,...,5} {%
\section{Section \x~in chapter \thechapter}
}
\chapter{Fourth}
\ShowStatistics[3]

\begin{figure}
\caption{fake figure}
\caption{other fakefigure 1}
\caption{other fakefigure 2}
\caption{other fakefigure 3}
\caption{other fakefigure 4}

\end{figure}




\section*{A single section}

\begin{theorem}
\blindtext
\end{theorem}
\subsection{A small subsection}
\subsubsection{An even smaller subsubsection}

\foreach \x in {1,...,10} {%
\begin{equation}
  E = mc^2 
\end{equation}
}


\end{document}