我有一段文本使用了 2000 年代中期在线风格,将感叹号与个号交织在一起,例如(对于不熟悉的人,我很抱歉):
哦,德拉科!111111!1 哦,德拉科你真棒!1111
从语义上讲,这些符号的作用相当于感叹号,但 LaTeX 并不知道这一点。正如问题“缩写后的句号与句子结尾的句号相同吗?“ 和 ”\@(即反斜杠 at)的正确用法是什么?“LaTeX 使用字符及其周围环境来确定单词间距和句子间距。有没有办法将字符更改为在整个文档中或环境中1
处理?最好与 XeLaTeX 兼容。!
最小工作示例:
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\begin{document}
\noindent Hi!1 I am Dan. This is \TeX.\\
\noindent Hi!! I am Dan. This is \TeX.
\end{document}
答案1
Latex 已经使 1 具有 catcode 12(相同!)因此您只需通过其空间因子代码指定间距。
默认\nonfrenchspacing
有
\sfcode`\!3000
所以你可以指定
\sfcode`\1=3000
因此 1 后跟一个空格将会得到句子结尾的空间。
\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
This and that. One two three! Red yellow blue1
This and that1 One two three1 Red yellow blue1
This and that. One two three! Red yellow blue1
This and that. One two three! Red yellow blue1
This and that1 One two three1 Red yellow blue1
This and that. One two three! Red yellow blue1
\sfcode`\1=3000
This and that. One two three! Red yellow blue1
This and that1 One two three1 Red yellow blue1
This and that. One two three! Red yellow blue1
This and that. One two three! Red yellow blue1
This and that1 One two three1 Red yellow blue1
This and that. One two three! Red yellow blue1
\end{document}