
當試圖防止長形式和短形式之間的換行時,我很難使用使用者定義的連字規則在長首字母縮略詞中正確連字。
\documentclass{article}
\usepackage{showframe}
\hyphenation{mi-cros-co-py}
\begin{document}
\paragraph{Long Text} This is some text abcdefgh Acronym Containing Microscopy~(ACM).
\paragraph{Longer Text} This is some text abcdefgh Acronym Containing Microscopy~(ACM).
\paragraph{Even Longer Text} This is some text abcdefgh Acronym Containing Microscopy~(ACM).
\paragraph{Another try} Let's try manual hyphenation.
\paragraph{Long Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py~(ACM).
\paragraph{Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py~(ACM).
\paragraph{Even Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py~(ACM).
\paragraph{Another try} Let's also skip the non-breaking space.
\paragraph{Long Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py (ACM).
\paragraph{Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py (ACM).
\paragraph{Even Longer Text} This is some text abcdefgh Acronym Containing Mi\-cros\-co\-py (ACM).
\end{document}
從 MWP 可以看出,在某些情況下,即使沒有不間斷空格和手動連字,排版也會導致水平盒過滿。在序言中設定\hyphenpenalty=0
也沒有幫助,結果相同。
我在這裡缺少什麼?
嚴格來說,我在實際文件中使用該glossaries
包,並調整了首字母縮略詞格式,包括縮寫形式之前的不間斷空格:\renewcommand{\acrfullformat}[2]{#1~(#2)}
我將這些部分替換為 MWP 的純文本,因為結果是相同的。以防萬一有人知道glossaries
解決此問題的解決方案。
答案1
假設您不想在其中中斷,(ACM)
那麼添加更多連字符(或減少連字符的懲罰)將無濟於事。您需要讓空白區域伸展,以便在斷線後將線條填滿。
\begin{document}\setlength\emergencystretch{1.5em}
不會產生過滿的線條(儘管產生的線條有點稀疏)