5

I like to encourage TeX to use fewer lines in a paragraph. Consider the following 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}

A screenshot of the resulting PDF document

Replacing the spaces at the end of a paragraph with non-breaking spaces achieves the desired reduction in line count:

…
will~likely~end~up~asymmetric.

We can make the above strategy symmetric by always taking an element \ldots
\end{document}

A screenshot of the resulting PDF document

However, this solution is too harsh. Specifying a negative penalty at the end of a paragraph makes the intent clearer to the reader and it also gives more leeway to the line-breaking algorithm. However, it also introduces extra unwanted vertical space below the paragraph:

…
will likely end up asymmetric.\penalty-10000

We can make the above strategy symmetric by always taking an element \ldots
\end{document}

A screenshot of the resulting PDF document

I would like to find out what causes this vertical space and remove it.

Witiko
  • 1,216
  • 2
    A marginal notice: microtype might help you, but indirectly. – Oleg Lobachev Mar 15 '18 at 19:50
  • By configuring microtype to stretch and shrink the width of the font beyond the default of 2 %, you can influence it directly as well, even at the level of individual paragraphs. – Witiko Mar 16 '18 at 16:19

1 Answers1

7

Not a negative penalty, but a higher \linepenalty or setting \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}

enter image description here

Note that \looseness is reset to zero at every new paragraph. The {\linepenalty3000\par} trick makes the setting local. I'd prefer the \looseness method. See Which choice of line-breaking parameters gives the minimum number of lines

The \penalty-10000 forces a line break, but the paragraph is not yet finished, so you get a trailing blank line because of the implicit \penalty-10000 issued by `\par.

egreg
  • 1,121,712