# Vertical addition and multiplication and long division

Is there in existence packages that recreate the following environments:

Some of the above have been discussed like in the How to present a vertical multiplication but what I am interested in is if there is a way to recreate the addition and division.

-
Are you also interested in displaying the "result" of the operation, as in the linked post? Or just the display of the "problem". – Werner Feb 21 '12 at 19:40
@Werner Both if possible. I have seen how the longdiv package for division of polynomials works and its incredibly useful to me when am writing a tutorial for my students. The display is, I suppose, a first priority and the process well I guess that would require a lot more time but if it can be done I will be thankful. – azetina Feb 21 '12 at 19:44
There is the xlop package that however uses a different way to print the schemes. – egreg Mar 1 '12 at 22:04

The addition is fairly simple and examples can be found at Numbering Vertical Addition Problems.

For the long division in your style you can use an array environment.

The MWE is shown below.

\documentclass[11pt]{article}
\begin{document}
% spacing round the bracket in long division
\newcommand\divspace{\,}
$\arraycolsep=0em \begin{array}{r@{\divspace}c@{\divspace}lllll} & & \multicolumn{4}{r}{2500.}&(answer)\\ \cline{2-6} 25&\big)&\multicolumn{4}{l}{62500.}&\\ & & 50&&&&\\ \cline{3-4} & & 12&5&&&\\ & & 12&5&&&\\ \cline{3-5} & & &0&0&& \end{array}$
\end{document}

-
Can this be automated like the longdiv package. – azetina Mar 24 '12 at 16:04
@azetina It can possibly with LuaLaTeX to ease the pain for calculations. It will need some decent effort though. – Yiannis Lazarides Mar 24 '12 at 16:07
Sincerely over the paste months I have been more interested in LuaTex and its variants but I still dont get the idea behind it and how to actually get to understand and even more how to use it. I here you guys here talk about it but I guess I am so much attached to just Latex that I have little effort to indulge in that area. – azetina Mar 24 '12 at 16:11
@azetina If you only going to have examples with integers, it is not too difficult via LaTeX only. If you are going to have decimals then I would use the fp package and life gets more complex. Glad to see these sort of things still being taught. At work at of 25 graduate Engineers none can do a square root by hand:) – Yiannis Lazarides Mar 24 '12 at 16:14
I guess that is the purpose of technology.... – azetina Mar 24 '12 at 16:23

The xlop package takes care of typesetting addition, subtraction, division, multiplication, and calculates easy functions such as gcd. However, the typesetting is French style only still (other styles are planned), for long division, stick with longdiv as suggested by azetina.

Example:

\documentclass{article}
\usepackage{xlop}

\begin{document}