如何使用 XeLaTeX 为已连字的单词设置连字的全局设置?

如何使用 XeLaTeX 为已连字的单词设置连字的全局设置?

请考虑下面的 MWE,我想全球Babel使用包(英语中的包)调用已经连字的单词的连字Hyphenat,以获得与使用时相同的效果,<word1>-\hspace{0pt}<word2>如下面的输出所示。

希望这样做可以避免在最后一刻追踪论文中的每个连字符,尤其是在对 200 页的论文进行一些文本编辑之后。我对 的效果非常满意\hspace{0pt},我看不出有什么理由不盲目使用它,还是我遗漏了什么?

MWE 代码

\documentclass{scrartcl} % complied with XeLaTeX
\usepackage[english]{babel}
%\defineshorthand{"-}{\babelhyphen{hard}} % didn't work
\usepackage{fontspec}
\usepackage{libertine}

\begin{document}
In summary, IL-17 can be produced by innate and adaptive cells, but more profoundly from innate sentinel cells of the immune system. 
The nTh17 is a novel subset that is thymic-\hspace{0pt}dependent and shows a distinct developmental pathway from iTh17 cells that are derived from naive T cells.

In summary, IL-17 can be produced by innate and adaptive cells, but more profoundly from innate sentinel cells of the immune system. 
The nTh17 is a novel subset that is thymic"-dependent and shows a distinct developmental pathway from iTh17 cells that are derived from naive T cells.
\end{document}

输出
在此处输入图片描述

答案1

您忘记将简写添加到已启用简写列表中:

\documentclass{scrartcl}
\usepackage[english]{babel}

\usepackage{fontspec}
\usepackage{libertine}

\useshorthands{"}
\defineshorthand[english]{"-}{\babelhyphen{hard}} % didn't work
\addto\extrasenglish{\languageshorthands{english}}

\begin{document}

\makeatletter
\show"

In summary, IL-17 can be produced by innate and adaptive cells, but more profoundly from innate
sentinel cells of the immune system. The nTh17 is a novel subset that is thymic-\hspace{0pt}dependent
and shows a distinct developmental pathway from iTh17 cells that are derived from naive T cells.

In summary, IL-17 can be produced by innate and adaptive cells, but more profoundly from innate
sentinel cells of the immune system. The nTh17 is a novel subset that is thymic"-dependent and shows a
distinct developmental pathway from iTh17 cells that are derived from naive T cells.

\end{document}

在此处输入图片描述

当然你也可以得到

                     胸腺
依赖性

这太可怕了。如果你不害怕复合词的连字符太丑陋,那么速记就很适合你。如果你对排版很仔细,你会花时间分析复合词中哪些连字符是真正必要的。也许可以尝试改变措辞,而不是允许使用连字符。

相关内容