[latexrefman] jobname

Karl Berry karl at freefriends.org
Sun Aug 15 00:42:22 CEST 2021

In general ... if an \input command is used early enough on the first
line of input, its argument becomes the \jobname (that's why the job
name in your case used to be "article").

If no \input is seen on the first line, or some other command is
executed that requires the job name before the \input, the jobname is
set to the default "texput" (as of 2020, the LaTeX people made a change
so that would happen instead). It has nothing to do with actually
executing the \jobname primitive.

You'd have to read tex.web and do many experiments to determine the
precise behavior.

However, I don't think any of this should be explained in our manual.
It's not important, and isn't consistent over time with LaTeX, as you
discovered, or across engines (I believe luatex has different behavior,
unfortunately). Seems to me all the manual needs to say is that
1) simple invocations like "latex foo" will set \jobname to foo, and
2) if no filename is apparent to TeX, it will use "texput" by default, and
3) it can be set explicitly with the -jobname option.

Explaining every detail of every command line option also seems beyond
the scope of our manual to me. Most of them are not relevant to any
reasonable LaTeX usage. This is not a manual for TeX programmers. -k

More information about the latexrefman mailing list.