在单词的字母之间添加空格

在单词的字母之间添加空格

在 xelatex 或 lualatex 中,如何让段落在单词内留出微小的空格作为排版的最后手段来拉伸单词?似乎每个人都只想要大写字母之间固定大小的微小 hspace,但我想要一个像0em plus 0.05em每个单词内一样的空格 - 但我仍然需要连字符才能工作,并且当单词内的拉伸为零时,我希望正常的字距和连字!

在示例中,您会看到,对于第一行未满的水平盒子,空格已经大到可以达到的程度,单词开始出现间隔。在同一段落中,该单词再次出现,间距正常。并且“flesh”中“fl”的连字符也存在。

以下是我需要做的

我以为 TeX 默认就是这么做的!

这是乳胶失败的情况:

\documentclass{article}    
\begin{document}
\rightskip=0.65\linewidth
23\hspace{1ex}And Abraham took Ishmael his son, and all that
were born in his house, and all that were bought with his 
money, every male among the men of Abraham's house; and 
circumcised the flesh of their foreskin in the selfsame day,
as God had said unto him.
\end{document}

在此处输入图片描述

答案1

这只是为了补充 cabohah (+1) 的优秀答案。

使用 xelatex 您还可以使用一些类似的 \usepackage[shrink=20, stretch=30]{microtype}解决方案,同时将这些参数保持在合理的低值(他的影响应该几乎不被注意到,或者最好根本不被注意到)。


姆韦


但要准确回答您的问题(在字母之间添加空格),您还可以为选项设置一些值letterspace,例如,letterspace=150然后输入\textls{Abraham}


姆韦


(为了容易看到效果,故意把 150 这个值夸大了。在这种情况下,确实 letterspace=2足够了)。

答案2

以下适用于 pdfLaTeX 和 LuaLaTeX:

\documentclass{article}
\usepackage[tracking]{microtype}
\begin{document}
\rightskip=0.65\linewidth
\emergencystretch=1pt
23\enspace And Abraham took Ishmael his son, and all that
were born in his house, and all that were bought with his 
money, every male among the men of Abraham's house; and 
circumcised the flesh of their foreskin in the selfsame day,
as God had said unto him.
\end{document}

使用 pdfLaTeX 或 LuaLaTeX

XeLaTeXtracking无法使用此功能。因此,您必须增加该\emergencystretch值:

\documentclass{article}
\usepackage{microtype}
\begin{document}
\rightskip=0.65\linewidth
\emergencystretch=1em
23\enspace And Abraham took Ishmael his son, and all that
were born in his house, and all that were bought with his 
money, every male among the men of Abraham's house; and 
circumcised the flesh of their foreskin in the selfsame day,
as God had said unto him.
\end{document}

xelatex + 紧急拉伸

或者必须使用类似的东西sloppypar

\documentclass{article}
\usepackage{microtype}
\begin{document}
\rightskip=0.65\linewidth
\begin{sloppypar}
23\enspace And Abraham took Ishmael his son, and all that
were born in his house, and all that were bought with his 
money, every male among the men of Abraham's house; and 
circumcised the flesh of their foreskin in the selfsame day,
as God had said unto him.
\end{sloppypar}
\end{document}

xelatex + sloppypar

有关功能和所需引擎的更多信息,请参阅microtype用户手册。您还会发现有关在 XeLaTeX 中使用(替代)fontspec的说明。LetterSpacetracking

相关内容