Splitting an equation over multiple lines in LaTeX is a common requirement for dealing with long mathematical expressions.

There are several environments you can use. Among them, the most flexible and widely used are `multline`

and `split`

environments, from the `amsmath`

package.

## Break points and alignment points for split equation

Before jumping directly to main point, we will understand the importance of two concepts.

### Significance of `\\`

and `\\[length]`

The double backslash `\\`

and its variant `\\[length]`

are used to manage line breaks and vertical spacing in various environments.

And,`[length]`

argument specifies how much extra space is added.

### Significance of & symbol for creating alignment points

To split an equation over two or more lines in LaTeX and ensure that the lines are aligned at a specific point.

The `&`

symbol plays a crucial role in this environment, indicating the alignment point for each line of equation.

## Multline environment without align

Breaking a long equation into multiple lines in LaTeX is efficiently handled by `multline`

environment, provided by the amsmath package.

Alignment of the Breaking equation is not possible with this environment.

```
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[top=1cm,buttom=1cm]{geometry} % for margin
\begin{document}
\section*{Taylor Expansion}
Here, the Taylor series expansion is broken into two lines, showcasing how to handle series expansions in multi line format.
\begin{multline}
e^{\sin x} = 1 + \sin x + \frac{\sin^2 x}{2!} + \frac{\sin^3 x}{3!} +
\frac{\sin^4 x}{4!} + \frac{\sin^5 x}{5!} + \\ \frac{\sin^6 x}{6!} + \frac{\sin^7 x}{7!} + \frac{\sin^8 x}{8!} +\frac{\sin^9 x}{9!}\cdots
\end{multline}
\section*{Long integral}
This example shows a long integral expression broken into two lines. The integral and its limits are on the first line, and the series expansion follows on the second.
\begin{multline}
\int_0^\infty e^{-x^2} dx = 1 + 2x - 3x^3 + 4x^4 - 5x^5 + 6x^6 - \\ 7x^7 + 8x^8 -9x^9 +10x^{10}-11x^{11}+\cdots
\end{multline}
\section*{Equation with Functions}
Here, a function consisting of various trigonometric functions is broken into two lines for clarity.
\begin{multline}
f(x) = \sin(x) + \cos(x) + \tan(x) + \cot(x) + \\
\sec(x) + \csc(x) + \arcsin(x) + \arccos(x) + \arctan(x)
\end{multline}
\section*{Derivative of a Trigonometric Function}
This example demonstrates the derivative of a combination of trigonometric functions, neatly divided into two lines.
\begin{multline}
\frac{d}{dx} \left( \sin(x^2) + \cos^2(x) - \tan^{-1}(x) +\ln(\sin\,x)\right) = \\
2x \cos(x^2) - 2\sin(x)\cos(x) - \frac{1}{1+x^2} + \frac{\cos x}{\sin x}
\end{multline}
This equation includes a variety of complex calculus elements.
\begin{multline}
\int_{0}^{\infty} \left[ \frac{\sin(x)}{x} - e^{-x^2} \right] dx = \lim_{y \to 0} \left( \frac{1}{y} \int_{0}^{y} \log(1 + x^2) dx \right) - \\
\sum_{n=1}^{\infty} \frac{(-1)^n}{n^3} + \int_{-\pi}^{\pi} e^{x \cos \theta} \cos(x \sin \theta) d\theta + \\
\frac{d^2}{dx^2} \left( \frac{x^4 - 6x^2 + 8x - 3}{x^2 + 1} \right) -\iint_{D} e^{-(x^2 + y^2)} \, dx \, dy
\end{multline}
\end{document}
```

**Output :**

And using `\\`

symbol to indicate the end of current line and the start of next line. And number equation will return with the last line.

## Use split environment inside equation environment

The `equation`

environment returns an automatic number equation. When you use `split`

environment inside it, the entire block of equations is treated as one single entity, receiving one equation number.

And `split`

environment allows you to align the split parts of equation at any desired place. Which is fixed by `&`

symbol.

