Re: Any methods to show arithmatic style division?

2001-08-28 Thread Dekel Tsur

On Mon, Aug 27, 2001 at 11:36:55AM -0400, German Poo Caaman~o wrote:
> "Michael S. Wellman" wrote:   
> > I'm wondering if LyX (or I supose LaTeX) has a way to show arithmetic   
> > style division: 
> > 
> > _2__
> > 5 |10   
> > 
> > Or should I use xfig and draw out the problem?  
>   
> Look at polynom package on CTAN.  

But polynom is intended for polynom division, not integer division.
For integer division use longdiv.sty (attached).

Writing \longdiv{10}{5} in latex mode will generate the following output:

  __2
5|10
  10
  --
   0
 __2_
If you just want to generate just 5 | 10, then use simplediv.sty
(attached)
and write \simplediv{10}{5}{2}



%  longdiv.tex  v.1  (1994)  Donald Arseneau  
%
%  Work out and print integer long division problems.  Use:
%   \longdiv{numerator}{denominator}
%  The numerator and denominator (divisor and dividend) must be integers, and
%  the quotient is an integer too.  \longdiv leaves a remainder.
%  Use this in any type of TeX.

\newcount\gpten % (global) power-of-ten -- tells which digit we are doing
\countdef\rtot2 % running total -- remainder so far
\countdef\LDscratch4 % scratch

\def\longdiv#1#2{%
 \vtop{\normalbaselines \offinterlineskip
   \setbox\strutbox\hbox{\vrule height 2.1ex depth .5ex width0ex}%
   \def\showdig{$\underline{\the\LDscratch\strut}$\cr\the\rtot\strut\cr
   \noalign{\kern-.2ex}}%
   \global\rtot=#1\relax
   \count0=\rtot\divide\count0by#2\edef\quotient{\the\count0}%\show\quotient
   % make list macro out of digits in quotient:
   \def\temp##1{}%\ifx##1\temp\else \noexpand\dodig ##1\expandafter\temp\fi}%
   \edef\routine{\expandafter\temp\quotient\temp}%
   % process list to give power-of-ten:
   \def\dodig##1{\global\multiply\gpten by10 }\global\gpten=1 \routine
   % to display effect of one digit in quotient (zero ignored):
   \def\dodig##1{\global\divide\gpten by10
  \LDscratch =\gpten
  \multiply\LDscratch  by##1%
  \multiply\LDscratch  by#2%
  \global\advance\rtot-\LDscratch \relax
  \ifnum\LDscratch>0 \showdig \fi % must hide \cr in a macro to skip it
   }%
   \tabskip=0pt
   \halign{\hfil##\cr % \halign for entire division problem
 $\quotient$\strut\cr
 #2$\,\overline{\vphantom{\big)}%
 \hbox{\smash{\raise3.5\fontdimen8\textfont3\hbox{$\big)$}}}%
 \mkern2mu \the\rtot}$\cr\noalign{\kern-.2ex}
 \routine \cr % do each digit in quotient
}}}

\endinput
\noindent Here are some long division problems

\indent
\longdiv{12345}{13} \quad
\longdiv{123}{1234} \quad
\longdiv{31415926}{2} \quad
\longdiv{81}{3} \quad
\longdiv{1132}{99} \quad
\longdiv{86491}{94}
\bye




\newcommand{\simplediv}[3]{\ensuremath{\begin{array}{@{}r@{}l@{}r@{}}
 & & #3\\
 \cline{2-3}
#2 & \big) & #1\\
\end{array}}}



Re: Any methods to show arithmatic style division?

2001-08-27 Thread Andre Poenitz

> that was right, but maybe "|" looks better than "/"
> I mean,
> 
> \frac25|10

Do you mean "5 divided by 10" in the denominator?  If so, I've never seen
"|" used for that purpose. But typographic rules change from country to
country and it is perfectly acceptable to use "|" for division in your
area.

Andre'

-- 
André Pönitz . [EMAIL PROTECTED]



Re: Any methods to show arithmatic style division?

2001-08-27 Thread I Wayan Warmada


On Mon, 27 Aug 2001, Andre Poenitz wrote:

> I do not understand the question (did you use a fixed width font?) but
> maybe the result of typing
>
> \frac25/10
>
> is what you are looking for.

that was right, but maybe "|" looks better than "/"
I mean,

\frac25|10


Regards,

I Wayan Warmada




Re: Any methods to show arithmatic style division?

2001-08-27 Thread German Poo Caaman~o

"Michael S. Wellman" wrote:
> I'm wondering if LyX (or I supose LaTeX) has a way to show arithmetic
> style division:
> 
> _2__
> 5 |10
> 
> Or should I use xfig and draw out the problem?

Look at polynom package on CTAN.

-- 
German Poo Caaman~o
mailto:[EMAIL PROTECTED]
http://www.ubiobio.cl/~gpoo/chilelindo.html
"La historia no se lee, se escribe"



Re: Any methods to show arithmatic style division?

2001-08-27 Thread Renaud MICHEL

Le Lundi 27 Août 2001 17:01, vous avez écrit :
> Hello group,
>
> I'm wondering if LyX (or I supose LaTeX) has a way to show arithmetic
> style division:
>
> _2__
> 5 |10
>
> Or should I use xfig and draw out the problem?
>
> If there is a LyX way to do this I'd be wonderfully happy to learn how,
> so please tell me!
>
> PS. I don't know LaTeX but I know you can type it in via the TeX button
> or put it in the preamble.

Can't you do that with a table?

-- 
Il se fait respecter, je me fait respectable.

Renaud MICHEL



Re: Any methods to show arithmatic style division?

2001-08-27 Thread Andre Poenitz

On Mon, Aug 27, 2001 at 08:01:11AM -0700, Michael S. Wellman wrote:
> Hello group,
> 
> I'm wondering if LyX (or I supose LaTeX) has a way to show arithmetic 
> style division:
> 
> _2__
> 5 |10

I do not understand the question (did you use a fixed width font?) but
maybe the result of typing

\frac25/10

is what you are looking for.

Andre'

-- 
André Pönitz . [EMAIL PROTECTED]



Any methods to show arithmatic style division?

2001-08-27 Thread Michael S. Wellman

Hello group,

I'm wondering if LyX (or I supose LaTeX) has a way to show arithmetic 
style division:

_2__
5 |10

Or should I use xfig and draw out the problem?

If there is a LyX way to do this I'd be wonderfully happy to learn how, 
so please tell me!

PS. I don't know LaTeX but I know you can type it in via the TeX button 
or put it in the preamble.