我是 Latex 的新手,在使用过程中遇到了一些问题align*
。在下面的代码中,前两个方程式是水平与后两个方程的间距不同:
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{amsmath}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\ex}{\:\exists\,}
\newcommand{\nex}{\:\nexists\,}
\newcommand{\all}{\:\forall\,}
\newcommand{\imp}{\Longrightarrow}
\begin{document}
For $A:=\left\{\dfrac{1}{n}-\dfrac{1}{m}:n,m\in\N\right\}$, $\sup(A) = 1, \inf(A)=-1$.\\\\
\textit{Proof}. Suppose for contradiction that $1$ is not an upper bound for $A$, i.e. $\exists n,m \in \mathbb{N} \mid \dfrac{1}{n} - \dfrac{1}{m} > 1$.
\begin{align*}
\iff&\frac{m}{m}\cdot\frac{1}{n} - \frac{n}{n}\cdot\frac{1}{m} > 1\\
\iff&\frac{m-n}{mn}>1\\
\iff& m-n> mn\\
\iff& m > mn + n\\
\iff& m > n(m+1)\\
\text{Because }n(m+1)\geq m+1,\text{ we have}\\
\iff& m > n(m+1) \geq m+1\\
\iff& m > m+1 &\bot\\
\end{align*}
$\newline$Suppose for contradiction that $-1$ is not a lower bound for $A$, i.e. $\ex n,m \in \N \mid$\\$ \dfrac{1}{n} - \dfrac{1}{m} < -1$.
\begin{align*}
\iff&\frac{m}{m}\cdot\frac{1}{n} - \frac{n}{n}\cdot\frac{1}{m} < -1\\
\iff&\frac{m-n}{mn}<-1\\
\iff& m-n<-mn\\
\iff& m +mn < n\\
\iff& m(1+n)< n\\
\text{Because }m(1+n)\geq 1+n, \text{ we have}\\
\iff& 1+n \leq m(1+n) < n\\
\iff& 1+n < n &\bot
\end{align*}
$\newline\newline$ Claim that $\lim\limits_{n=1, m \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = 1$, or $\all \epsilon \in (0,\infty) \ex M \in \N \mid m \in \N: m>M \imp$\\$ \left|(1 - \dfrac{1}{m}) - 1\right| < \epsilon $.
\begin{align*}
\iff& \left| 1 - 1 - \frac{1}{m}\right|<\epsilon\\
\iff& \left|-\frac{1}{m}\right|<\epsilon\\
\iff& \frac{1}{m}<\epsilon\\
\iff& m > \frac{1}{\epsilon}
\end{align*}
Hence, for $M:=\left\lceil\dfrac{1}{\epsilon}\right\rceil+1$, $ m > M \imp \left| 1 - 1 - \dfrac{1}{m}\right|<\epsilon$. Because $\epsilon$ was arbitrarily chosen, it follows that $\lim\limits_{n=1, m \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = 1$.
$\newline\newline$ Claim that $\lim\limits_{m=1, n \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = -1$, or $\all \epsilon \in (0,\infty) \ex N \in \N \mid n \in \N: n>N \imp$\\$ \left|(\dfrac{1}{n}-1) -(-1)\right| < \epsilon $.
\begin{align*}
\iff& \left| -1 - (-1) + \frac{1}{n}\right|<\epsilon\\
\iff& \left| \frac{1}{n}\right|<\epsilon\\
\iff& \frac{1}{n} < \epsilon\\
\iff& n > \frac{1}{\epsilon}
\end{align*}
Hence, for $N:=\left\lceil \dfrac{1}{\epsilon}\right\rceil+1, n > N \imp \left|(\dfrac{1}{n}-1) -(-1)\right| < \epsilon$. Because $\epsilon$ was arbitrarily chosen, it follows that $\lim\limits_{m=1, n \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = -1$.
\end{document}
我不太清楚为什么会发生这种情况。也许这与后两个方程中的方程有关\frac{}{}
……如果是这样,我该如何修复间距,以便所有方程都对齐?谢谢。
答案1
你可能正在寻找\intertext
:
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{amsmath}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\ex}{\:\exists\,}
\newcommand{\nex}{\:\nexists\,}
\newcommand{\all}{\:\forall\,}
\newcommand{\imp}{\Longrightarrow}
\begin{document}
For $A:=\left\{\dfrac{1}{n}-\dfrac{1}{m}:n,m\in\N\right\}$, $\sup(A) = 1$, $\inf(A)=-1$.
\begin{proof}
Suppose for contradiction that $1$ is not an upper bound for $A$, i.e.\@
$\exists n,m \in \mathbb{N} \mid \dfrac{1}{n} - \dfrac{1}{m} > 1$.
\begin{align*}
\iff&\frac{m}{m}\cdot\frac{1}{n} - \frac{n}{n}\cdot\frac{1}{m} > 1\\
\iff&\frac{m-n}{mn}>1\\
\iff& m-n> mn\\
\iff& m > mn + n\\
\iff& m > n(m+1)\\
\intertext{Because $n(m+1)\geq m+1$, we have}
\iff& m > n(m+1) \geq m+1\\
\iff& m > m+1 &\bot\\
\intertext{\indent Suppose for contradiction that $-1$ is not a lower bound for $A$,
i.e.\@ $\ex n,m \in \N \mid \dfrac{1}{n} - \dfrac{1}{m} < -1$.}
\iff&\frac{m}{m}\cdot\frac{1}{n} - \frac{n}{n}\cdot\frac{1}{m} < -1\\
\iff&\frac{m-n}{mn}<-1\\
\iff& m-n<-mn\\
\iff& m +mn < n\\
\iff& m(1+n)< n\\
\intertext{Because $m(1+n)\geq 1+n$, we have}
\iff& 1+n \leq m(1+n) < n\\
\iff& 1+n < n &\bot
\intertext{\indent Claim that $\lim\limits_{n=1, m \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = 1$,
or $\all \epsilon \in (0,\infty) \ex M \in \N \mid m \in \N: m>M \imp
\left|(1 - \dfrac{1}{m}) - 1\right| < \epsilon $.}
\iff& \left| 1 - 1 - \frac{1}{m}\right|<\epsilon\\
\iff& \left|-\frac{1}{m}\right|<\epsilon\\
\iff& \frac{1}{m}<\epsilon\\
\iff& m > \frac{1}{\epsilon}
\intertext{Hence, for $M:=\left\lceil\dfrac{1}{\epsilon}\right\rceil+1$,
$ m > M \imp \left| 1 - 1 - \dfrac{1}{m}\right|<\epsilon$. Because $\epsilon$
was arbitrarily chosen, it follows that
$\lim\limits_{n=1, m \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = 1$.\endgraf\medskip
\indent Claim that $\lim\limits_{m=1, n \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = -1$,
or $\all \epsilon \in (0,\infty) \ex N \in \N \mid n \in \N: n>N \imp
\left|(\dfrac{1}{n}-1) -(-1)\right| < \epsilon $.}
\iff& \left| -1 - (-1) + \frac{1}{n}\right|<\epsilon\\
\iff& \left| \frac{1}{n}\right|<\epsilon\\
\iff& \frac{1}{n} < \epsilon\\
\iff& n > \frac{1}{\epsilon}
\end{align*}
Hence, for $N:=\left\lceil \dfrac{1}{\epsilon}\right\rceil+1$,
$n > N \imp \left|(\dfrac{1}{n}-1) -(-1)\right| < \epsilon$.
Because $\epsilon$ was arbitrarily chosen, it follows that
$\lim\limits_{m=1, n \to \infty} \dfrac{1}{n} - \dfrac{1}{m} = -1$.
\end{proof}
\end{document}
答案2
编辑:发现错误:前两个环境&
的最后一行有太多align
下面是清理后的 MWE(错误仍然存在)
- 不要
\dfrac
在文本中使用,导致行距过大 - 不要在文本中使用
\\
或,你永远不想在文本中手动换行(这是新用户中非常常见的错误)\newline
- 用于
\intertext{...}
内部注释align
(mathtools
提供\shortintertext
具有不同间距的注释)
清洁的 MWE
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{amsmath}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\ex}{\:\exists\,}
\newcommand{\nex}{\:\nexists\,}
\newcommand{\all}{\:\forall\,}
\newcommand{\imp}{\Longrightarrow}
\begin{document}
For $A:=\left\{\frac{1}{n}-\frac{1}{m}:n,m\in\N\right\}$, $\sup(A) = 1, \inf(A)=-1$.
\begin{proof}
Suppose for contradiction that $1$ is not an upper bound for $A$,
i.e.
$\exists n,m \in \mathbb{N} \mid \frac{1}{n} - \frac{1}{m} > 1$.
\begin{align*}
\iff&\frac{m}{m}\cdot\frac{1}{n} - \frac{n}{n}\cdot\frac{1}{m} > 1\\
\iff&\frac{m-n}{mn}>1\\
\iff& m-n> mn\\
\iff& m > mn + n\\
\iff& m > n(m+1)\\
\intertext{Because $n(m+1)\geq m+1$, we have}
\iff& m > n(m+1) \geq m+1\\
\iff& m > m+1 &\bot
\end{align*}
Suppose for contradiction that $-1$ is not a lower bound for $A$,
i.e. $\ex n,m \in \N \mid \frac{1}{n} - \frac{1}{m} < -1$.
\begin{align*}
\iff&\frac{m}{m}\cdot\frac{1}{n} - \frac{n}{n}\cdot\frac{1}{m} < -1\\
\iff&\frac{m-n}{mn}<-1\\
\iff& m-n<-mn\\
\iff& m +mn < n\\
\iff& m(1+n)< n\\
\intertext{Because $m(1+n)\geq 1+n$, we have}
\iff& 1+n \leq m(1+n) < n\\
\iff& 1+n < n &\bot
\end{align*}
Claim that $\lim_{n=1, m \to \infty} \frac{1}{n} -
\frac{1}{m} = 1$, or $\all \epsilon \in (0,\infty) \ex M \in \N \mid
m \in \N: m>M \imp$ $ \left|(1 - \frac{1}{m}) - 1\right| < \epsilon
$.
\begin{align*}
\iff& \left| 1 - 1 - \frac{1}{m}\right|<\epsilon\\
\iff& \left|-\frac{1}{m}\right|<\epsilon\\
\iff& \frac{1}{m}<\epsilon\\
\iff& m > \frac{1}{\epsilon}
\end{align*}
Hence, for $M:=\left\lceil\frac{1}{\epsilon}\right\rceil+1$,
$ m > M \imp \left| 1 - 1 - \frac{1}{m}\right|<\epsilon$. Because
$\epsilon$ was arbitrarily chosen, it follows that
$\lim_{n=1, m \to \infty} \frac{1}{n} - \frac{1}{m} = 1$.
Claim that
$\lim_{m=1, n \to \infty} \frac{1}{n} - \frac{1}{m} = -1$, or
$\all \epsilon \in (0,\infty) \ex N \in \N \mid n \in \N: n>N \imp$
$ \left|(\frac{1}{n}-1) -(-1)\right| < \epsilon $.
\begin{align*}
\iff& \left| -1 - (-1) + \frac{1}{n}\right|<\epsilon\\
\iff& \left| \frac{1}{n}\right|<\epsilon\\
\iff& \frac{1}{n} < \epsilon\\
\iff& n > \frac{1}{\epsilon}
\end{align*}
Hence, for $N:=\left\lceil \frac{1}{\epsilon}\right\rceil+1, n > N
\imp \left|(\frac{1}{n}-1) -(-1)\right| <
\epsilon$. Because
$\epsilon$ was arbitrarily chosen, it follows that
$\lim\limits_{m=1, n \to \infty} \frac{1}{n} - \frac{1}{m} = -1$.
\end{proof}
\end{document}
这是第一页的图片(清洁后),我明白你所说的不均匀是什么意思