我喜欢鼓励 TeX 在段落中使用更少的行。考虑以下 MWE:
\documentclass{article}
\usepackage{amsmath,microtype}
\begin{document}
If we do not require that $\mathbf S$ is metric and we only wish to compute the
inner product, then there are several strategies for making no column of S
contain more than $C$ non-zero elements. Starting out with an empty matrix,
and taking only the $C-1$ largest elements and the diagonal element from every
column of $\mathbf S$ is the simplest strategy. However, the resulting matrix
will likely end up asymmetric.
We can make the above strategy symmetric by always taking an element \ldots
\end{document}
将段落末尾的空格替换为不间断空格可达到减少行数的目的:
…
will~likely~end~up~asymmetric.
We can make the above strategy symmetric by always taking an element \ldots
\end{document}
但是,这种解决方案太过苛刻。在段落末尾指定负惩罚可以让读者更清楚地了解意图,也为换行算法提供了更多回旋余地。但是,它还会在段落下方引入额外的不必要的垂直空间:
…
will likely end up asymmetric.\penalty-10000
We can make the above strategy symmetric by always taking an element \ldots
\end{document}
我想找出造成这个垂直空间的原因并将其消除。
答案1
不是负面惩罚,而是更高\linepenalty
或设定\looseness=-1
\documentclass{article}
\usepackage{amsmath,microtype}
\begin{document}
If we do not require that $\mathbf S$ is metric and we only wish to compute the
inner product, then there are several strategies for making no column of S
contain more than $C$ non-zero elements. Starting out with an empty matrix,
and taking only the $C-1$ largest elements and the diagonal element from every
column of $\mathbf S$ is the simplest strategy. However, the resulting matrix
will likely end up asymmetric.
\looseness=-1
If we do not require that $\mathbf S$ is metric and we only wish to compute the
inner product, then there are several strategies for making no column of S
contain more than $C$ non-zero elements. Starting out with an empty matrix,
and taking only the $C-1$ largest elements and the diagonal element from every
column of $\mathbf S$ is the simplest strategy. However, the resulting matrix
will likely end up asymmetric.
If we do not require that $\mathbf S$ is metric and we only wish to compute the
inner product, then there are several strategies for making no column of S
contain more than $C$ non-zero elements. Starting out with an empty matrix,
and taking only the $C-1$ largest elements and the diagonal element from every
column of $\mathbf S$ is the simplest strategy. However, the resulting matrix
will likely end up asymmetric.{\linepenalty3000\par}
\end{document}
请注意,\looseness
每一段新内容都会重置为零。这个{\linepenalty3000\par}
技巧使设置成为本地设置。我更喜欢这种\looseness
方法。参见哪种换行参数的选择可以得到最少的行数
强制\penalty-10000
换行,但段落尚未完成,因此由于\penalty-10000
`\par 隐式发出,您会得到一个尾随空白行。