I would like to write page numbers like this '7/9' in all minted environments of my document. The first number ('7') is the current page and the second number ('9') is the maximum number of page breaks the source file has been split into.
I was planning to use the package totcount
but I realized that it was only considering the last value of the counter at the end of the document and it couldn't manage counters locally to an environment.
Here is a totally stupid example, but it illustrate the problem:
\documentclass{report}
\usepackage{totcount}
\newtotcounter{sectnum}
\let\oldsection\section
\renewcommand{\section}{%
\setcounter{sectnum}{0}%
\regtotcounter{sectnum}%
\oldsection%
}
\let\oldsubsection\subsection
\renewcommand{\subsection}{%
\stepcounter{sectnum}%
\oldsubsection%
}
\begin{document}
\section*{One}
\subsection*{SectionOne}
\thesectnum / \total{sectnum}
\subsection*{SectionTwo}
\thesectnum / \total{sectnum}
\subsection*{SectionThree}
\thesectnum / \total{sectnum}
\subsection*{SectionFour}
\thesectnum / \total{sectnum}
\section*{Two}
\subsection*{SectionOne}
\thesectnum / \total{sectnum}
\subsection*{SectionTwo}
\thesectnum / \total{sectnum}
\end{document}
Gives:
Where we would have liked to have: '1/4', '2/4', '3/4', '4/4' and '1/2', '2/2'.
So, is there a way to get this kind of feature ?