I am trying to set-up a system where I can total a counter for each section and print this, then reset each section.
MWE:
\documentclass{article}
\usepackage{xparse}
\usepackage{ifthen}
\usepackage{totcount}
\newcounter{myCounter}[section]
\regtotcounter{myCounter}
\begin{document}
\section{sec1}
\label{sec:sec1}
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\section{sec2}
\label{sec:sec2}
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\stepcounter{myCounter}\themyCounter/\total{myCounter}\\
\end{document}
Produces:
1 sec1
1/6
2/6
3/6
4/6
2 sec2
1/6
2/6
3/6
4/6
5/6
6/6
Desired result:
1 sec1
1/4
2/4
3/4
4/4
2 sec2
1/6
2/6
3/6
4/6
5/6
6/6
I have attempted to do \regtotcounter{myCounter}
but no luck.
totcount
package assumes that the counter variables of interest are global rather than section-specific. Put differently, the package doesn't appear to be set up to deal with counters (e.g.,myCounter
) that get reset each time some other counter (e.g.,section
) is stepped. Asking to modify thetotcount
package to handle subordinated counters would amount to a feature request, and feature requests are off-topic on this site. Have you contacted the maintainer of thetotcount
package directly?