使用“setspace”包时方程环境后的间距错误

使用“setspace”包时方程环境后的间距错误

梅威瑟:

\documentclass{article}

\usepackage{amsmath}
\usepackage[onehalfspacing]{setspace}

\usepackage{lipsum}
\setlength{\lineskip}{2em}

\begin{document}

\lipsum[2]
\begin{equation*}
    a + b + \frac{1}{2}
\end{equation*}
\lipsum[2]

\end{document}

输出:

在此处输入图片描述

等式前后的间距不一致。

答案1

在此处输入图片描述

您几乎肯定希望设置为显示跳过\lineskip,并且需要延迟设置直到setspace设置之后。

\documentclass{article}

\usepackage{amsmath}
\usepackage[onehalfspacing]{setspace}

\usepackage{lipsum}
% No!!!\setlength{\lineskip}{2em}

\AtBeginDocument{
\setlength{\abovedisplayskip}{2em plus .2em minus .2em}
\setlength{\abovedisplayshortskip}{1em plus .2em minus .2em}
\setlength{\belowdisplayskip}{2em plus .2em minus .2em}
\setlength{\belowdisplayshortskip}{1.5em plus .2em minus .2em}
}
\begin{document}

\lipsum[2]
\begin{equation*}
    a + b + \frac{1}{2}
\end{equation*}
\lipsum[2]

\end{document}

\lineskip与方程式没有直接关系,并且设置它会使稍微过大的线突然产生巨大的空间,请参见下面的示例。

在此处输入图片描述

\documentclass{article}

\begin{document}


One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One {\large \^X}xxx 
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.

\bigskip\hrule\bigskip
\setlength\lineskip{2em}

One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One {\large \^X}xxx 
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.

\end{document}

相关内容