[OS X TeX] Staggering

Jeffrey J Weimer weimerj at email.uah.edu
Tue Mar 6 17:30:44 EST 2007


On Mar 6, 2007, at 2:40 PM, Alain Schremmer wrote:

>    \begin{center}
>
>    $\underbrace{17\times2}$\hspace{32mm}
>
>    $\underbrace{34 \times 2}$ \hspace{26mm}
>
>    $\underbrace{68 \times 2}$\hspace{20mm}
>
>    $\underbrace{136 \times 2}$\hspace{14mm}
>
>    $\underbrace{272 \times 2}$\hspace{8mm}
>
>    $\underbrace{544 \times 2}$\hspace{2mm}
>
>    $1088$
>    \end{center}

You may want to play with the 20pt spacing added and subtracted from  
\mlen, but try this for a start ...

\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\times2}$ \\%
		\setcounter{myc}{#2*\value{myc}}%
		\addtolength{\mlen}{20pt}}%
	\addtolength{\mlen}{-20pt}%
	\hspace{\mlen}#3\end{center}%
	}

\begin{document}

\brmultiply{17}{2}{1088}

\brmultiply{3}{3}{243}


\end{document}

------------------------- 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 MacOSX-TeX mailing list