# Display counters only if it is used at least two times

In this page, I've found one way to display one counter only if it is used at least two times.

The problem with this solution is that it doesn't work with two counters. Is there a way to allow this kind of feature ?

\documentclass{article}
\makeatletter
\newcommand{\defineoneshotcounter}[1]{%
\newcounter{#1}
\newcounter{#1@helper}
\expandafter\newcommand\csname show#1\endcsname[1][\arabic]{%
\stepcounter{#1}%
\stepcounter{#1@helper}%
\@ifundefined{#1@reset@\the\csname c@#1@helper\endcsname}{##1{#1}}{}%
}
\@namedef{reset#1}{%
\ifnum\csname c@#1\endcsname=1\if@filesw
\immediate\write\@auxout{%
\string\global\string\@namedef{#1@reset@\the\csname c@#1@helper\endcsname}{}%
}%
\fi\fi
\setcounter{#1}{0}%
}
}
\makeatother

\defineoneshotcounter{FirstCounter}
\newcommand{\FirstCounterStyle}[1]{\{\arabic{#1}\}}

\defineoneshotcounter{SecundCounter}
\newcommand{\SecundCounter}[1]{\{\arabic{#1}\}}

\setlength{\parindent}{0cm}

\begin{document}

\section{First counter}

TEST : \showFirstCounter,
TEST : \showFirstCounter,
TEST : \showFirstCounter,
RESET : \resetFirstCounter

TEST : \showFirstCounter[\alph],
TEST : \showFirstCounter[\alph],
RESET : \resetFirstCounter

TEST : \showFirstCounter,
RESET : \resetFirstCounter

TEST : \showFirstCounter[\FirstCounterStyle],
TEST : \showFirstCounter[\FirstCounterStyle],
TEST : \showFirstCounter[\FirstCounterStyle],
TEST : \showFirstCounter[\FirstCounterStyle],
RESET : \resetFirstCounter

TEST : \showFirstCounter,
RESET : \resetFirstCounter

TEST : \showFirstCounter,
TEST : \showFirstCounter,
RESET : \resetFirstCounter

\section{Secund counter}

TEST : \showSecundCounter,
TEST : \showSecundCounter,
TEST : \showSecundCounter,
RESET : \resetSecundCounter

TEST : \showSecundCounter[\alph],
TEST : \showSecundCounter[\alph],
RESET : \resetSecundCounter

TEST : \showSecundCounter

\end{document}

-
Please provide the link where you took the solution from, so that we can see the original. –  Ahmed Musa Feb 14 '12 at 18:18
Just click on "This page" in my message. –  projetmbc Feb 14 '12 at 19:41
It would help if you cold show the resulting output. –  Marc van Dongen Feb 14 '12 at 22:20

I guess he's saying that the last \showSecundCounter shouldn't have produced any result, because it was called only once after SecundCounter was reset.