## LaTeX forum ⇒ Math & Science ⇒ Vertical spacing of multiple equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm

### Vertical spacing of multiple equations

I need some advices or opinions on the way multiple equations should be coded.

For a long time, I was using this way of coding multiple equations (I'm using the book class, in 12pt size):

\begin{align}	A &= B, \\ \nonumber \\	C &= D.\end{align}

or
\begin{align*}	A &= B, \\ \\	C &= D.\end{align*}

Now, I prefer using this way :

\begin{align}	A &= B, \\[18pt]	C &= D.\end{align}

or
\begin{align*}	A &= B, \\[18pt]	C &= D.\end{align*}

Which way is better ? How the vertical spacing **should** be defined, in LaTeX ?
What are the advantages and inconvenients of each ? Or is there a better way of doing this ?

My "old" way (using \\ \\) gives a vertical spacing which feels a bit too wide. The other way (using \\[18pt]) gives an almost identical output (slightly less wide), but feels a bit more regular.

I need opinions on this, since I may convert all my old codes to the one I currently prefer, but it may be a "mistake".

In case a MWE is needed, here's one (the output of both ways of coding the vertical spacement appears to be identical, but that's because the equations are too simple here.) :
\documentclass[12pt,letterpaper]{book}\usepackage[T1]{fontenc}\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{mathtools}\usepackage[left=1.0in,top=1.0in,right=1.0in,bottom=1.0in]{geometry} \begin{document} This way :\begin{align}         A &= B, \\ \nonumber \\         C &= D.\end{align}and :\begin{align*}         A &= B, \\ \\         C &= D.\end{align*}Or this way :\begin{align}         A &= B, \\[18pt]         C &= D.\end{align}and :\begin{align*}         A &= B, \\[18pt]         C &= D.\end{align*} \end{document}
Last edited by Cham on Fri Jul 24, 2015 4:23 pm, edited 1 time in total.

Tags:

Johannes_B
Site Moderator
Posts: 3953
Joined: Thu Nov 01, 2012 4:08 pm
The extra double backslash is leaving out an entire line, with a base font size of 12 pt the overall sep of baselines will be 24pt (2\baselineskip). \\[<length>] will add a given length. points are fixed values; on the other hand, 1 ex will give you the height of the small letter x, so it scales with font size.

\baselineskip is size dependant as well, i would probably use \\[1.5\baselineskip] as 12 times 1.5 coincidentally is 18, the value you found suiting. EDIT: This is wrong, please see below why.

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm
Thanks for the reply, Johannes. You also solved a small "mystery" to me : the meaning of the 1ex command !
Last edited by Cham on Fri Jul 24, 2015 4:35 pm, edited 1 time in total.

Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm
Hmmm, the \\[1.5\baselineskip] gives a larger spacement than \\[18pt] :

\documentclass[12pt,letterpaper]{book}\usepackage[T1]{fontenc}\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{mathtools}\usepackage[left=1.0in,top=1.0in,right=1.0in,bottom=1.0in]{geometry} \begin{document}\noindent\begin{align}         A &= B, \\[1\baselineskip]         C &= D.\end{align}\begin{align}         A &= B, \\[18pt]         C &= D.\end{align}\begin{align}         A &= B, \\[1.5\baselineskip]         C &= D.\end{align} \end{document}

rais
Posts: 179
Joined: Sun Nov 16, 2014 8:51 pm
Cham wrote:Hmmm, the \\[1.5\baselineskip] gives a larger spacement than \\[18pt]

yes, the \baselineskip within normal text of 12 pt is set to 14.5 pt (see the definition of \normalsize in bk12.clo).
Within {align} environment, it's even higher (17.5 pt).
You can let LaTeX tell you, how big it really is with
\the\baselineskip

KR
Rainer

Johannes_B
Site Moderator
Posts: 3953
Joined: Thu Nov 01, 2012 4:08 pm
Thanks for noting my error (left an edit note above). I never noticed the larger spacing in displayed math, but now, thinking about it, it's logical to be larger. There is space needed to fit sums and limits and fractions.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm
So, what vertical separation code you guys are using, when you type multi-equations (align, gather, etc) ? \\ \\, or \\[18pt], or what else ?

Stefan Kottwitz
Posts: 9281
Joined: Mon Mar 10, 2008 9:44 pm
• \\ \\ is bad since this adds logical rows where physical space is intended.

• \\[18pt] is bad since it inserts physical measurement within an otherwise logical structure. It needs to be repeated all the time, can lead to a mistake when forgotten or wrong, so needs additional care. And if you decide to change the space, such as when the font size would be changed or another thing in the layout, you need to find all occurrences to correct each of them.

I adjust \jot once, this is the distance between two consecutive rows in an amsmath multi-line math formula.

• \setlength{\jot}{18pt} if I really need that absolute value

• \setlength{\jot}{3ex} to make it scalable with the font, which is better

• \setlength{\jot}[\baselineskip] (perhaps with a factor) to make it scalable with the line distance, so also with the font height and the line spread.

Alternatively via \addtolength.

Stefan

Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm
Thanks Stefan,

so how do you code an align environment with, say, two equations ?

Stefan Kottwitz
Posts: 9281
Joined: Mon Mar 10, 2008 9:44 pm
Cham wrote:so how do you code an align environment with, say, two equations ?

I end the line with the first equation just by \\.

Stefan