# Problem with referencing to a newenvironment

The reference I'm using below doesn't work. I think I'm missing something in the definition of myclaim. Any ideas?

\documentclass{llncs}
\usepackage{amsmath}

\newcounter{claimcounter}
\numberwithin{claimcounter}{theorem}
\newenvironment{myclaim}{\stepcounter{claimcounter}{\par\noindent{\bf Claim \theclaimcounter:}}}{\par}

\begin{document}
Refering to Claim \ref{first-claim}

\begin{theorem}
aa
\end{theorem}

\begin{myclaim}
\label{first-claim}
bb
\end{myclaim}
\end{document}

-
Use \refstepcounter instead of \stepcounter –  Ulrike Fischer Feb 14 '13 at 10:49
So simple.. So much time wasted ;-) –  Guy Feb 14 '13 at 10:55

Replace \stepcounter with \refstepcounter -- this command "[i]ncrease[s] a counter by one, also setting the value used by \label" (source2e, chapter 21).

\documentclass{article}

\usepackage{amsmath}
\newtheorem{theorem}{Theorem}

\newcounter{claimcounter}
\numberwithin{claimcounter}{theorem}
\newenvironment{myclaim}{\refstepcounter{claimcounter}{\par\noindent{\bf Claim \theclaimcounter:}}}{\par}

\begin{document}
Refering to Claim \ref{first-claim}

\begin{theorem}
aa
\end{theorem}

\begin{myclaim}
\label{first-claim}
bb
\end{myclaim}
\end{document}

-