在前一行较短的段落中,公式后的垂直空间是否增加?

在前一行较短的段落中,公式后的垂直空间是否增加?

问题

我知道 LaTeX 段落中方程式周围的间距取决于方程式前一行的长度。当前一行较短时,方程式前的垂直空间较少,因为方程式的文本实际上位于行的空白部分下方。因此,在纯文本中,我们得到如下内容:

  The quick brown fox jumps over the
lazy dog. The quick brown fox jumps.
                                       ; blank line before equation
              F = ma

  The quick brown fox jumps over the
lazy dog.                              ; no blank line before equation
              F = ma

我觉得这很有道理,但似乎在前一种情况下,空间量“看起来”差不多,而在后一种情况下,等式下方的空间量“看起来”更小。下面是一个最小示例的屏幕截图和代码。

这种行为在哪里指定或记录,我该如何调整它?在最小示例中,差异看起来并不严重,但很明显,而在我正在处理的文档中,差异非常明显,看起来并不那么好。该文档有很多非最小的东西(需要包装的树状证明\中心,以及双倍行距),但我希望可以根据此处的示例解决这个问题。

最小工作示例

方程式周围的垂直间距

\documentclass{article}

\begin{document}

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.

The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

\end{document}

真实但非最小问题的说明

真实非最小问题的说明

答案1

您似乎希望将\belowdisplayshortskip设置为等于\belowdisplayskip;如果显示屏上方的行是“短的”,则使用前者。参数在中设置\normalsize(也在\small和中设置\footnotesize)。只需附加适当的声明即可。

\documentclass{article}
\usepackage{etoolbox}
\appto\normalsize{\belowdisplayshortskip=\belowdisplayskip}
% the following two are not strictly necessary
\appto\small{\belowdisplayshortskip=\belowdisplayskip}
\appto\footnotesize{\belowdisplayshortskip=\belowdisplayskip}

\begin{document}

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.

\end{document}

在此处输入图片描述

答案2

制作\belowdisplayshortskip相同\belowdisplayskip

作为Werner 在评论中提到,控制间距的关键在于\abovedisplayskip\belowdisplayskip\abovedisplayshortskip\belowdisplayshortskip在我的特定示例中,我认为只需将上面的短跳过设置为与上面的正常跳过相同,即可获得不错的效果。当文本为双倍行距时,差异非常明显:

\documentclass{article}

\usepackage{setspace}
\doublespacing

\begin{document}

\section*{Ugly Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

\section*{Better Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\setlength{\belowdisplayshortskip}{\belowdisplayskip}
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
\end{document}

调整前后间距

选项setspace

由于我实际上正在使用该setspace软件包,因此方程式和双倍行距也相关。这nodisplayskipstretch使得事情变得更加相似,但不是特别漂亮:

\documentclass{article}

\usepackage[nodisplayskipstretch]{setspace}
\doublespacing

\begin{document}

\section*{Ugly Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

\section*{Better Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\setlength{\belowdisplayshortskip}{\belowdisplayskip}
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
\end{document}

使用 nodisplayskipstretch 进行 setspace

相关内容