如何正确调用 babel、美式英语例外列表和连字符规则?

如何正确调用 babel、美式英语例外列表和连字符规则?

假设我们关心多语言文档中几个英语单词的正确连字,而该文档的主要语言不是英语。这几个单词恰好出现在 中ushyphex.tex;如果不加载此连字词典,即使在 的范围内,连字也会是错误的或不完整的\foreignlanguage{USenglish}{…}。如何正确加载美国英语的例外词典,以及相对于其他语言相关内容的顺序如何加载?以下是我们现在要做的事情:

\documentclass[USenglish,british,ngerman]{article}% make languages class options so that certain other packages (e.g., cleveref) can pick them up properly.
\usepackage[T1]{fontenc}
\usepackage[USenglish,british,main=ngerman]{babel}% say which language is the main one.
\babelprovide[hyphenrules=ngerman-x-latest]{ngerman}% load the most recent hyphenation patterns for the main language. Anything comparable for US English? If not:
\selectlanguage{USenglish}
\input{ushyphex}
\selectlanguage{ngerman}
\usepackage[ngerman,noabbrev]{cleveref}% cf. § 10 in the manual of cleveref
\begin{document}
Beliebiger deutscher Text \textellipsis% This is an arbitrary main-language text simply for the purpose of demonstrating that the main document language is NOT English.
\showhyphens{\foreignlanguage{USenglish}{algebraically}}% a random exception not covered by current babel, e.g., “process”, “atherosclerosis”, …
\end{document}

正如预期的那样,我们进入了al-ge-bra-i-cal-ly控制台。加载方式ushyphex.tex夹在中间是否\selectlanguage{USenglish}…\selectlanguage{ngerman}正确™?或者我们最好说{\selectlanguage{USenglish}\input{ushyphenex}}或类似的东西?或者是否有任何特定于 babel 的等效项ushyphex.tex?例如,我最好调用包hyph-utf8hyphenex代替?如果没有额外的针对英语的 babel 特定例外列表:加载的位置是否ushyphex.tex正确™?

相关内容