# [texhax] choice of documentstyle upon \jobname

Uwe Lück uwe.lueck at web.de
Sat Dec 3 20:26:42 CET 2005

```At 13:26 02.12.05, Philip TAYLOR wrote:

>Uwe Lück wrote:
>
>>The main message from Phil's proposal thus is:
>>In order to test whether some \testfirst expands
>>to `first', you might \edef\testsecond{first} and
>>then \ifx\testfirst\testsecond.
>
>There's even more to it than that, in that \jobname
>/isn't/ a macro, so regardless of the catcode of
>the elements of its expansion, it can never match
>(in the context of \ifx) a macro.  This is why I
>had to define both \ThisName /and/ \JobName as macros,
>so that they could then be compared w.r.t. content.

OK, I take for granted without testing that TeXbook p. 210
is exact in this respect ... however, there is /even more/
to it ... so I have to withdraw nearly everything:
I am probably the last one of the four contributors to
this thread who realizes that, according to TeXbook p. 214,
\jobname expands to a string of characters of category
code 12 ("other") -- so the \catcode thing is essential
with \jobname indeed, or Reinhard's \csname thing is
essential. Sorry!

However, the proposals don't seem to account for the
fact that the main files generating all the papers or books
or ... won't all be named `paper.tex', and how widely
these names may vary. And note that there are at least
as many job names as file names. Besides the substr
package, the \csname method could be extended to
deal with this as well -- if certain naming conventions
are obeyed (or if \jobname exhibits the path and the
main files are placed in directories according to the
classes they should be processed with.) Yet I wonder
whether these considerations are useful in practice
in place of just adjusting the argument of \documentclass
manually.

Lucky TeXing,
Uwe.

```