我下面使用的参考资料不起作用。我认为 的定义中缺少了某些内容myclaim
。有什么想法吗?
\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}
答案1
替换\stepcounter
为\refstepcounter
-- 此命令“将计数器增加一,同时设置所使用的值\label
”(来源2e,第 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}