Latex aligning equations

latex equation align

Daily tip of new latex skills.

I was search for ways to align multiple parts of an equation, and found this post on stackexchange.

The align environment is the vanilla way to align equations, and the & symbol is used to specify the point of alignment.

1
2
3
4
\begin{align}
a &= b + c \\
&= d + e
\end{align}

$$
\begin{align}
a &= b + c\\
&= d + e
\end{align}
$$

To specify more than one point of alignment, use the alignat environment. The first argument is the number of points of alignment, and the second argument is the number of columns in the equation.

1
2
3
4
5
6
\begin{alignat*}{3}
& m \quad && \text{módulo} \quad && m>0\\
& a \quad && \text{multiplicador} \quad && 0<a<m\\
& c \quad && \text{constante aditiva} \quad && 0\leq c<m\\
& x_0 \quad && \text{valor inicial} \quad && 0\leq x_0 <m
\end{alignat*}

latex.png

Additionally, there’s a discussion of what’s the difference between & and && in this thread, feel free to checkout this for more information!

What does a double ampersand (&&) mean in LaTeX?

Thanks for reading, if you have any questions/suggestions, please leave a comment below.

Author

Charlie Cheng-Jie Ji

Posted on

2023-04-30

Updated on

2023-06-10

Licensed under

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×