6

Is there in existence packages that recreate the following environments: enter image description hereenter image description hereenter image description here

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.

azetina
  • 28,884
  • 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 01 '12 at 22:04

2 Answers2

3

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.

enter image description here

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}
David Carlisle
  • 757,742
yannisl
  • 117,160
  • 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. – yannisl 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:) – yannisl Mar 24 '12 at 16:14
  • I guess that is the purpose of technology.... – azetina Mar 24 '12 at 16:23
  • I'd write \text{ (answer)} rather than just "answer". – Michael Hardy Jan 21 '15 at 15:51
  • @MichaelHardy Sure it is better. – yannisl Jan 21 '15 at 17:06
2

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}
\opadd{8}{3}

\end{document}

Output of the example:

enter image description here

  • Welcome to TeX.SX! While your answer might solve the problem, you should provide a visual output for a quick 'proof' as well. –  Sep 08 '14 at 14:16
  • Done that (adding visual proof). Thanks to @ChristianHupfer for the hint. – Georg Jung Dec 01 '14 at 12:11