[OS X TeX] Long Division redux
Alain Schremmer
Schremmer.Alain at gmail.com
Thu Dec 29 19:53:00 CET 2005
I once appealed to this list for help setting up long divisions. I
remember not using Arseneau's longdiv, for whatever reason, but someone
gave me some code which I have been using ever since.
Now I want to set up long divisions for polynomials. I was able to fudge
what I had but I have the strong feeling that I am defeating the code
that was given to me and I don't understand it enough to adapt it.
I wonder if, as mostly a matter of esthetics, someone might be williing
to do so.
Below is the template that I am using, in the form of a document, should
anyone be interested by the exercise.
Regards for the New Year
--schremmer
\documentclass[11pt]{book}
\begin{document}
\begin{center}
\newdimen\digitwidth \settowidth\digitwidth{0}
\def~{\hspace{\digitwidth}}
\def\divrule#1#2{%
\noalign{\moveright#1\digitwidth%
\vbox{\hrule width#2\digitwidth}}}
%This is the divisor
$0$
$+0h$
$+0h^{2}$
$+0h^{3}$
\hspace{0mm}
\begin{tabular}[b]{@{}l@{}}
%This is the quotient (Its length controls the line.)
\hspace{5mm}
$0$
\hspace{5mm}
$+0h$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
\hline
\big)
\begin{tabular}[t]{@{}l@{}l@{}}
%This is the dividend
\hspace{2mm}
$0$
\hspace{5mm}
$+0h$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
%This is the first multiplication
\hspace{2mm}
$0$
\hspace{5mm}
$+0h$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
\divrule{0}{30}
%This is the first subtraction
\hspace{2mm}
$0$
\hspace{5mm}
$+0h$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
%This is the second multiplication
\hspace{2mm}
$ð$
\hspace{7mm}
$+0h$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
\divrule{7}{23}
%This is the second subtraction
\hspace{2mm}
$ð$
\hspace{7mm}
$+0h$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
%This is the third multiplication
\hspace{6mm}
$ð$
\hspace{10mm}
$ð$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
\divrule{13}{17}
%This is the third subtraction
\hspace{8mm}
$ð$
\hspace{8mm}
$ð$
\hspace{5mm}
$+0h^{2}$
\hspace{5mm}
$+0h^{3}$
\\
%This is the fourth multiplication
\hspace{10mm}
$ð$
\hspace{10mm}
$ð$
\hspace{10mm}
$ð$
\hspace{5mm}
$+0h^{3}$
\\
\divrule{20}{10}
%This is the fourth subtraction
\hspace{10mm}
$ð$
\hspace{10mm}
$ð$
\hspace{10mm}
$ð$
\hspace{5mm}
$+0h^{3}$
\\
\end{tabular}
\end{tabular}
\end{center}
\end{document}
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
More information about the macostex-archives
mailing list