我正在尝试让 LaTeX 允许在省略号后换行。问题是,当我\allowbreak
在 之后输入时\ldots
,省略号和下一个直接字符之间的字距会混乱。在下面的 MWE 中,我展示了省略号和下一个直接字符之间的多对字距,省略号后有和没有换行。如您所见,添加\allowbreak
会导致字母间距不对齐。我想自动允许在省略号后换行而不影响字距。
编辑:我刚刚测试过的以下字体的字距也乱了:Verdana Pro、Noto Serif、Roboto Serif、Source Serif Pro
\documentclass{article}
\raggedright
\usepackage{fontspec}
\setmainfont{Source Serif 4}[%Available for free on Google Fonts.
Kerning=On%
]
\begin{document}
text\ldots{}apple\\
text\ldots{}\allowbreak{}apple\\
text\ldots{}candy\\
text\ldots{}\allowbreak{}candy\\
text\ldots{}banana\\
text\ldots{}\allowbreak{}banana\\
text\ldots{}doughnut\\
text\ldots{}\allowbreak{}doughnut\\
text\ldots{}eggplant\\
text\ldots{}\allowbreak{}eggplant\\
text\ldots{}fish\\
text\ldots{}\allowbreak{}fish\\
text\ldots{}grape\\
text\ldots{}\allowbreak{}grape\\
text\ldots{}henry\\
text\ldots{}\allowbreak{}henry\\
text\ldots{}salmon\\
text\ldots{}\allowbreak{}salmon\\
text\ldots{}tenth\\
text\ldots{}\allowbreak{}tenth\\
text\ldots{}ultra\\
text\ldots{}\allowbreak{}ultra\\
text\ldots{}violet\\
text\ldots{}\allowbreak{}violet\\
text\ldots{}water\\
text\ldots{}\allowbreak{}water\\
text\ldots{}xbox\\
text\ldots{}\allowbreak{}xbox\\
text\ldots{}yellow\\
text\ldots{}\allowbreak{}yellow\\
text\ldots{}zodiac\\
text\ldots{}\allowbreak{}zodiac\\
\end{document}
答案1
我认为我从来没有在没有空格的单词前使用省略号,但如果你真的有,你可以尝试 \discretionary (我使用 lualatex 编译):
\documentclass{article}
\raggedright
\usepackage{fontspec}
\setmainfont{Noto Serif}[% replaced
Kerning=On%
]
\begin{document}
text\ldots{}yellow\\
text\ldots{}\allowbreak{}yellow\\
text\ldots{}\discretionary{}{}{}yellow
\bigskip
\parbox{2mm}
{%
text\ldots{}yellow\\
text\ldots{}\allowbreak{}yellow\\
text\ldots{}\discretionary{}{}{}yellow
}
\end{document}