```
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[margin=1.5cm]{geometry}
\begin{document}
\section*{Long Integral Equation}
A long integral expression is broken into two lines, with the continuation indented for clarity.
\begin{equation}
\begin{split}
\int_0^\infty e^{-x^2} dx = & 1 + 2x - 3x^3 + 4x^4 - \\
& 5x^5 + 6x^6 - 7x^7 + \cdots
\end{split}
\end{equation}
\section*{Equation with Functions and Multiple Alignments}
The function is split into three lines, each part aligned at the equal sign for consistency.
\begin{equation}
\begin{split}
f(x) = & \sin(x) + \cos(x) + \tan(x) + \\[5pt]
& \cot(x) + \sec(x) + \csc(x) + \\[5pt]
& \arcsin(x) + \arccos(x) + \arctan(x)
\end{split}
\end{equation}
\section*{Summation and Product}
This complex equation combines summation and product symbols, breaking down the summation into its components and then showing its relationship to a product.
\begin{equation}
\begin{split}
S_n = & \sum_{i=1}^{n} \left( a_i + b_i \right) \\
= & a_1 + b_1 + a_2 + b_2 + a_3 + b_3 + \cdots + \\
& a_{n-1} + b_{n-1} + a_n + b_n \\
= & \prod_{j=1}^{n} c_j + \sum_{k=1}^{n} d_k
\end{split}
\end{equation}
\section*{Nested Fractions and Functions}
This equation features nested fractions and trigonometric functions, carefully broken into two lines for clarity.
\begin{equation}
\begin{split}
f(x) = \frac{1}{2} \left[ \frac{3x^2 - 2x + 1}{x^3 - x + 4} + \right. & \\
& \left. \frac{\sin(x) - \cos(x)}{\sqrt{x^2 + 1}} \right]
\end{split}
\end{equation}
\section*{Integral with Limits and Series Expansion}
This equation shows an integral with its limits and its corresponding series expansion, broken into two lines for detailed explanation.
\begin{equation}
\begin{split}
\int_{a}^{b} e^{x^2} dx = & \left. \frac{e^{x^2}}{2x} \right|_a^b - \int_{a}^{b} x e^{x^2} dx \\[5pt]
= & \sum_{n=0}^{\infty} \frac{(b^{2n+1} - a^{2n+1})}{n!(2n+1)}
\end{split}
\end{equation}
\end{document}
```

**Output :**

## Auto break equation by breqn package

The `dmath`

environment from `breqn`

package in LaTeX is designed to automatically break long equations into multiple lines at appropriate places. This package takes care of **line breaks** and **alignment** automatically.

Enclose your long equation within `\begin{dmath}`

and `\end{dmath}`

.

```
\documentclass[11pt]{article}
\usepackage{breqn,lipsum}
\usepackage[top=1.5cm]{geometry}
\begin{document}
\section*{Without space}
\lipsum[5][1-4]
\begin{dmath}
e^x = 1 + (x+1) + \frac{x^2 + 2}{2!} + \frac{x^3+3}{3!} + \frac{x^4+4}{4!} + \frac{x^5+5}{5!} + \frac{x^6+6}{6!} + \frac{x^7+7}{7!} + \frac{x^8+8}{8!} + \frac{x^9+9}{9!} + \frac{x^{10}+10}{10!}\cdots
\end{dmath}
\section*{With space}
\lipsum[4][1-4]
\begin{dmath}[spread=10pt]
e^x = 1 + (x+1) + \frac{x^2 + 2}{2!} + \frac{x^3+3}{3!} + \frac{x^4+4}{4!} + \frac{x^5+5}{5!} + \frac{x^6+6}{6!} + \frac{x^7+7}{7!} + \frac{x^8+8}{8!} + \frac{x^9+9}{9!} + \frac{x^{10}+10}{10!}\cdots
\end{dmath}
\lipsum[3][1-4]
\begin{dmath}[spread=5pt]
\sin(x) + \cos(x^2) + \tan(x^3) + \cot(x^4) + \sec(x^5) + \csc(x^6) + \arcsin(x^7) + \arccos(x^8) + \arctan(x^9)
\end{dmath}
\lipsum[2][1-3]
\begin{dmath}[spread=8pt]
\ln(1+x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + \frac{x^5}{5} - \frac{x^6}{6} + \frac{x^7}{7} - \frac{x^8}{8} + \frac{x^9}{9} - \frac{x^{10}}{10} + \frac{x^{11}}{11} - \frac{x^{12}}{12} + \frac{x^{13}}{13} - \frac{x^{14}}{14} \cdots
\end{dmath}
\lipsum[8][1-4]
\begin{dmath}
\lim_{x \to 0} \left( \frac{e^{x} - e^{-x}}{x} + \frac{\tan(x)}{x^2} - \frac{\arcsin(x)}{x^3} + \frac{\sqrt[3]{x^4 + 1} - 1}{x} + \frac{\sin 2x}{x} + \frac{\tan 2x}{x} + \frac{\sin 3x}{x} + \frac{\tan 3x}{x} \right )
\end{dmath}
\end{document}
```

**Output :**

In this case, the process of adding vertical space is completely different. This package contains a per-build `[spread=length]`

option. and can set the length in `length`

argument.

## Use align environment

With the `align`

environment you can break long equations, but the align environment will provide numbered equations for each line.

For a long equation, there should be a number equation. So, it doesn’t matter how many parts are divided.

For this, the `nonumber`

