# 47 How do I create a long division equation in LaTeX?

Last update: Jan 16/23

Long division requires a LaTeX extension. To load the extension, use the `\require` command to load the `\enclose` extension that allows you to access MathML elements, including long division `\longdiv`. An extension only needs to be loaded once, then it would be available for the entire book in Pressbooks.

For the first time, write `\require{enclose}5\enclose{longdiv}{25}`. It looks like:

$\require{enclose}5\enclose{longdiv}{25}$

After that, write as `divisor\enclose{longdiv}{dividend}.` Using the same example 20 ÷ 5, write `5\enclose{longdiv}{20}`. It looks like:

$5\enclose{longdiv}{20}$

If you need to include the quotient and the process of long division, combine with the `\begin{array}` or `\begin{align}` command (for more information, see How do I create an array using LaTeX?)

$\begin{array}{r}\text{quotient}\\ \text{divisor}\enclose{longdiv}{\text{dividend}}\end{array}$

The process of 20 ÷ 5 = 4 with the remainder of 0 would be written as `\begin{array}{r}4\\ 5\enclose{longdiv}{20}\\20\\ \hline 0\end{array}`.

$\begin{array}{r}4\\ 5\enclose{longdiv}{20}\\-20\,\\ \hline0\,\end{array}$

Here is an example of a long division question solved that has a remainder:

$\begin{array}{l}\hspace{0.7cm}32\text{ R}3\\8 \enclose{longdiv}{259}\\\hspace{0.1cm}-24\\\hline\hspace{0.8cm}19\\\hspace{0.4cm}-16\\\hline\hspace{1cm}3\end{array}$