I want to redefine a primitive parameter as a macro, and make the macro behaves the same as the primitive parameter in some situations.

\tracingcommands = 1
\ifnum\tracingcommands > 0 true\fi

\def\temp{\oldtracingcommands\count255 \domore}

\tracingcommands = 1 % success
\the\tracingcommands % failure
\ifnum\tracingcommands > 0 true\fi % failure

In running the above example, the last two lines failed. How could these be resolved?

  • If \p is primitive and you say \let\q\p then isn't \q just defined as \p, so that if you then redefine \p, \q will follow? I don't know anything about it, but how else could it work? \q must be defined as something and if \p is irreducible, then \q must surely be defined as \p? – cfr Feb 9 '15 at 2:58
  • The failure \the\tracingmacros is because \tracingmacros is no longer what it used to be. Using \the\oldtracingmacros would do the trick. However, could you explain what you want as well since it's not clear from the code snippet? For example, if you wish to redefine primitives, how about doing it inside a group so their meanings are restored upon closure? – Werner Feb 9 '15 at 3:34
  • The \the primitive can be followed by internal register, but not by the macro. Respect the primitive syntax and think about your problem from another side. – wipet Feb 9 '15 at 7:48

You can do it, provided you use \the when the command is used in a <number> context.




\ifnum\the\tracingcommands<2 SMALL\else BIG\fi


Why you would do this is quite dubious to begin with.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.