I want to count my section
's, figure
's etc. using the totcount
package. To get a general useable template I want to show only counters which are larger than zero. But it seems that total{counter}
would not evaluated.
I tried the following but none of the both hide
calls generate any output:
\documentclass{article}
\usepackage{totcount}
\regtotcounter{section}
\newcommand{\hide}[2] {
\ifnum0<0#1
#2
\fi
}
\begin{document}
\section{Section One}
\section{Section Two}
\section{Section Three}
% should print "Sections: 3" but doesn't show anything
\hide{\total{section}}{Sections: \total{section}}
% should print nothing
\hide{\total{figure}}{Figures: \total{figure}}
\end{document}
If I wrote the numbers manually it works like expected:
% prints "Sections: 3"
\hide{3}{Sections: \total{section}}
% prints nothing
\hide{0}{Figures: \total{figure}}
What am I doing wrong? Is there a better approach to get the expected result?