Closed lrtfm closed 4 months ago
标题的行距是正常的,是 {\large\mytest}
的行距偏小了。用 {\large\mytest\par}
就得到正常的、\large
时的行距了。
{\large\mytest}
相当于 {\large\mytext}\par
,这是在段落中间修改字号和行距。这时候最终应用的 \baselineskip
是 \normalsize
时的行距。(也许在 texdoc texbytopic
有讲,我没去找。)
下面的例子里,\Huge
的输出效果更为明显:
{\Huge<text>}
时的行距太小、与 \Huge
不匹配,导致相邻行几乎紧贴(是 \lineskip
和 \lineskiplimit
在起作用){\Huge<text>\par}
才应用了 \Huge
设置的行距\documentclass{article}
\newcommand{\lhead}{XXX XXX XXX XXX XXX \newline}
\newcommand{\llhead}{\noindent\lhead\lhead\lhead\lhead\lhead}
\begin{document}
{\large\llhead}\par
{\large\llhead\par}
{\Huge\llhead}\par
{\Huge\llhead\par}
\end{document}
TeX 里,每个段落内部的行距是固定值,它是段落结束时 \baselineskip
的值。
参考这个回答 https://tex.stackexchange.com/a/45398:
And there is another problem with this setup: you change the
\baselineskip
midway as you are changing the font size for the description. But again TeX only looks once at the\baselineskip
for a paragraph (when it hits\par
). Thus your first two lines would already be in the smaller baselineskip but with a larger font.
感谢您的解释. 根据您的提示, 我看了下 texdoc texbytopic
, 在 15.4 节有如下说明:
The amount of leading cannot be changed in the middle of a paragraph, because the value for
\baselineskip
that is used is the one that is current when the paragraph is finally broken and added to the main vertical list. The same holds for the\lineskip
and\lineskiplimit
.
下面是一个长标题的例子, 当把标题字体和段落字体设置一致的时候, 标题的行距明显大于段落的行距. 但是输出显示
baselineskip
是相同的, 这是为什么? 怎么能调整一致?使用
xelatex
编译的结果如下:从这里可以明显看出
\section{\mytest}
的行间距比段落{\large\mytest}
的行间距要大.