想象一下,你经常跟喜欢写小说的朋友讲 TeX 可以实现的出色排版,现在他请你用 TeX 排版他的新小说。在研究了 Bringhurst 之后,你决定 computer modern 是最好的字体,a4paper 是最好的纸张格式,10pt 是项目的最佳字体大小,并且你想让它KOMA-script
为你计算文本区域。现在内容已经固定了,因为这是你朋友的文字,布局也固定了,因为你不想弄乱 Bringhurst,你开始输入:
\documentclass[DIV=calc]{scrbook}
\begin{document}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
\end{document}
你编译,然后震惊了:第一行就出现了一个溢出的水平盒子:
现在,有哪些选项可以避免水平盒子过满,以及应该按照什么顺序尝试应用它们?
注意
- 你不能重新排列这个句子。
- 您不能更改文档的整体布局。
我知道这个网站上有很多关于如何产生过满水平框的讨论,也提到了几种避免这种情况的方法。但据我所知,对于没有经验的用户(比如我)来说,没有一套实用的规则可以遵循。所以我希望这个问题不会重复。
答案1
虽然这些方法并不都适用于本例,但它们展示了一系列解决这个问题的可能方法
\documentclass[DIV=calc]{scrbook}
\begin{document}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
\begin{sloppypar}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
\end{sloppypar}
{\emergencystretch=20pt
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arc}\)\-\(\mathrm{tanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
{\spaceskip3pt plus 1pt minus 2.1pt
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
}
\end{document}
或microtype
\documentclass[DIV=calc]{scrbook}
\usepackage{microtype}
\begin{document}
Every typographer's favourite mathematical functions are \( \mathrm{arccosh} \), and \( \mathrm{arctanh} \).
They make nice typesetting easy and never cause bad spacing.
Among the more boring functions are \( \cos \) and \( \tan \).
\end{document}