语言(n)german
选项巴别塔包提供了与连字符相关的各种简写,例如"-
:“一个明确的连字符,允许在单词的其余部分使用连字符”(手册,第 22 节)。至少其中一些简写对英文文本也很有用 - 例如,输入zoning-facil"-itated
结果会出现以下合法断点(假设英文连字模式):zoning-facil-i-tated
。(注意:由于“zoning”后面有明确的连字符,因此在这种情况下之前的连字"-
被禁用。)
当用作ngerman
主要文档语言并切换到english
文档正文内时,\addto
允许延续语言简写:
\documentclass{article}
\usepackage[english,ngerman]{babel}
\addto\extrasenglish{\languageshorthands{ngerman}}
\begin{document}
\selectlanguage{english}
Adding \textsf{ngerman} language shorthands to \textsf{english}: zoning-facil"-itated.
\end{document}
但是,这不适用于english
主要文档语言(并且ngerman
仍然指定为附加选项):
\documentclass{article}
\usepackage[ngerman,english]{babel}
\addto\extrasenglish{\languageshorthands{ngerman}}
\begin{document}
Adding \textsf{ngerman} language shorthands to \textsf{english}: zoning-facil"-itated.
\end{document}
如何在将其用作主要文档语言的同时添加ngerman
语言简写?english
english
答案1
\documentclass{article}
\usepackage[ngerman,english]{babel}
\useshorthands{"}
\addto\extrasenglish{\languageshorthands{ngerman}}
\begin{document}
\minipage{1cm}\hrulefill
\hspace{0pt}zoning-facilitated
\hspace{0pt}zoning"=facil"-itated
\endminipage
\end{document}
你lualatex
不需要\hspace{0pt}
(LuaTeX 会用连字符连接段落的第一个单词,而 TeX 不会)
答案2
必须定义特定于语言的速记;我只留下了与连字符相关的速记:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\makeatletter
\initiate@active@char{"}
\addto\extrasenglish{\languageshorthands{english}\bbl@activate{"}}
\addto\noextrasenglish{\bbl@deactivate{"}}
\declare@shorthand{english}{"-}{\nobreak\-\bbl@allowhyphens}
\declare@shorthand{english}{"|}{%
\textormath{\penalty\@M\discretionary{-}{}{\kern.03em}%
\allowhyphens}{}}
\declare@shorthand{english}{""}{\hskip\z@skip}
\declare@shorthand{english}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
\declare@shorthand{english}{"=}{\penalty\@M-\hskip\z@skip}
\makeatother
\begin{document}
\hsize=3pt
\hskip0pt zoning-facilitated
\hskip0pt zoning-facil"-itated
\end{document}
导入简写也相当容易ngerman
:
\documentclass[a4paper]{article}
\usepackage[ngerman,english]{babel}
\makeatletter
\initiate@active@char{"}
\addto\extrasenglish{\languageshorthands{ngerman}\bbl@activate{"}}
\addto\noextrasenglish{\bbl@deactivate{"}}
\makeatother
\begin{document}
\hsize=3pt
\hskip0pt zoning-facilitated
\hskip0pt zoning-facil"-itated
\end{document}
当然,ngerman
必须要加载,否则就无法知道简写;因此,第一个方案似乎更好。