这里有一个标题,上方间距设置为 0.04 行,看起来非常难看:
现在让我们看看如果将上方间距增加到 0.05 行会发生什么:

这样好多了。但显然它并没有真正听从我的指令,只是稍微增加一点上方间距。
问题在于,当在基线网格上进行排版时,确保正文行保持在网格上非常重要。因此,TeX 的做法是允许标题(包括 \r,实际上任何 section 类型的文本)偏离网格,但它会将所有相邻的 section 类型段落打包成一个“标题框”,然后计算需要在该框上方添加多少额外空间,以便框后的下一行重新回到网格上。这就是为什么上方间距设置(或任何设置)可能会导致标题上方突然出现一行额外的空间。而且为了更加巧妙,它还会计算在栏顶部标题上方需要多少空间(在那里上方间距会被忽略),以便其后的第一行文本位于网格上。
所以,并不是我们对标题及其间距没有控制权,而是标题框的高度会向上吸附到整数倍的网格线。
欢迎回复这个问题,以便我们帮助人们更好地理解这一点,并感觉更有掌控力。
Here's a heading with 0.04 lines space above and it's pretty ugly:
And now let's see what happens if we increase the space above to 0.05 lines:

That's better. But it's clearly not really listening to my instruction to just increase the space above by a little bit.
The problem is that when typesetting on a baseline grid, it is important that the main body text lines stay on the grid. So what TeX does is to allow the headings (including \r, in fact anything of text type section) to go off grid, but it then bundles all the adjacent paragraphs of type section into a 'headings box', then it calculates how much extra space it needs to put above the box so that the next line after the box is back on the grid. This is why the space above setting (or any setting) can cause there to suddenly be an extra line of space above the heading. And just to be really clever it also works out how much space needs to go above the headings at the top of the column where the space above is ignored, to get the first text line after to be on the grid.
So it's not that we don't have control over headings and their spacing but that heading boxes snap up to an integral number of grid lines in height.
Feel free to respond to the question so that we can help people understand this better and feel more in control.
机器翻译自 English