當我只想顯示一行方程式時,對齊和方程式環境有什麼不同?

當我只想顯示一行方程式時,對齊和方程式環境有什麼不同?

我正在排版實體文檔,有時需要輸入多行方程,而大多數情況下只需要輸入一行公式。那麼,如果我總是使用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

很明顯是一條短線多於 alignequation的解釋與(將上述方程式(6)和(8)與方程式(5)和(7)的較大跳躍進行比較)的解釋不同。

但這還不是全部,從這個意義上來說,上面的圖片有點誤導。如果minipages 與 ottom 對齊[b]而不是與[t]op對齊

在此輸入影像描述

你會發現即使是跳過以下align當顯示後面的行很短時,對 的解釋會有所不同。


可以在 中使用單一方程式嗎align?當然可以,如果你對它的外觀感到滿意的話。對於周圍的文本,您可能會期望顯示器兩側都有長(“不是短”)線,在這種情況下,align“執行”類似於equation(上面的等式(1)-(4))。

答案2

正如評論中所述,唯一的區別是公式的間距。您應該equation盡可能align在有多行公式時嘗試使用。

另外:equation當您有內部環境時會拋出錯誤&,因此在兩者之間進行轉換時請注意這一點。

相關內容