# Better way to display long division?

I'm currently in the process of trying to create a worksheet for my students with long division problems for them to practice. Unfortunately, the best I've been able to come up with so far in terms of displaying long division like how they write it is:

Which could work if need be, but I thought I'd see if anyone has tooled around with this and come up with something better. To create that, all I did was type:

$\overline{)12345}$


Any suggestions for ways of making that better (so it looks more like what'd you see when using \longdiv) would be awesome.

• I'm not somewhere I can check, but if I remember correctly, kicking up the parenthesis by one size improves the appearance. a solution was published in tugboat years ago. Sep 2, 2013 at 0:07
• To add to Barbara's comment: here is what I did: \newcommand[2]{\longdiv}{#1\ \overline{\smash{\Big)}\ #2}} and it closed the gap. Sep 2, 2014 at 21:24
• Using \overlinegenerally does not produce pretty results with shorter characters. This applies to many of the answers given below. Jan 6, 2017 at 21:27

You can give a definition of a command inspired by the one used in longdiv.sty; something along these lines:

\documentclass{article}

\newcommand\Mydiv[2]{%
$\strut#1$\kern.25em\smash{\raise.3ex\hbox{$\big)$}}$\mkern-8mu \overline{\enspace\strut#2}$}

\begin{document}

\end{document}


• @Gonzalo_Medina Thanks for the answer, how would I write numbers on top of the line? Dec 30, 2014 at 16:50
\end{document}


• It would be nice if you make your example compilable, so people can just copy/paste to try it. May 20, 2019 at 7:30
• Good call. All fixed. May 20, 2019 at 7:42
• Thanks :-) Note that \scalebox is provided by graphicx, so you don't need all of TikZ to use it. I edited it for you. May 20, 2019 at 7:44
• Yes, I didn't know why it needed tikz just that it worked. Thanks. May 20, 2019 at 7:44

Here is a way to display 2011/3:

\begin{align*}
&\text{ }\text{ }\text{ }670\\
3 &\overline{\big)2011}\\
&\underline{\text{ }18}\\
&\text{ }\text{ }\text{ }21\\
&\text{ }\text{ }\underline{\text{ }21}\\
&\text{ }\text{ }\text{ }\text{ }\text{ }\text{ }1
\end{align*}


Tweak the spacing on different long divisions. As barbara beeton commented on the question, scaling up the size of the parentheses does help.

What about polynom package. If you write

\longdiv{12345}{13}


You obtain