為什麼顯示數學後 \smallskip 這麼大?

為什麼顯示數學後 \smallskip 這麼大?

在下面的 MWE 中,為什麼\smallskip在顯示數學之後添加這麼多額外的空間? (我該如何解決它?)

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage{amsmath}

\begin{document}
This line.

Next line.
\smallskip

Next line after small skip.

\[displaymath\]

Next line.

\[displaymath\]
\smallskip

Next line after small skip.
\end{document}

在此輸入影像描述

答案1

好的 LaTeX 語法是絕不立即留下一個或多個空白行-這會隱式地產生段落分隔符顯示數學組。如果需要,可以開始一個新段落顯示數學組。

如果您想避免在一個顯示數學組的末尾和下一段之間產生過多的垂直空白,那麼在仍然使用 的同時,請確保不要在指令和下一段\smallskip之間插入空行。\smallskip

在此輸入影像描述

\documentclass[12pt]{article}
\usepackage{amsmath}
\setlength\parindent{0pt} % just for this example
\setlength\textwidth{3in} % just for this example
\begin{document}
This line.

Another line.

\smallskip              % no blank line after \smallskip
Line after a smallskip. % no blank line *before* \[...\]
\[\text{displaymath}\]

Line with no smallskip. % no blank line *before* \[...\]
\[\text{displaymath}\]

\smallskip              % no blank line after \smallskip
Line after a smallskip.
\end{document}

答案2

在顯示數學之前/之後不要使用空白行。這樣使用它:

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage{amsmath}

\begin{document}
    This line.

    Next line.
    \smallskip

    Next line after small skip.
%   
    \[displaymath\]
%   
    Next line.
%   
    \[displaymath\]
    \smallskip

    Next line after small skip.
%
    \[displaymath\]
%   
    Next line after small skip.
\end{document}

相關內容