5

Is there a vertical equivalent of \mathclap, i.e. a command that will ,,crush`` part of a formula to height zero, allowing better alignment with other parts of the same formula?

To illustrate what I want to achieve, consider the following (largely made-up) MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \begin{align*}
        A \begin{pmatrix}
            x \\ y \\ z
        \end{pmatrix} 
        & = 
        u \cdot \left( \text{some rather long term} \right) \\
        & = 
        v \cdot \left( \text{another rather long term} \right) \\
        & = 
        w \cdot \left( \text{a third rather long term} \right)
    \end{align*}
\end{document}

which gives

enter image description here

whereas would I'd like to achieve is

enter image description here

(I personally think that's more readable; YMMV, of course).

Is this possible, and if so, how? I've done some superficial research but came up empty-handed.

  • 3
    \smash? amsmath extends it to \smash[b], \smash[t], default is \smash[tb] – daleif Nov 11 at 14:02
8

The vertical equivalent of \mathclap{...} is \smash{...}. \smash is available in both PlainTeX and LaTeX.

If you load the amsmath package, you will also get \smash[b]{...} and \smash[t]{...}. These commands set the depth and height of their arguments to zero. (One could say that they're somewhat similar in function to \mathrlap and \mathllap. But not perfectly equivalent, for sure.)

For the case of your sample code, then, you will want to replace

A \begin{pmatrix} x \\ y \\ z \end{pmatrix}

with

A \smash[b]{\begin{pmatrix} x \\ y \\ z \end{pmatrix}}
  • Perfect! Exactly what I was looking for, thank you. – chsk Nov 11 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.