方程跳过问题 --- amsmath 包和 \above/belowdisplayskip

方程跳过问题 --- amsmath 包和 \above/belowdisplayskip

几天来我一直被一个关于数学方程式跳过的问题所困扰。我将方程式前后的\lineskiplimit\lineskip\abovedisplayskip其他长度宏全部设置为零,但仍然有一些跳过(见图)。我想知道如何摆脱这些跳过。

这是代码

\documentclass{article}
\usepackage{amsmath}
\usepackage[margin=2in]{geometry}
\begin{document}
\setlength{\lineskiplimit}{0pt}
\setlength{\lineskip}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}\noindent
Some text some text some text some text some text 
some text
\begin{equation*}
a+b=c
\end{equation*}
Some text some text some text some text some text some text
\begin{equation*}
1^2+2^2+\dotsb+n^2=\frac{n(n+1)(2n+1)}{6}
\end{equation*}
Some text some text some text some text some text some text
\end{document}

答案1

非常奇怪的请求,但是您需要(也许),\baselineskip=0pt但仅在某些地方使用它并不容易。

\documentclass{article}
\usepackage{amsmath}
\usepackage[margin=2in]{geometry}
\begin{document}
 \setlength{\lineskiplimit}{0pt}
 \setlength{\lineskip}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}    
\noindent
{\baselineskip=0pt
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB 
\begin{equation*}
a+b=c
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB 
\begin{equation*}
1^2+2^2+\dotsb+n^2=\frac{n(n+1)(2n+1)}{6}
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB }
\baselineskip=10pt plus 2pt minus 3pt
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB 
\begin{equation*}
a+b=c
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB
\begin{equation*}
1^2+2^2+\dotsb+n^2=\frac{n(n+1)(2n+1)}{6}
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB
\end{document} 

在此处输入图片描述

答案2

通常情况下你不应该摆脱那个 skip。Altermundus 告诉你如何这样做,即设置\baselineskip=0pt,但您会看到结果相当丑陋。跳过的原因是标准\baselineskip12pt,您可以检查基线之间的距离是否恰好12pt位于 1--3 行。

那么为什么第二行公式没有跳过呢?关键是:\baselineskip=12pt意味着基线的距离必须是至少 12pt,并且您已经从大部分中获得了该距离,因此 TeX 不需要额外跳过。

答案3

Some text some text some text some text some text some
Some text some text some text some text some text some
Some text some text some text some text some text some
Some text some text some text some text\par\nointerlineskip
\vbox{\baselineskip=0pt\centering
\[a+b=c\]}\nointerlineskip
\noindent Some text some text some text some text some text some text

其他解决方案(例如设置\baselineskip=0pt)的缺陷是,所有段落都将使用该参数排版,行与行之间没有分隔。仅设置\lineskip也不是解决方案,因为它会导致行与行之间的间距不均匀。

相关内容