20

Consider the following code:

\begin{align}
f_1(x) &= \frac{15x}{3} \\
f_2(x) &= 3x + 5 \\
f_3(x) &= 4x + 13
\end{align}

This produces three lines where the first line takes up more vertical space than the others. Is there any way to make all the lines take the same vertical space (meaning effectively all lines take as much vertical space as the largest one)?

1

3 Answers 3

15

I don't know of an automatic way to do this, but in a particular case, you can use \vphantom to effect this.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
f_1(x) &= \frac{15x}{3} \\
f_2(x) &= \vphantom{\frac11}3x + 5 \\
f_3(x) &= \vphantom{\frac11}4x + 13
\end{align}
\end{document}

alt text

1
16

if you do not want it globally changed put the complete formula into {...}

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\savebox\strutbox{$\vphantom{\dfrac11}$}
\begin{align}
  f_1(x) &= \frac{15x}{3} \\
  f_2(x) &= 3x + 5 \\
  f_3(x) &= 4x + 13
\end{align}

\end{document}
5
  • Despite the additional white space below the display, this is definitely most elegant. Commented Jan 17, 2011 at 14:28
  • Beautiful! How exactly does it work?
    – mavzolej
    Commented Nov 20, 2018 at 17:33
  • \vphantom{...} defines box of width zero and height nof its contents. Which is the height of a fraction "1/1". \strutbox is used by align for every row.
    – user2478
    Commented Nov 20, 2018 at 18:38
  • This is very useful, thank you. Would this only affect the following align environment? Or all the way down to the end of the document? Commented Oct 5, 2020 at 10:39
  • 1
    @DaneelOlivaw it's a normal tex local assignment so has the same scope as a font change or \renewcommand etc, the current group or environment (which is document here, but could be any local scope from {} or minipage etc. Commented Oct 10, 2020 at 12:51
5

I can offer a variant of TH's answer that produces a bit less vertical space, but it is adjusted to your particular situation: Only the second line needs a bit of additional depth. The advantage of this more special adjustment is that it doesn't produce additional white space below the display.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Here's some text just to fill the line sufficiently
\begin{align}
f_1(x) &= \frac{15x}{3} \\
f_2(x) &= 3x + 5 \vphantom{\smash[t]{\frac11}} \\
f_3(x) &= 4x + 13
\end{align}
Here's some text just to fill the line sufficiently
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .