%% LaTeX package xcntperchap - version 0.5 (2018/01/05 -- 22:04:12)
%% Driver examples file for xcntperchap.sty
%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2016 -- 2018 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com>
%% -------------------------------------------------------------------------------------------
%%
%% 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 `author-maintained`
%%
%%

%% LaTeX package xcntperchap - version 0.2 (2016/06/07 -- 09/05/23)
%% Driver file for xcntperchap.sty
%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2016 by Dr. Christian Hupfer <christian dot hupfer at yahoo dot 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 `author-maintained`
%%
%%

\documentclass{book}


\usepackage{xcntperchap}

\usepackage{placeins}
\setcounter{secnumdepth}{5}




\RegisterCounters{chapter}{section,subsection,figure}
\RegisterCounters{section}{subsection,subsubsection,figure}


\begin{document}

\tableofcontents


\cleardoublepage
\markboth{}{}
\begingroup
\parindent=0em
Chapter 1 has \ObtainTrackedValueExp[1]{chapter}{section} sections and \ObtainTrackedValueExp[1]{chapter}{subsection} subsections

Chapter 1 has \ObtainTrackedValueExp[1]{chapter}{figure} figures

Chapter 2 has \ObtainTrackedValueExp[2]{chapter}{section} sections and \ObtainTrackedValueExp[2]{chapter}{subsection} subsections

Chapter 2 has \ObtainTrackedValueExp[2]{chapter}{figure} figures

Section 1 has \ObtainTrackedValueExp[1]{section}{subsection} subsections and \ObtainTrackedValueExp[1]{section}{subsubsection} subsubsections

Section 5 has \ObtainTrackedValueExp[5]{section}{subsection} subsections and \ObtainTrackedValueExp[5]{section}{subsubsection} subsubsections

Section 8 has \ObtainTrackedValueExp[8]{section}{subsection} subsections and \ObtainTrackedValueExp[8]{section}{subsubsection} subsubsections
\endgroup



\chapter{Foo}


\section{First section}

\subsection{My first subsection}

\subsubsection{First subsub}

\subsubsection{Second subsub}


\subsection{other subsection}

\subsubsection{First subsub}

\subsubsection{Second subsub}


\section{Second section}

\subsection{My first subsection}

\subsection{other subsection}

\section{Third section}
\subsection{other subsection}

\subsection{other subsection}
\subsection{other subsection}

\section{Fourth section}


\subsection{other subsection}

\subsection{other subsection}
\subsection{other subsection}

\begin{figure}
\caption{Foofigure}
\end{figure}

\FloatBarrier


\chapter{Foo bar chapter}


\section{A section}

\subsection{ A figure stuff}
\begin{figure}
\caption{Foofigure}
\end{figure}
\begin{figure}
\caption{Foofigure}
\end{figure}
\begin{figure}
\caption{Foofigure}
\end{figure}
\begin{figure}
\caption{Foofigure}
\end{figure}
\begin{figure}
\caption{Foofigure}
\end{figure}
\begin{figure}
\caption{Foofigure}
\end{figure}
\begin{figure}
\caption{Foofigure}
\end{figure}



\section{Foo}

\section{Second section}

\subsection{My first subsection}

\subsection{other subsection}


\subsection{My first subsection}

\subsection{other subsection}


\subsection{My first subsection}

\subsection{other subsection}


\subsection{My first subsection}

\subsection{other subsection}

\section{Third section}


\subsection{My first subsection}

\subsection{other subsection}


\subsection{My first subsection}

\subsection{other subsection}


\subsection{My first subsection}

\subsection{other subsection}


\subsection{My first subsection}

\subsection{other subsection}


\section{The last one}

\subsection{Foo}



\end{document}

