Deyan Ginev edited section_Handy_LaTeX_Programming_Some__.tex  almost 9 years ago

Commit id: 3a6860adb5af8531269d04767c2bdf73b0fb3d6c

deletions | additions      

       

\begin{lstlisting}  \newcounter{a}  \newcounter{b}  \newcounter{ab} \newcount\ab  \newtoks\allrows  \newcommand\addrow[3]{% 

\setcounter{b}{0}  {\loop \ifnum\theb<10  \stepcounter{b}  \setcounter{ab}{\numexpr\thea*\theb\relax}%  \addrow{$\thea$}{$\theb$}{$\theab$} \ab=\thea  \multiply\ab by \theb  \addrow{$\thea$}{$\theb$}{$\the\ab$}  \repeat}  \expandafter\global\expandafter\allrows\expandafter{\the\allrows\hline}  \repeat 

\end{tabular}  \end{lstlisting}  % Actual multiplication table implementation:  \newcounter{a}  \newcounter{b}  \newcounter{ab} \newcount\ab  \newtoks\allrows  \newcommand\addrow[3]{% 

\setcounter{b}{0}  {\loop \ifnum\theb<10  \stepcounter{b}  \setcounter{ab}{\numexpr\thea*\theb\relax}%  \addrow{$\thea$}{$\theb$}{$\theab$} \ab=\thea  \multiply\ab by \theb  \addrow{$\thea$}{$\theb$}{$\the\ab$}  \repeat}  \expandafter\global\expandafter\allrows\expandafter{\the\allrows\hline}  \repeat