# [OS X TeX] Staggering

Alain Schremmer Schremmer.Alain at gmail.com
Wed Mar 7 12:05:30 EST 2007

Jeffrey J Weimer wrote:

> On Mar 6, 2007, at 2:40 PM, Alain Schremmer wrote:
>
>> Is there a more elegant way, both in source and in output, to typeset
>
>
> Ooops! Spoke too soon. Here's the correction ...
>
> \usepackage{forloop,calc}
> \newcounter{myc}
> \newcounter{ic}
> \newlength{\mlen}
> \newcommand{\brmultiply}[3]{%
>     \setcounter{myc}{#1}%
>     \begin{center}%
>     \forloop{ic}{#1}{\value{myc}<#3}{%
>         \hspace{\mlen}$\underbrace{\themyc\times#2}$ \\%
>         \setcounter{myc}{#2*\value{myc}}%
>     \hspace{\mlen}#3\end{center}%
>     }

1) I am truly awed  (I hadn't realized this was even conceivable.)

2) Where could I learn how to use forloop? (the documentation is rather
sparse for someone like me.)

3) What I would like to do is to use the exponent as third parameter
instead of the value of the power, say

\brmultiply{17}{2}{6}
\brmultiply{3}{3}{4}

\brmultiply{17}{2}{1088}
\brmultiply{3}{3}{243}

(The usual story: you give them a hand and they ask for an arm and a leg!)

> Also, the \begin{center}...\end{center} coding does not quite follow
> your centering. Your coding has the last value centered on the page,
> and numbers above are offset to the left. The above centers the
> answer based on the first line, and numbers are offset to the right
> thereafter. I'd have to think a bit about where and how to put the
> setlength and addtolength commands in the forloop structure to
> accomplish your result. Perhaps someone else here will see the answer.

I truly couldn't care less   :-) . My "philosophy" in this regard is to
get the magnum whatever out and up (under a Free Doc Lic) and let anyone
interested fine tune the stuff to their heart's content.

Very grateful regards
--schremmer