如何防止定理环境后的段落中断?

如何防止定理环境后的段落中断?

默认情况下,列表环境(例如itemize)具有很好的属性,如果你在它后面添加一个空行,它会开始一个新段落,如果你不添加,段落会继续。所以

The following objects
\begin{itemize}
\item car
\item tree
\item pupil
\end{itemize}
are countable.

将产生一个段落,而

Here's a list of uncountable objects:
\begin{itemize}
\item hair
\item rice
\end{itemize}

And now for something completely different

给出了两段。

对于定理类型的环境(我使用课堂上的定理amsart),无论我在之后做什么\end{<theorem type>},段落都会中断。有没有办法让它们表现得像itemize(这样分页取决于我是否在环境后插入空白行)?

编辑由于到目前为止这两个答案都在询问为什么我想要这种行为,而不是默认行为,让我澄清一下。我同意在段落中间陈述定理看起来很奇怪。但我实际上想将该行为用于(简短的)定义或符号设置。例如,我可以写

For the purposes of this monograph, all functions are infinitely differentiable. 
That is, we usually work in the space
\begin{definition}
$C^\infty(\Real^k) \eqdef$ the space of complex-valued smooth functions.
\end{definition}
Often, however, we wish to ignore complications ``from infinity'', i.e.~from 
the non-compactness of $\Real^k$. In these situations we want to use
\begin{definition}
$\mathcal{D} = C^\infty_c(\Real^k) \eqdef$ the space of complex-valued 
smooth functions with compact support.
\end{definition}
Since one of our main tools will be the Fourier transform, the above definition 
is not always satisfactory: the Fourier transform of a function in 
$C^\infty_c(\Real^k)$ will necessarily not be in the same space by the 
uncertainty principle. So a better space is
\begin{definition}
$\mathcal{S}\eqdef$ the space of complex-valued smooth functions with rapid 
decay. That is, all functions $f$ such that $x^\alpha D^\beta f$ remain 
bounded for all multi-indices $\alpha,\beta$. 
\end{definition}
For convenience, we will also introduce the notations
\begin{definition}
$\mathcal{D}' \eqdef$ the space of distributions, or continuous linear maps 
from $\mathcal{D}$ to $\Complex$; and similarly $\mathcal{S}' \eqdef$ the 
space of \emph{tempered} distributions. 
\end{definition}

我觉得压痕造成的锯齿状边缘很不舒服。所以,这不是一个无聊的问题。

答案1

定理环境后的段落取决于是否插入空行适用于标准article类,但没有amsart原因在于 的定义amsart包含\@endtheorem禁用\@endpefalse了条件中断机制。删除它\@endpefalse,一切正常。

\documentclass{amsart}

\makeatletter
% \def\@endtheorem{\endtrivlist\@endpefalse }% OLD
\def\@endtheorem{\endtrivlist}% NEW
\makeatother

\newtheorem{theorem}{Theorem}

\newcommand*{\sometext}{Lorem ipsum dolor sit amet, consectetuer
    adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
    adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
    libero, nonummy eget, consectetuer id, vulputate a, magna.}

\begin{document}

\sometext

\begin{theorem}
\sometext
\end{theorem}

\sometext

\begin{theorem}
\sometext
\end{theorem}
%
\sometext

\end{document}

在此处输入图片描述

答案2

我完全明白你的意思,我也经常想做同样的事情。我使用的一个非常简单的解决方案是:在你不想开始新段落的定理环境后面的行上,输入

\noindent

然后继续在下一行输入。以下是示例。

\documentclass{amsart}
\newtheorem{thm}{Theorem}[section]

\begin{document}
This is the beginning of a paragraph.
\begin{thm}
Important mathematical statement.
\end{thm}
\noindent
We're still in the same paragraph.

\end{document}

答案3

环境theorem结束一个段落,而您正在从中创建一个新的环境,即定义,因此它继承了定理的属性,因为您只是更改了名称。从语义上讲,不希望段落结束并从定理继承是不正确的。这就是为什么您必须进行一些修补才能解决它的原因。一种“更干净”的方法是定义您的环境定义。

\newcounter{definitioncounter}

\newenvironment{mydefinition}{\noindent\textbf{Definition}\arabic{definitioncounter}:\newline\indent}{\newline}

这将满足您的要求(我希望如此)。在命令中的第二对 {} 中,\newenvironment如果您想要与周围文本不同的样式,您可以插入更多命令来为定义中的文本赋予样式。例如,如果您想要斜体。

编辑:使用 \addtocounter{definitioncounter}{1}

如果您希望它从 1 开始而不是从 0 开始。

答案4

防止新段落效应的另一种方法是将定理包装在小页面中:

\documentclass{amsart}
\newtheorem{thm}{Theorem}[section]

\begin{document}
Here we state
\newline
\begin{minipage}{\textwidth}
\begin{thm}
(Famous Theorem) Statement,
\end{thm}
\end{minipage}
\newline
which is part of this paragraph.
\end{document}

如果定理陈述足够短并且你删除命令\newline你甚至可以使其适合内联。

我同意 Juan 的观点,不过这看起来很有趣... 您能举出一些例子来说明您所要求的解决方案比默认解决方案更好吗?或者您只是好奇这是否可能?

相关内容