[texhax] choice of documentstyle upon \jobname

Uwe Lück uwe.lueck at web.de
Sun Dec 4 20:05:39 CET 2005

At 17:32 04.12.05, Karl Berry wrote:
>       >> \expandafter\def\csname first\endcsname{\documentclass[abc]{...}}
>       >> \expandafter\def\csname second\endcsname{\documentclass[xyz]{...}}
>       > Is it true that, in the case where first and second are completely
>       > composed of letters which TeX accepts for command name, that's
>       > equivalent to
>       > \def\first{\documentclass...}
>       > \def\second{\documentclass...}  ?
>     Maybe not equivalent, but at least similar.
>It seems to me the results of those two constructs are *completely*
>equivalent.  Am I missing something?

Of course they are completely equivalent.
The non-trivial part of the problem has somehow get lost in communication.

The main idea was that you can put \jobname inside \csname ... \endcsname
in order to get rid of the category codes that \jobname produces.

On the other hand, if \csname ... \jobname ... \endcsname
expands to \foo, it suffices to \newcommand{\foo}{...};
\@namedef is not required (unless, e.g., number characters
come in).


More information about the texhax mailing list