2

Can I make a line in a multi-line math block have a minimum line height?

For example,

\begin{align*}
  x &= 1 \\
  y &= 2
\end{align*}

renders as

x = 1, new line, y = 2

but I want the second line to have more space "reserved", kind of like this (I've drawn in a red spacer bar to visualize):

x = 1, new line, y = 2, but y = 2 has more vertical space around it, indicated by a red spacer bar
New contributor
Jo Liss is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

2 Answers 2

4

\jot will helps you:

\documentclass{book}
\usepackage{mathtools}
\usepackage{lipsum}
\setlength{\jot}{24pt}
\begin{document}

\lipsum
\begin{align}
a+b=c\\
x=y=z
\end{align}
\end{document}

enter image description here

3
  • I think this increases the distance (leading) between any two lines of math. But my question is about setting a minimum height, so that only the spacing around shallow (low-height) lines is increased. It's an excellent pointer though -- I didn't know about \jot -- so please definitely leave your answer up. Commented yesterday
  • 1
    \jot isn't a mathtools thing, it's from amsmath. But mathtools dies provide the env spreadlines to change jot locally. Just mentioning since some users cannot distinguish the two packages and complains that mathtools has a problem when the problem is in ansmath Commented 21 hours ago
  • 1
    @daleif Understood, and will take care in future Commented 11 hours ago
4

Using \rule

Use a zero-width \rule as a "strut" at the start of the second line:

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

\begin{align*}
  x &= 1 \\
  \rule[-1.3\baselineskip]{0pt}{3\baselineskip} y &= 2
\end{align*}

\end{document}

It looks like this:

x = 1, new line, y = 2; y = 2 has lots of vertical space around it

The syntax of \rule is \rule[raise]{width}{height}.

The way I arrived at the -1.3\baselineskip and 3\baselineskip values is by checking the definition for a \strut, which is \rule[-0.3\baselineskip]{0pt}{\baselineskip}, and subtracting 1\baselineskip from the raise and adding twice that to the height.

We can visualize the effect of the rule by temporarily setting its width to 1pt:

x = 1, new line, [a vertical bar taking up vertical space] y = 2

Using \vphantom

If instead of setting a height value, you want to reserve the amount of space that some specific formula would take, you can use \vphantom instead of \rule. The \vphantom macro creates a zero-width box with as much height as its contents.

For example, this code reserves as much space as a summation sign would take:

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

\begin{align*}
  x &= 1 \\
  \vphantom{\sum_0^x} y &= 2
\end{align*}

\end{document}
New contributor
Jo Liss is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • Thanks for your first contribution at TeX.SE. Note that it's usually better to provide a fully compilable code with the \documentclass and all packages used. Commented yesterday

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.