16.6.1 \smash

Synopsis:

\smash{subformula}

Typeset subformula as if its height and depth were zero.

In this example the exponential is so tall that without the \smash command LaTeX would separate its line from the line above it, and the uneven line spacing might be unsightly.

To compute the tetration $\smash{2^{2^{2^2}}}$,
evaluate from the top down, as $2^{2^4}=2^{16}=65536$.

(Because of the \smash the printed expression could run into the line above so you may want to wait until the final version of the document to make such adjustments.)

This pictures the effect of \smash by using \fbox to surround the box that LaTeX will put on the line. The \blackbar command makes a bar extending from 10 points below the baseline to 20 points above.

\newcommand{\blackbar}{\rule[-10pt]{5pt}{30pt}}
\fbox{\blackbar}
\fbox{\smash{\blackbar}}

The first box that LaTeX places is 20 points high and 10 points deep. But the second box is treated by LaTeX as having zero height and zero depth, despite that the ink printed on the page still extends well above and below the line.

The \smash command appears often in mathematics to adjust the size of an element that surrounds a subformula. Here the first radical extends below the baseline while the second lies just on the baseline.

\begin{equation}
\sqrt{\sum_{0\leq k< n} f(k)}
\sqrt{\vphantom{\sum}\smash{\sum_{0\leq k< n}} f(k)}
\end{equation}

Note the use of \vphantom to give the \sqrt command an argument with the height of the \sum (see \phantom & \vphantom & \hphantom).

While most often used in mathematics, the \smash command can appear in other contexts. However, it doesn’t change into horizontal mode. So if it starts a paragraph then you should first put a \leavevmode, as in the bottom line below.

Text above.

\smash{smashed, no indent}  % no paragraph indent

\leavevmode\smash{smashed, with indent}  % usual paragraph indent

The package mathtools has operators that provide even finer control over smashing a subformula box.


Unofficial LaTeX2e reference manual