从定理看新环境下的间距问题

从定理看新环境下的间距问题

我正在尝试创建一个定理环境,我可以使用它来重复书中先前陈述的定理,但将其编号与第一个实例相同。我找到了某种解决方案:

\documentclass{article}

\usepackage{amsthm} 

\newtheorem{theorem}{Theorem}
\newcounter{thmC}
\newtheorem{rethm}[thmC]{Theorem}

\newenvironment{retheorem}[1]%
{\setcounter{thmC}{#1}%
\addtocounter{thmC}{-1}%
\begin{rethm}}%
{\end{rethm}\ignorespacesafterend}

\begin{document}

\begin{theorem}\label{theorem:Hi}
Hi this is my theorem.
\end{theorem}

\begin{theorem}\label{theorem:another}
Another theorem.
\end{theorem}

\begin{theorem}\label{theorem:third}
third theorem
\end{theorem}

\begin{retheorem}{\ref{theorem:third}}
third theorem
\end{retheorem}

\begin{retheorem}{\ref{theorem:another}}
Another theorem.
\end{retheorem}

\begin{retheorem}{\ref{theorem:Hi}}
Hi this is my theorem.
\end{retheorem}

\end{document}

它几乎可以工作,但是存在间距问题。

输出图片

我进一步担心的是,这种方法是否适用于标有以下部分的定理

\numberwithin{theoremC}{section}
\newtheorem{theorem}[theoremC]{Theorem}

答案1

restatable此功能已由环境提供thmtools包;该包还提供了一个continues密钥,它在两种情况下处理定理计数器从属于另一个定理计数器的情况:

\documentclass{article}
\usepackage{amsthm} 
\usepackage{thmtools,thm-restate}

\declaretheorem[numberwithin=section]{theorem}

\begin{document}

\section{Test section one}
\begin{theorem}[label=thm:key]
This is a theorem that will be continued later.
\end{theorem}
\begin{restatable}{theorem}{Hi}
This is my first restatable theorem.
\end{restatable}
\begin{restatable}{theorem}{another}
This is my second restatable theorem.
\end{restatable}
\section{Test section two}
\begin{restatable}{theorem}{third}
This is my third restatable theorem.
\end{restatable}
\section{Test section three}
\third*
\another*
\Hi*
\begin{theorem}[continues=thm:key]
And here I expand my theorem.
\end{theorem}

\end{document}

在此处输入图片描述

然而,可重述定理和标准定理在垂直间距上仍然存在一些差异。

相关内容