排版英文文档时,我想在标点符号后面增加一点点空白。用fontspec
包设置字体时可用PunctuationSpace
调整句点等符号后的空白,但对逗号不起作用。
\documentclass{article}
\usepackage{fontspec}
\begin{document}
\fontspec[PunctuationSpace=2]{Latin Modern Roman}
I can eat glass, it doesn't hurt me. I can eat glass, it doesn't hurt me.
\fontspec[PunctuationSpace=10]{Latin Modern Roman}
I can eat glass, it doesn't hurt me. I can eat glass, it doesn't hurt me.
\end{document}
如何统一调整标点符号后的空白?
实际上,PunctuationSpace
设置的是 \fontdimen7
的值。只有两个词中间的 \spacefactor
大于等于 2000 时,才会使用到这个值(即增加设置的这个间距)。
但是,一般情况下,;
和 ,
的 space factor 都是小于 2000 的,所以它们并不会像其它标点一样增加间距。
只要设置它们的 space factor 大于等于 2000 即可。比如:
\sfcode`\;2500 \sfcode`\,2250
如果整篇文章的标点都要增加额外的间距的话,最好是重定义 \nonfrechspacing
:
\DeclareRobustCommand\nonfrenchspacing{\sfcode`\.3000 \sfcode`\?3000
\sfcode`\!3000 \sfcode`\:2750 \sfcode`\;2500 \sfcode`\,2250 }
\documentclass{article}
\usepackage{fontspec}
\DeclareRobustCommand\nonfrenchspacing{\sfcode`\.3000 \sfcode`\?3000
\sfcode`\!3000 \sfcode`\:2750 \sfcode`\;2500 \sfcode`\,2250 }
\nonfrenchspacing
\begin{document}
I can eat glass, it doesn't hurt me. I can eat glass, it doesn't hurt me.
\fontspec[PunctuationSpace=2]{Latin Modern Roman}
I can eat glass, it doesn't hurt me. I can eat glass, it doesn't hurt me.
\fontspec[PunctuationSpace=10]{Latin Modern Roman}
I can eat glass, it doesn't hurt me. I can eat glass, it doesn't hurt me.
\end{document}
要注意的是,如果标点符号前是大写字母,且并非缩写(比如 B.C. 这种),则需正确设置标点符号前的 space factor:
It is NASA. It is NASA\@.
It is nasa. It is nasa.
我也尝试看了
fontspec
的源码,但是难以理解上下文的关联性。感谢大佬的回答!