我想重新定义声明环境以便对其进行编号,但是在使用计数器时我遇到了困难。
我想要以下内容:
\begin{theorem}
thm 1
\end{theorem}
\begin{proof}
\begin{claim}
blah 1
\end{claim}
\begin{claim}
blah 2
\end{claim}
\end{proof}
\begin{theorem}
thm 2
\end{theorem}
\begin{proof}
\begin{claim}
blah 3
\end{claim}
\end{proof}
生产:
Theorem 1: thm 1
Claim 1.1: blah 1
Claim 1.2: blah 2
Theorem 2: thm 2
Claim 2.1: blah 3
答案1
以下 MWE 展示了如何执行此操作。
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{thm}{Theorem}
\newcounter{claimcounter}
\numberwithin{claimcounter}{thm}
\newenvironment{claim}{\stepcounter{claimcounter}{Claim \theclaimcounter:}}{}
\begin{document}
\begin{thm}
Just testing.
\end{thm}
\begin{proof}
\begin{claim}
first
\end{claim}
\begin{claim}
second
\end{claim}
\begin{claim}
third
\end{claim}
\end{proof}
\begin{thm}
Just testing.
\end{thm}
\begin{thm}
Just testing.
\end{thm}
\begin{claim}
first
\end{claim}
\begin{claim}
second
\end{claim}
\begin{claim}
third
\end{claim}
\end{document}
该命令\numberwithin
允许根据与声明最密切相关的定理对声明进行计数。 \newenvironment
允许您为声明创建环境---除了发布声明编号之外,我在这里没有做太多事情。