Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
5  
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
add comment

1 Answer

up vote 5 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.