I'd like to display/get the maximum value of a counter that it reaches per section.
I have found a way to get the total/maximum value of a counter in the entire document so far, but I fail to get it working per section.
Is this even possible, perhaps with another package or would I need a custom command?
Picture of problem
MWE
\documentclass[
paper=a4,
DIV=15,
parskip=half
]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{
lmodern,
totcount,
comment,
}
%\setcounter{secnumdepth}{0}
\newcounter{counterPERsection}[section]
\regtotcounter{counterPERsection}
\newcounter{anothercounter}
\regtotcounter{anothercounter}
\begin{comment}
\newcommand{\callingcounters}{%
\stepcounter{counterPERsection}\arabic{counterPERsection}\
\stepcounter{anothercounter}\arabic{anothercounter}.\total{anothercounter}
}
\end{comment}
%%%%%%%%%%%%%%%%%%%%%%
%%% NOT %%%%%%%
%%% WORKING %%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
%\begin{comment}
\newcommand{\callingcounters}{%
\stepcounter{counterPERsection}\arabic{counterPERsection}.\total{counterPERsection}\
\stepcounter{anothercounter}\arabic{anothercounter}.\total{anothercounter}
}
%\end{comment}
\begin{document}
\section{First section}
\callingcounters
\callingcounters
\callingcounters
\callingcounters
\section{Second section}
\callingcounters
\callingcounters
\end{document}


calcbeing loaded, but with Mico's trick from here that went away. Finally, the value for both instances of\ObtainTrackedValueExp{..are a 0/zero. Would you happen to have any clue as to what I could do to zero in on the cause for that? – henry Jun 06 '20 at 11:32.cpc-file in the folder, which has this content: https://pastebin.com/FwbFLb2w (your "dummy" being "totcounter" here) If I set the zeros to different values and save the file, the document displays these values after the next latex run. Then with the next run, they go back to 0. – henry Jun 06 '20 at 11:46\usepackage{calc}beforexcntperchapand have no problem. It's useless to edit the.cpcfile, because it gets rewritten at each run. – egreg Jun 06 '20 at 11:53amsmath,amssymbandsiunitx. No issue. – egreg Jun 06 '20 at 15:12