[OS X TeX] Staggering

Alain Schremmer Schremmer.Alain at gmail.com
Thu Mar 8 17:56:45 CET 2007


Peter Dyballa wrote:

>
> Am 07.03.2007 um 18:05 schrieb Alain Schremmer:
>
>> 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}
>>
>> instead of
>>
>>    \brmultiply{17}{2}{1088}
>>    \brmultiply{3}{3}{243}
>
>
> Do you mean something like this:
>
>     \newcounter{result}
>     \newcounter{steps}        % iterations of the loop
>     \newlength{\relspc}        % twice maximum left shift
>     \newlength{\relstep}        % estimation of decreasing shift
>     \newlength{\ubrace}        % length of \underbrace expression
>     \newlength{\reslen}        % length of the result
>     \newcommand{\stagger}[3]{
>       \setlength{\relstep}{1.75em}    % OK for small numbers
>       \setlength{\relspc}{\relstep*#3}
>       \setcounter{result}{#1}
>       \begin{center}
>         \forloop{steps}{0}{\value{steps}<#3}{
>           \settowidth{\ubrace}{$\underbrace{\theresult\times#2}$}
>           \settowidth{\reslen}{\theresult}
>           \setlength{\relspc}{\relspc-\ubrace+\reslen}
>           $\underbrace{\theresult\times#2}$\rule{\relspc}{0pt}%\thesteps
>           \\
>           \setcounter{result}{#2*\value{result}}
>         }
>         \theresult
>       \end{center}
>     }
>
>
> When you make the commented \thesteps active you can see the value of  
> the loop counter.
> When you change the 0pt to 1pt you can see the amount of space by  
> which the lines are shifted to the left.
>
> Using a font size relative value for the amount by which the left  
> shift is reduced line by line makes it independent of the font size  
> or the font used. When using larger numbers you will need to increase  
> \relstep – but then you would not be able to use the same function  
> also for small numbers. A forth argument, this width, could help. A  
> more radical approach would be to determine the largest and smallest  
> underbrace and to compute from this the maximal shift width. (The  
> result and the last underbrace do not need to be shifted.)

I just tried it: This is a Mercedes to Weimer's Ford. But then I am not 
a rich man. :-)

Joking aside, I intend to try and analyze the two since I really want to 
learn how to Â… program.

Most grateful regards
--schremmer












------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the macostex-archives mailing list