我只是得到了一些我没想到的方程式间距行为;我认为最好通过 MWE 来解释,我将其放在下面。
问题是:这到底是什么原因造成的?
据我所知,LaTeX 做大多数事情(包括间距)都是有原因的,通常是为了根据对用户输入的解释来优化页面布局。所以我想知道这种选择背后的原因是什么,这样我就能更好地理解为什么我应该保持原样,或者在某些情况下是否/为什么/如何覆盖它。
PS:我了解align
环境,确实,它没有这个问题;然而,这个问题更多的是出于好奇,而不是试图解决特定的问题。
PS2:如果我\par
在每个字符后添加换行符或 s,\[a\]
我也会得到一致的(尽管更大方的)间距。
\documentclass{article}
\begin{document}
\noindent These equations have inconsistent spacing if this line ``pushes down the first.''
\[a\]
\[a\]
\[a\]
\noindent These have inconsistent spacing, regardless of the length of this sentence.\par
\[a\]
\[a\]
\[a\]
\noindent These have consistent spacing, regardless of the length of this sentence.\\
\[a\]
\[a\]
\[a\]
\end{document}
答案1
正如本例所示,您应该使用多行显示,而gather
不要一个显示数学公式接在另一个后面或位于段落的开头。
\documentclass{article}
\showoutput
\showboxdepth=3
\begin{document}
\noindent These equations have inconsistent spacing if this line ``pushes down the first.''
\[a\]
\[a\]
\[a\]
\noindent These have inconsistent spacing, regardless of the length of this sentence.\par
\[a\]
\[a\]
\[a\]
\noindent These have consistent spacing, regardless of the length of this sentence.\\
\[a\]
\[a\]
\[a\]
\end{document}
生产
...\hbox(6.94444+1.94444)x345.0, glue set 4.19391fil []
...\penalty 10000
...\glue(\abovedisplayskip) 10.0 plus 2.0 minus 5.0
...\glue(\baselineskip) 5.75002
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayskip) 10.0 plus 2.0 minus 5.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 5.05556
...\hbox(6.94444+1.94444)x345.0, glue set 24.22176fil []
...\glue(\parskip) 0.0 plus 1.0
...\hbox(0.0+0.0)x345.0, glue set 122.9979fil []
...\penalty 10000
...\glue(\abovedisplayskip) 10.0 plus 2.0 minus 5.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayskip) 10.0 plus 2.0 minus 5.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 5.05556
...\hbox(6.94444+1.94444)x345.0, glue set 32.55511fil []
...\penalty 200
...\glue(\baselineskip) 10.05556
...\hbox(0.0+0.0)x345.0 []
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
...\hbox(4.30554+0.0)x5.28589, shifted 169.85706, display []
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\glue 0.0 plus 1.0fil
center
因此,您会发现,与尝试合并空白的相邻显示环境不同,在后面的显示对之间,您会得到
...\penalty 0
...\glue(\belowdisplayshortskip) 6.0 plus 3.0 minus 3.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
因此可见空间是上方和下方短跳的总和,而在第二次显示之前,你要么得到这个,要么得到
...\glue(\belowdisplayskip) 10.0 plus 2.0 minus 5.0
...\penalty 10000
...\glue(\abovedisplayshortskip) 0.0 plus 3.0
...\glue(\baselineskip) 7.69446
取决于第一个显示器是否使用显示跳跃或短显示跳跃