[texhax] How do you tell TeX to forget?

Aditya Mahajan adityam at umich.edu
Sat Jun 9 09:29:57 CEST 2007


On Sat, 9 Jun 2007, Randy Schilling wrote:

>      I'm trying to define a count register in terms of a macro.  This is
> discussed to a limited extent
>      near the middle of  p. 379 of the TeXbook..  The command  \n=\csn
> works just fine if \csn is very
>     simple, \edef\csn{\the\n} or \edef\csn{1234}, but fails if the number
> 1234 here is the result
>     of a process, the result of a macro.  \csn is defined by
> \edef\csn{\macro}; it might be necessary
>     to use \noexpand or a token register as described on p.216 of the
> TeXbook to get the result of the
>     \macro in \csn.  Anyway,  \n=\csn fails with a 'missing number' error
> showing some of the code in
>     \macro.  I don't know how to tell TeX  to forget about  the process,
> \macro, leading to the result 1234.

This works fine for me:

\newcount\n

\def\macroA{12}
\def\macroB{4}
\def\macroC{\macroA3\macroB}

\n=\macroC
% \n=\numexpr\macroC\relax

\the\n

\bye

For more complicated macros, you can try \numexpr.

Aditya


More information about the texhax mailing list