command is used to control the number equation.

```
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[top=1cm]{geometry}
\begin{document}
\section*{Without nonumber command(not best method)}
Here, the derivative of a complex function is calculated. The equation is broken at logical points, with each term of the derivative aligned on separate lines.
\begin{align}
\frac{d}{dx} \left( x^4 \sin(x^2) - \frac{1}{x^2 + 1} + \ln(x) \right) = \; & 4x^3 \sin(x^2) + 2x^5 \cos(x^2) + \\ & \frac{2x}{(x^2 + 1)^2} + \frac{1}{x}
\end{align}
\section*{With nonumber command}
Here, the derivative of a complex function is calculated. The equation is broken at logical points, with each term of the derivative aligned on separate lines.
\begin{align}
\frac{d}{dx} \left( x^4 \sin(x^2) - \frac{1}{x^2 + 1} + \ln(x) \right) = \; & 4x^3 \sin(x^2) + 2x^5 \cos(x^2) +\nonumber \\ & \frac{2x}{(x^2 + 1)^2} + \frac{1}{x}
\end{align}
\section*{Multivariable Integral}
This example demonstrates a multivariable integral over a domain DD. The integral is split into two parts, each computed over different intervals,
\begin{align}
\int\int_D (x^2 + y^2) \,dx\,dy = & \int_0^1 \int_0^{\sqrt{1-y^2}} (x^2 + y^2) \,dx\,dy \,+ \nonumber \\[4pt]
& \int_1^2 \int_0^{\sqrt{4-y^2}} (x^2 + y^2) \,dx\,dy
\end{align}
\section*{Advanced Derivative with Trigonometric Functions}
Here, a derivative of a function involving both polynomial and trigonometric terms.
\begin{align}
f(x) = & \sin(x) + \cos(x) + \tan(x) + \nonumber \\
& \sec(x) + \csc(x) + \arcsin(x) + \arccos(x) + \arctan(x)
\end{align}
\begin{align}
\frac{d}{dx} \left( x^3 \cos(x^2) + \frac{\tan(x)}{x} \right) &= 3x^2\cos(x^2) - 2x^4\sin(x^2) + \nonumber \\ &\quad \frac{\sec^2(x)}{x} - \frac{\tan(x)}{x^2}
\end{align}
\end{document}
```

**Output :**

## Aligned with equation environment

Our last method is `aligned`

, which we will use within the `equation`

environment. `aligned`

environment is completely similar to `split`

environment.

And, you can maintain the alignment and spacing nicely. Look at the code below.

```
\documentclass[11pt]{article}
\usepackage{amsmath,lipsum}
\usepackage[margin=1.5cm]{geometry}
\begin{document}
\begin{equation}
\begin{aligned}
\ln(1+x) = \, & x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + \frac{x^5}{5} - \frac{x^6}{6} + \frac{x^7}{7} - \frac{x^8}{8} +\\[5pt] & \frac{x^9}{9} - \frac{x^{10}}{10} + \frac{x^{11}}{11} - \frac{x^{12}}{12} + \frac{x^{13}}{13} - \frac{x^{14}}{14} \cdots
\end{aligned}
\end{equation}
\lipsum[4][3-6]
\begin{equation}
\begin{aligned}
f(x) = & \sin(x) + \cos(x) + \tan(x) + \sec(x) + \\
& \csc(x) + \arcsin(x) + \arccos(x) + \arctan(x)
\end{aligned}
\end{equation}
\lipsum[3][3-6]
\begin{equation}
\begin{aligned}
f(x) = e^x \sin(x) + & e^{-x} \cos(x) - \tan^2(x) + \\
& \sqrt{x} \ln(x) - \arctan(x) + \frac{1}{1 + x^2}
\end{aligned}
\end{equation}
\lipsum[7][3-8]
\begin{equation}
\begin{aligned}
f(x) = \frac{1}{2} \left[ \frac{3x^2 - 2x + 1}{x^3 - x + 4} + \right. & \\
& \left. \frac{\sin(x) - \cos(x)}{\sqrt{x^2 + 1}} \right]
\end{aligned}
\end{equation}
\end{document}
```

**Output :**

## Best practice

**Break point:** Break equations at natural points, like plus signs, minus signs, or equal signs. Avoid breaking an equation in the middle of a complex term or function.

**Align point:** Use `&`

to align the equations at the desired point. It’s typically used before an equal sign or an operation sign.

**Vertical space:** Where vertical space is required, vertical space needs to be provided. As a result, mathematical documents look more beautiful.

## Conclusion

As many methods as possible, all methods or environments have solved this problem. `Split`

environment is best if you want alignment.

And if you don’t have the requirement of alignment then you can use `multline`

environment or **auto breaking method.**