Align equation to left globally or locally in LaTeX
In this tutorial, I will show you how to align the equation on the left side globally or locally in LaYeX.
Align the equation to the left side globally
To globally left-align all equations in your document, utilize the fleqn
option provided by the amsmath
package. This setting ensures that equations are displayed with alignment to the left margin of the page. This fleqn
option works equation, align, or similar environment.
You can use this fleqn
option with the \documentclass
or with the amsmath
package.
\documentclass[fleqn]{article}
or use \usepackage[fleqn]{amsmath}
\documentclass[fleqn]{article} \usepackage{amsmath} \begin{document} \begin{center} \underline{Align equations to the left side globally} \end{center} Write equation using: \verb|\begin{align}| \begin{align} a + b &= c\\ x + y &= z\\ m + n &= f \end{align} Write without numbers equation using: \verb|\begin{align*}| \begin{align*} a + b &= c\\ x + y &= z\\ m + n &= f \end{align*} Write equation using: \verb|\begin{aligned}| \[\begin{aligned} a + b &= c\\ x + y &= z\\ m + n &= f \end{aligned}\] Write equation using: \verb|\begin{aligned}| inside \verb|\begin{equation}| \begin{equation} \begin{aligned} x &= a + 3^2 + (2 \times 2) \\ &= a + 9 + 4 \\ &= a + 13 \end{aligned} \end{equation} Write equation using: \verb|\begin{split}| inside \verb|\begin{equation}| \begin{equation} \begin{split} x &= a + 3^2 + (2 \times 2) \\ &= a + 9 + 4 \\ &= a + 13 \end{split} \end{equation} Write equation using: \verb|\begin{gather}| \begin{gather} a + b = c\\ x + y = z\\ m + n = f \end{gather} Write without numbers equation using: \verb|\begin{gather*}| \begin{gather*} a + b = c\\ x + y = z\\ m + n = f \end{gather*} \end{document}
Output:
Align the equation on the left locally
To left-align a specific block of equations, use the flalign
environment from the amsmath
package. Append &
or &&
at the end of each line. The flalign
environment automatically assigns equation numbers to each line, but if you prefer unnumbered equations, utilize the flalign*
environment.
For equations without numbers, apply the \nomumber
command at the end of each line. Alternatively, you can use this command on all lines except one to group equations and assign a single equation number.
See the example below to understand better.
\documentclass{article} \usepackage{amsmath} \begin{document} \begin{center} \underline{Align equations to the left side locally} \end{center} Write a centered equation using: \verb|\begin{aligned}| inside \verb|\begin{equation}| \begin{equation} \begin{aligned} x &= a + 3^2 + (2 \times 2) \\ &= a + 9 + 4 \\ &= a + 13 \end{aligned} \end{equation} Write numbered equation, which is aligned on the left side using:\verb|\begin{flalign}| \begin{flalign} x &= a + 3^2 + (2 \times 2)& \\ &= a + 9 + 4& \\ &= a + 13 \end{flalign} Write no numbered equation, which is aligned on the left side using:\verb|\begin{flalign*}| \begin{flalign*} x &= a + 3^2 + (2 \times 2)&& \\ &= a + 9 + 4&& \\ &= a + 13 \end{flalign*} Write equation with one eq. no., which is aligned on the left side \begin{flalign} x &= a + 3^2 + (2 \times 2)&& \\ \nonumber &= a + 9 + 4&& \\ \nonumber &= a + 13&& \end{flalign} \end{document}
Output:
Leave a Reply