I'm writing a description of how recursive functions are applied within lists using the align
environment from amsmath
in LaTeX. Here's the code:
\begin{align*}
& \reduce (+, 0, & [1, 2, 3, 4]) \\
= & \reduce (+, 0 + 1, & [2, 3, 4]) \\
= & \reduce (+, 0 + 1 + 2, & [3, 4]) \\
= & \reduce (+, 0 + 1 + 2 + 3, & [4]) \\
= & \reduce (+, 0 + 1 + 2 + 3 + 4, & []) \\
= & 0 + 1 + 2 + 3 + 4\\
= & 10
\end{align*}
or my try out to enhance the readability. Inserted \quad
s there:
\begin{align*}
& \reduce (+,\quad 0, & [1, 2, 3, 4]) \\
=& \reduce (+,\quad 0 + 1, & [2, 3, 4]) \\
=& \reduce (+,\quad 0 + 1 + 2, & [3, 4]) \\
=& \reduce (+,\quad 0 + 1 + 2 + 3, & [4]) \\
=& \reduce (+,\quad 0 + 1 + 2 + 3 + 4, & []) \\
=& 0 + 1 + 2 + 3 + 4\\
=& 10
\end{align*}
It just doesn't look nice. Here's a quick picture of the latter:
It is almost both readable and aesthetical, but not quite.
How to make the gap smaller? And any other tips you may have are appreciated!