"Giuseppe Bilotta" <[EMAIL PROTECTED]> wrote:
> 
> TB> Now I was thinking where I could do so in TeX. (I think there are
> TB> macros in ConTeXt, but I cannot find them.)
> 
> e-TeX has some arithmetic primitives. Don't know if they are
> somehow wrapped in ConTeXt, though.

It is rather straightforward in normal TeX as well, as long as they
are integers. Floats are a bit of a problem. For those, perhaps
a texutil plugin would be easier. Then again, that would alway
force another run.

Assuming integers, try this:

\def\mycalc#1#2#3{%
  \count1=#1
  \advance\count1 #2
  \advance\count1 #3
  \ifnum\count1 > 0
     \count3=#1
     \count5=#2
     \multiply \count5 2
     \advance\count3 \count5
     \count5=#3
     \multiply \count5 3
     \advance\count3 \count5
     % 
     \multiply\count3 10
     \divide \count3 \count1
     \expandafter\domycalc\the\count3\relax\quit
  \else
   --%
  \fi
}

\def\domycalc#1#2\quit{%
  \if#2\relax
    .#1%
  \else
    #1\domycalc#2\quit%
  \fi
}

\mycalc{1}{3}{5}

-- 
groeten,

Taco

Reply via email to