大写字母和空间因素

大写字母和空间因素

我注意到大写字母后跟标点符号会使后面的粘连行为与通常的单词间粘连一样,并且不会改变空格因子。当大写字母后跟句号时,这种情况基本没问题,因为首字母非常常见(例如D. E. Knuth),但当大写字母后跟感叹号、问号、逗号、分号或逗号时,这种情况就不行了。

我提供了一个 MWE,当标点符号(., !, ?, :, ;, ,)后跟),]}以下三种情况时,它会显示空格因子:当标点符号跟在 (a) 小写字母、(b) 大写字母、(c) 大写字母后跟\@以下标点符号之前时。我知道该csquotes包已经处理了右引号后面的空格因子。

我现在正在考虑在我的文档中添加一个宏,该宏将所有大写字母视为小写字母,而不是在每个大写字母后添加\@上述标点符号。请参阅 egreg 的代码:禁用大写字母后的句号之间的单词间距

我对 LaTeX 社区对这个问题的看法很感兴趣。

\documentclass{article}
\usepackage[fontsize=9pt]{fontsize}
\usepackage{geometry}
\usepackage{multicol}
\setlength{\columnseprule}{0.5pt}
\raggedright
\usepackage{stix2}
%
%The following macro makes all uppercase letters behave like the lowercase with respect to the space factor.
%Source: https://tex.stackexchange.com/questions/60876/disabling-interword-spacing-for-periods-following-capital-letters
%\count255=`A
%\loop
%   \ifnum\count255<`Z
%   \sfcode\count255=1000
%   \advance\count255 by 1
%\repeat
%
\begin{document}
%
\begin{multicols}{4}[\section*{LaTeX Space Factors After Punctuation}]
Period
\par
\verb|abc.|
abc.
\the\spacefactor
\par
\verb|ABC.|
ABC.
\the\spacefactor
\par
\verb|ABC\@.|
ABC\@.
\the\spacefactor
%
\par
\bigskip
Exclamation Mark
\par
\verb|abc!|
abc!
\the\spacefactor
\par
\verb|ABC!|
ABC!
\the\spacefactor
\par
\verb|ABC\@!|
ABC\@!
\the\spacefactor
%
\par
\bigskip
Question Mark
\par
\verb|abc?|
abc?
\the\spacefactor
\par
\verb|ABC?|
ABC?
\the\spacefactor
\par
\verb|ABC\@?|
ABC\@?
\the\spacefactor
%
\par
\bigskip
Colon
\par
\verb|abc:|
abc:
\the\spacefactor
\par
\verb|ABC:|
ABC:
\the\spacefactor
\par
\verb|ABC\@:|
ABC\@:
\the\spacefactor
%
\par
\bigskip
Semicolon
\par
\verb|abc;|
abc;
\the\spacefactor
\par
\verb|ABC;|
ABC;
\the\spacefactor
\par
\verb|ABC\@;|
ABC\@;
\the\spacefactor
%
\par
\bigskip
Comma
\par
\verb|abc,|
abc,
\the\spacefactor
\par
\verb|ABC,|
ABC,
\the\spacefactor
\par
\verb|ABC\@,|
ABC\@,
\the\spacefactor
%
\par
.)
\par
\verb|abc.)|
abc.)
\the\spacefactor
\par
\verb|ABC.)|
ABC.)
\the\spacefactor
\par
\verb|ABC\@.)|
ABC\@.)
\the\spacefactor
%
\par
\bigskip
!)
\par
\verb|abc!|
abc!
\the\spacefactor
\par
\verb|ABC!|
ABC!
\the\spacefactor
\par
\verb|ABC\@!|
ABC\@!
\the\spacefactor
%
\par
\bigskip
?)
\par
\verb|abc?)|
abc?)
\the\spacefactor
\par
\verb|ABC?)|
ABC?)
\the\spacefactor
\par
\verb|ABC\@?)|
ABC\@?)
\the\spacefactor
%
\par
\bigskip
:)
\par
\verb|abc:)|
abc:)
\the\spacefactor
\par
\verb|ABC:)|
ABC:)
\the\spacefactor
\par
\verb|ABC\@:)|
ABC\@:)
\the\spacefactor
%
\par
\bigskip
;)
\par
\verb|abc;)|
abc;)
\the\spacefactor
\par
\verb|ABC;)|
ABC;)
\the\spacefactor
\par
\verb|ABC\@;)|
ABC\@;)
\the\spacefactor
%
\par
\bigskip
,)
\par
\verb|abc,)|
abc,)
\the\spacefactor
\par
\verb|ABC,)|
ABC,)
\the\spacefactor
\par
\verb|ABC\@,)|
ABC\@,)
\the\spacefactor
%
\par
.]
\par
\verb|abc.]|
abc.]
\the\spacefactor
\par
\verb|ABC.]|
ABC.]
\the\spacefactor
\par
\verb|ABC\@.]|
ABC\@.]
\the\spacefactor
%
\par
\bigskip
!]
\par
\verb|abc!|
abc!
\the\spacefactor
\par
\verb|ABC!|
ABC!
\the\spacefactor
\par
\verb|ABC\@!|
ABC\@!
\the\spacefactor
%
\par
\bigskip
?]
\par
\verb|abc?]|
abc?]
\the\spacefactor
\par
\verb|ABC?]|
ABC?]
\the\spacefactor
\par
\verb|ABC\@?]|
ABC\@?]
\the\spacefactor
%
\par
\bigskip
:]
\par
\verb|abc:]|
abc:]
\the\spacefactor
\par
\verb|ABC:]|
ABC:]
\the\spacefactor
\par
\verb|ABC\@:]|
ABC\@:]
\the\spacefactor
%
\par
\bigskip
;]
\par
\verb|abc;]|
abc;]
\the\spacefactor
\par
\verb|ABC;]|
ABC;]
\the\spacefactor
\par
\verb|ABC\@;]|
ABC\@;]
\the\spacefactor
%
\par
\bigskip
,]
\par
\verb|abc,]|
abc,]
\the\spacefactor
\par
\verb|ABC,]|
ABC,]
\the\spacefactor
\par
\verb|ABC\@,]|
ABC\@,]
\the\spacefactor
%
\par
.\}
\par
\verb|abc.\}|
abc.\}
\the\spacefactor
\par
\verb|ABC.\}|
ABC.\}
\the\spacefactor
\par
\verb|ABC\@.\}|
ABC\@.\}
\the\spacefactor
%
\par
\bigskip
!\}
\par
\verb|abc!|
abc!
\the\spacefactor
\par
\verb|ABC!|
ABC!
\the\spacefactor
\par
\verb|ABC\@!|
ABC\@!
\the\spacefactor
%
\par
\bigskip
?\}
\par
\verb|abc?\}|
abc?\}
\the\spacefactor
\par
\verb|ABC?\}|
ABC?\}
\the\spacefactor
\par
\verb|ABC\@?\}|
ABC\@?\}
\the\spacefactor
%
\par
\bigskip
:\}
\par
\verb|abc:\}|
abc:\}
\the\spacefactor
\par
\verb|ABC:\}|
ABC:\}
\the\spacefactor
\par
\verb|ABC\@:\}|
ABC\@:\}
\the\spacefactor
%
\par
\bigskip
;\}
\par
\verb|abc;\}|
abc;\}
\the\spacefactor
\par
\verb|ABC;\}|
ABC;\}
\the\spacefactor
\par
\verb|ABC\@;\}|
ABC\@;\}
\the\spacefactor
%
\par
\bigskip
,\}
\par
\verb|abc,\}|
abc,\}
\the\spacefactor
\par
\verb|ABC,\}|
ABC,\}
\the\spacefactor
\par
\verb|ABC\@,\}|
ABC\@,\}
\the\spacefactor
\end{multicols}
%
\end{document}
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%

在此处输入图片描述

答案1

我主要担心两件事:(a)我的建议会破坏其他理想的 LaTeX 功能、文档类和包(b)我的建议不是最佳实践(尽管我的建议可能对新用户来说更容易)

是的,这是主要问题。如果您创建使用此约定的文档类,那么虽然您可能认为规则“更简单”,但行为不会像任何 (la)tex 教程中所述的那样,并且从其他文档复制或由标准书目样式生成的任何乳胶片段都不会有保护,因此A. N. Other将获得句子结尾的空间。因此,虽然从技术上讲您的建议是可行的,但我认为对于一般用途的文档类来说,这不是一个好的做法。

相关内容