为什么 LaTeX 在“用户字距”之后既不中断也不连字符?

为什么 LaTeX 在“用户字距”之后既不中断也不连字符?

当使用\kern用户定义的字距命令或\,小的不间断空格的简写时,这将扩展为“userkern”节点。在这样的节点处,LaTeX 不会换行,并且这些节点后面的单词不会被连字符连接。这是为什么呢?

\hspace{0em}我知道可以通过插入(或者首先使用不可拉伸的胶水)来“修复”它。但我的问题是:这背后的原理是什么?

答案1

字距主要用于校正字母之间难看的冲突;例如,斜体校正是一种可用于破坏连字符的字距,而您通常不希望出现换行符。

摘自 TeXbook(第 14 章):

\danger Line breaks can occur only in certain places within a horizontal
list. Roughly speaking, they occur between words and after hyphens, but in
actuality they are permitted in the following five cases:\enddanger

\smallskip
\item{a)} at glue, provided that this glue is immediately preceded by a
non-discardable item, and that it is not part of a math formula (i.e., not
between math-on and math-off). A break ``at glue'' occurs at the left edge
of the glue space.

\smallskip
\item{b)} at a kern, provided that this kern is immediately followed by
glue, and that it is not part of a math formula.

\smallskip
\item{c)} at a math-off that is immediately followed by glue.

\smallskip
\item{d)} at a penalty (which might have been inserted automatically in a
formula).

\smallskip
\item{e)} at a discretionary break.

就连字而言,字距并不标记单词的边界。

摘自 TeXbook(附录 H):

\ddanger \TeX\ looks for potentially hyphenatable words by searching
ahead from each glue item that is not in a math formula. The search
bypasses characters whose |\lccode| is zero, or ligatures that begin
with such characters; it also bypasses whatsits and {\sl^{implicit kern}\/}
items, i.e., kerns that were inserted by \TeX\ itself because of information
stored with the font. If the search
finds a character with nonzero |\lccode|, or if it finds a ligature
that begins with such a character, that character is called the
{\sl starting letter}. But if any other type of item occurs before a suitable
starting letter is found, hyphenation is abandoned (until after the next
glue item). Thus, a box or rule or mark, or a kern that was explicitly
inserted by ^|\kern| or~|\/|, must not intervene between glue and a
hyphenatable word. If the starting letter is not lowercase (i.e.,
if it doesn't equal its own |\lccode|), hyphenation is abandoned unless
^|\uchyph| is positive.

因此,隐式字距会被绕过,就像它们不存在一样,但显式字距会阻止进一步的连字尝试。

如果您想指定可能的换行点,则必须使用\penalty或粘连。

答案2

我认为这和从 TeXbook 中得到的解释一样好。

\ddanger According to the rules above, there's an important distinction
between implicit and explicit kerns, because \TeX\ recomputes implicit
kerns when it finds at least one hyphen point in a word. You can
see the difference between these two types of kerns when \TeX\ displays
lists of items in its ^{internal format}, if you look closely:
`|\kern2.0|' denotes an implicit kern of $2\pt$, and `|\kern 2.0|'
denotes an explicit kern of the same magnitude. The ^{italic correction}
command~|\/| inserts an explicit kern.

相关内容