
我正在排版實體文檔,有時需要輸入多行方程,而大多數情況下只需要輸入一行公式。那麼,如果我總是使用align
環境而不是在align
和之間切換,可以嗎equation
?
答案1
這垂直的間距不同,但僅在某些情況下才明顯。要看到這一點,請考慮在這些顯示器周圍顯示文字的所有可能方式:
\documentclass{article}
\usepackage{amsmath}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
Long/long line before/after display:
\begin{minipage}[t]{.5\textwidth}
Lorem ipsum.
\begin{equation}
f(x) = ax^2 + bx + c
\end{equation}
Lorem ipsum.
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}
Lorem ipsum.
\begin{align}
f(x) = ax^2 + bx + c
\end{align}
Lorem ipsum.
\end{minipage}
\hrulefill
Long/short line before/after display:
\begin{minipage}[t]{.5\textwidth}
Lorem ipsum.
\begin{equation}
f(x) = ax^2 + bx + c
\end{equation}
Lrm.
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}
Lorem ipsum.
\begin{align}
f(x) = ax^2 + bx + c
\end{align}
Lrm.
\end{minipage}
\bigskip
\hrulefill
\bigskip
Short/long line before/after display:
\begin{minipage}[t]{.5\textwidth}
Lrm:
\begin{equation}
f(x) = ax^2 + bx + c
\end{equation}
Lorem ipsum.
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}
Lrm:
\begin{align}
f(x) = ax^2 + bx + c
\end{align}
Lorem ipsum.
\end{minipage}
\hrulefill
Short/short line before/after display:
\begin{minipage}[t]{.5\textwidth}
Lrm:
\begin{equation}
f(x) = ax^2 + bx + c
\end{equation}
Lrm.
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}
Lrm:
\begin{align}
f(x) = ax^2 + bx + c
\end{align}
Lrm.
\end{minipage}
\end{document}
上面展示了在顯示之前/之後使用長/短文字片段的所有組合;左列表示使用 an equation
,右列使用與 an 等效的內容align
。這些會影響 TeX 顯示跳躍的使用:
\abovedisplayskip% If the line ending above the display is not short
\abovedisplayshortskip% ... If the line ending above the display is short
\belowdisplayskip% If the line ending below the display is not short
\belowdisplayshortskip% ... If the line ending below the display is short
很明顯是一條短線多於 align
equation
的解釋與(將上述方程式(6)和(8)與方程式(5)和(7)的較大跳躍進行比較)的解釋不同。
但這還不是全部,從這個意義上來說,上面的圖片有點誤導。如果minipage
s 與 ottom 對齊[b]
而不是與[t]
op對齊
你會發現即使是跳過以下align
當顯示後面的行很短時,對 的解釋會有所不同。
可以在 中使用單一方程式嗎align
?當然可以,如果你對它的外觀感到滿意的話。對於周圍的文本,您可能會期望顯示器兩側都有長(“不是短”)線,在這種情況下,align
“執行”類似於equation
(上面的等式(1)-(4))。
答案2
正如評論中所述,唯一的區別是公式的間距。您應該equation
盡可能align
在有多行公式時嘗試使用。
另外:equation
當您有內部環境時會拋出錯誤&
,因此在兩者之間進行轉換時請注意這一點。