顯示的數學之後、 \item 之前的間距

顯示的數學之後、 \item 之前的間距

這個問題涉及顯示數學後的間距,以及它如何與enumerate環境內的間距相互作用。具體來說,這是一個 MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
First line. Blah blah blah blah blah blah blah blah.
\[a+b=c\] % The spacing above and below is the same
Second line. Blah blah blah blah blah blah blah blah.
\begin{enumerate}
\item First line. Blah blah blah blah blah blah blah.
\[a+b=c.\] % The spacing below is bigger than the spacing above
\item Second item. Blah blah blah blah blah blah blah.
\item Third item. Blah blah blah blah blah blah blah.
\end{enumerate}
\end{document}

在基本層面上,在此 MWE 中,我希望在這兩種情況下顯示數學之前/之後的垂直間距相同。

更一般地(從技術上講),我希望(或添加額外空間的任何內容)像- 類型空間一樣\itemsep進行交互,因此取兩者中的最大值。誰能建議一種方法來做到這一點?\belowdisplayskip\addvspace

筆記:我已經amsmath在上麵包含了,但是這個問題在沒有加載的情況下也會發生amsmath。在我需要這個的地方,我實際上也需要它與enumitem包一起工作,但我不認為這會幹擾任何解決方案。

答案1

根據列表的實現方式,它應該是這樣的。 Any\item開始一個段落,TeX 插入\parskip黏合,它列出了等於 的值\parsep(由類別設定)的值,此外\itemsep;在這種情況下,這\itemsep並沒有通過,但\parskip確實如此。

範例(兩列格式以便於比較)

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\begin{document}
First line. Blah blah blah blah blah blah blah blah.
\[a+b=c\] % The spacing above and below is the same
Second line. Blah blah blah blah blah blah blah blah.
\newpage
\begin{enumerate}
\item First line. Blah blah blah blah blah blah blah.
\[a+b=c.\] % The spacing below is bigger than the spacing above
\item Second item. Blah blah blah blah blah blah blah.
\item Third item. Blah blah blah blah blah blah blah.
\end{enumerate}

\end{document}

在此輸入影像描述

固定的:

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\begin{document}
First line. Blah blah blah blah blah blah blah blah.
\[a+b=c\] % The spacing above and below is the same
Second line. Blah blah blah blah blah blah blah blah.
\newpage
\begin{enumerate}
\item First line. Blah blah blah blah blah blah blah.
\[a+b=c.\vspace{-\parskip}\] % The spacing below is equal to the spacing above
\item Second item. Blah blah blah blah blah blah blah.
\item Third item. Blah blah blah blah blah blah blah.
\end{enumerate}

\end{document}

在此輸入影像描述

載入包可能有意義enumitem

\documentclass[twocolumn]{article}
\usepackage{amsmath,enumitem}
\begin{document}
First line. Blah blah blah blah blah blah blah blah.
\[a+b=c\] % The spacing above and below is the same
Second line. Blah blah blah blah blah blah blah blah.
\newpage
\begin{enumerate}[itemsep=\glueexpr\itemsep+\parsep\relax,parsep=0pt]
\item First line. Blah blah blah blah blah blah blah.
\[a+b=c.\] % The spacing below is equal to the spacing above
\item Second item. Blah blah blah blah blah blah blah.
\item Third item. Blah blah blah blah blah blah blah.
\end{enumerate}

\end{document}

但這當然會影響單一項目內的段落。

相關內容