我想知道是否有人可以帮助我解决每次输入长方程时都会遇到的间距问题。我试图使二项式定理的证明看起来干净利落,但在尝试以美观的方式对齐方程时遇到了麻烦。我尝试使用拆分方程环境,虽然它使页面上的所有内容都可见,但我仍然不喜欢间距,我希望所有内容都垂直居中(水平居中也行,尽管这不是什么大问题)。我是 LaTeX 的新手,也是这个网站的新手,因此我将非常感谢任何建议(代码或其他)。
\documentclass{article}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{bm}
\begin{document}
\noindent \textbf{Binomial Theorem:} If $n \in {\mathbb Z_{\geq 0}}$, then
$$(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}$$
\begin{doublespace} \end{doublespace}
\noindent \textbf{Proof:} Let $n=0$, then $(x+y)^0 =
\displaystyle\sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.
Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
\begin{equation*}
\begin{split}
(x+y)^{n+1} = (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}
\\ &= \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} + \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1}
\end{split}
\end{equation*}
Now we reindex the first sum, replacing each occurrence of $k$
by $k-1$. Since the original sum extends over all values of $k$,
so does the reindexed sum. Hence
\begin{center}
\begin{equation*}
\begin{split}
(x+y)^{n+1} =
\sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1} + \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1}
\\ &= \sum_{k=0}^{n} \bigg(\binom{n}{k-1} + \binom{n}{k}\bigg)x^{k}y^{n-k+1}
\\ &= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{split}
\end{equation*}
\end{center}
By the addition identity, this establishes the required result.
\end{document}
答案1
看来您正在寻找这个:
方程分裂的锚点应存在于方程的每一行中:
\documentclass{article}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{bm}
\begin{document}
\noindent \textbf{Binomial Theorem:} If $n \in {\mathbb Z_{\geq 0}}$, then
\[
(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}
\]
\noindent \textbf{Proof:} Let $n=0$, then $(x+y)^0 =
\displaystyle\sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.
Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
\[
\begin{split}
(x+y)^{n+1}
& = (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k} \\
& = \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} + \sum_{k=0}^{n}
\binom{n}{k}x^{k}y^{n-k+1}
\end{split}
\]
Now we reindex the first sum, replacing each occurrence of $k$
by $k-1$. Since the original sum extends over all values of $k$,
so does the reindexed sum. Hence
\[
\begin{split}
(x+y)^{n+1}
& = \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
+ \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1} \\
&= \sum_{k=0}^{n} \bigg(\binom{n}{k-1}
+ \binom{n}{k}\bigg)x^{k}y^{n-k+1} \\
&= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{split}
\]
By the addition identity, this establishes the required result.
\end{document}
答案2
您的输入遗漏了几个&
,但也存在其他一些问题。
使用环境来表示定理和证明等逻辑结构;如果
\noindent
在文档正文中使用多次,则会出现问题切勿使用
$$
(见为什么 \[ ... \] 比 $$ ... $$ 更可取?)该语法已被几十年前
{\Bbb Z}
取代:使用或甚至更好的像下面这样。\mathbb{Z}
\mathbb{Z}_{\geq 0}
\begin{doublespace}\end{doublespace}
什么也不做。证明
\displaystyle
第一行的 只会造成危害:它破坏了行距,但也过于突出了一个微不足道的案例
对于第 1 点,您可以使用amsthm
一个小技巧来定义“命名定理”。如果您想要冒号而不是句号,只需定义定理样式即可(网站上有几个示例)。“证明”标签的排版也类似。
为什么要定义为 和\numberset
?\mathbb
因为这会给你更多的灵活性;如果你的主管告诉你整数和所有其他数字集名称应该以花式书法排版,你只需要更改\Z
\numberset
一行 的 文件 , 而 不是 追逐 它\mathbb
.
我在这里介绍了代码的两种实现;在第二种实现中,等号的对齐在两个显示中都适用。
\documentclass{article}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{bm}
\newcommand{\numberset}[1]{\mathbb{#1}}
\newcommand{\Z}{\numberset{Z}}
\newcommand{\NAMEDtheoremname}{}
\newtheorem*{NAMED}{\NAMEDtheoremname}
\newenvironment{namedtheorem}[1]
{\renewcommand{\NAMEDtheoremname}{#1}\begin{NAMED}}
{\end{NAMED}}
\begin{document}
\begin{namedtheorem}{Binomial Theorem}
If $n \in \Z_{\geq 0}$, then
\[
(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}
\]
\end{namedtheorem}
\begin{proof}
Let $n=0$, then $(x+y)^0 = \sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.
Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
\begin{equation*}
\begin{split}
(x+y)^{n+1}
&= (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k} \\
&= \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} +
\sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1}
\end{split}
\end{equation*}
Now we reindex the first sum, replacing each occurrence of $k$
by $k-1$. Since the original sum extends over all values of $k$,
so does the reindexed sum. Hence
\begin{equation*}
\begin{split}
(x+y)^{n+1}
&= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1} +
\sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1} \\
&= \sum_{k=0}^{n} \biggl(\binom{n}{k-1} + \binom{n}{k}\biggr)x^{k}y^{n-k+1} \\
&= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{split}
\end{equation*}
By the addition identity, this establishes the required result.
\end{proof}
\end{document}
第二版
\documentclass{article}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{bm}
\newcommand{\numberset}[1]{\mathbb{#1}}
\newcommand{\Z}{\numberset{Z}}
\newcommand{\NAMEDtheoremname}{}
\newtheorem*{NAMED}{\NAMEDtheoremname}
\newenvironment{namedtheorem}[1]
{\renewcommand{\NAMEDtheoremname}{#1}\begin{NAMED}}
{\end{NAMED}}
\begin{document}
\begin{namedtheorem}{Binomial Theorem}
If $n \in \Z_{\geq 0}$, then
\[
(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}
\]
\end{namedtheorem}
\begin{proof}
Let $n=0$, then $(x+y)^0 = \sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.
Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
\begin{align*}
(x+y)^{n+1}
&= (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k} \\
&= \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} +
\sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1}
\intertext{Now we reindex the first sum, replacing each occurrence of $k$
by $k-1$. Since the original sum extends over all values of $k$,
so does the reindexed sum. Hence}
(x+y)^{n+1}
&= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1} +
\sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1} \\
&= \sum_{k=0}^{n} \biggl(\binom{n}{k-1} + \binom{n}{k}\biggr)x^{k}y^{n-k+1} \\
&= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{align*}
By the addition identity, this establishes the required result.
\end{proof}
\end{document}