Theorem 无法转到多行,导致文本超出页面范围

Theorem 无法转到多行,导致文本超出页面范围

我正在为一个必须包含证明的课程写一篇论文。我首先将我想要证明的内容列为定理,然后我将介绍证明过程。但是,下面我使用的代码将所有内容放在一行上,定理的文本部分最终超出了页面范围。我尝试在等式后面输入“\”以将文本放在其下方的行上,但这似乎不起作用。有什么想法可以解决这个问题吗?

\begin{theorem}  
\[  
G(x)=\sum_{k\geq0}C_kx^k=\frac{1-\sqrt{1-4x}}{2x},\\ 
where G(x) is the generating function for the catalan number sequence.  
\]  
\end{theorem}

答案1

首先,我不会将字符串放在where G(x) is the generating function for the catalan number sequence.显示的方程式中。其次,里面不能有换行符\[ ... \]。如果您需要创建多行显示的方程式,请使用包提供的合适环境amsmath,例如aligngathermultline

在此处输入图片描述

\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}

\begin{theorem}  
Bla bla bla \dots
\[  
G(x)=\sum_{k\geq0}C_kx^k=\frac{1-\sqrt{1-4x}}{2x}\,,
\]  
where $G(x)$ is the generating function for the catalan number sequence.  
\end{theorem}
\end{document}

答案2

如果您确实希望“其中 G(x) 是加泰罗尼亚数序列的生成函数”短语属于该方程,这会影响方程和该短语之间的垂直间距/垂直间隙的大小,那么您可以例如使用 -gathersplit-环境:

\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\begin{gather*}
G(x)=\sum_{k\geq0}C_kx^k=\frac{1-\sqrt{1-4x}}{2x},\\
\text{where \(G(x)\) is the generating function for the catalan number sequence.}%
\end{gather*}
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\begin{equation*}\begin{split}
&G(x)=\sum_{k\geq0}C_kx^k=\frac{1-\sqrt{1-4x}}{2x},\\
&\text{where \(G(x)\) is the generating function for the catalan number sequence.}%
\end{split}\end{equation*}
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\end{document}

在此处输入图片描述

在某些情况下,一个简单的minipage环境可能会成为你的朋友:

\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\[%
G(x)=\sum_{k\geq0}C_kx^k=\frac{1-\sqrt{1-4x}}{2x},
\text{%
  \begin{minipage}[t]{4cm}%
  where \(G(x)\) is the generating function for the catalan number sequence.%
  \end{minipage}%
}%
\]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\end{document}

在此处输入图片描述

使用\parshapeinside minipage,你可以实现更有趣的事情:

\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\[%
\boxed{%
  G(x)=\sum_{k\geq0}C_kx^k=\frac{1-\sqrt{1-4x}}{2x},
  \text{%
    \begin{minipage}[t]{1.9cm}%
    \parshape 3 0cm 1.9cm 0cm 1.9cm -5.2cm 7.1cm
    where \(G(x)\) is the generating function for the catalan number sequence.%
    \end{minipage}%
  }%
}%
\]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\end{document}

在此处输入图片描述

相关内容