Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

jobname with command line input

32 views
Skip to first unread message

vincent....@gmail.com

unread,
Aug 13, 2021, 11:12:11 AM8/13/21
to
Hello,

Look at this command line:

pdflatex '\documentclass{article}\usepackage{lipsum}\input' foo

where foo.tex contains:

\begin{document}
Bonjour \lipsum[1]
\end{document}

Depending on the version of LaTeX kernel (or engine ?) the jobname will
be:

1. article, for older versions
2. lipsum, for more recent versions
3. texput, for a current version

I could not get it to be foo.

OK, it is not a problem, because you can still pass the option --jobname
foo to explcitely set it too foo. I am just trying to know what the
official and deprecated behaviours are.

Is that correct to say that after \documentclass, \RequirePackage or
\usepackage the current jobname (be it texput) is frozen, and cannot be
changed by any subsequent \input.





vincent....@gmail.com

unread,
Aug 13, 2021, 1:17:22 PM8/13/21
to
It seems that the \jobname is frozen after the first time it is
expanded, and has some special primitive behaviour up to that point,
that is to say that it is a primitive, not a macro, but which is similar
to a macro containing the token list « undefined » (w/o guillemets) with
all letters of catcode 12 (other). This means that if you do:

\show\jobname

you get (because it is a primitive)

\jobname=\jobname.

if you do:

\let\toto\jobanme\show\toto

you get:

\toto=undefined.

if now you do:

{\escapechar=-1 \edef\titi{\expandafter\string\csname undefined\endcsname}}
\let\toto\jobname
\ifx\titi\toto\message{undefined = string}\else\message{undefined ???}\fi

you get:

undefined = string

if you do:

\ifx\jobname\undefined\message{jn undef}\else\message{jn not undef}\fi

you get:

jn not undef

if you do:

\edef\tata{\jobname}\show\tata

then, assuming that the jobname is helloworld, you get:

\tata=macro:
->hellworld.

if the jobname was « hello world » (w/o the guillemets, but with the
space inside, then you would get:

\tata=macro:
->"hell world".

So, I have one plain question, is there any such thing in \documentclass
or \RequirePackage as \edef\dummy{\jobname} in order to freeze the
jobname.



vincent....@gmail.com

unread,
Aug 13, 2021, 1:40:26 PM8/13/21
to
Sorry, I did a mistake with curly brackets


If you do:

\let\toto\jobname
{\escapechar=-1 \edef\titi{\expandafter\string\csname undefined\endcsname}
\ifx\titi\toto\message{undefined = string}\else\message{undefined ???}\fi}

you get:

undefined ???

So the « undefined » initial value is not made of characters of catcode
12.

If you do:

\let\toto\jobname
\def\titi{undefined}
\ifx\titi\toto\message{undefined = string}\else\message{undefined ???}\fi

You get the same message, so it is not either made of catcode=letter
tokens.



vincent....@gmail.com

unread,
Aug 14, 2021, 12:27:43 PM8/14/21
to
I did a very plain test. I did '\def\jobname{\errmessage{Something}} at
the beginning of some sample minimal hello world document, and I
realized that the first time that \jobname is expanded is in the
\begin{document} because of inputing the .aux file.

Now everything boils down to one simple question. My assumption that
\documentclass or \RequirePackage were expanding \jobname to freeze it
proves out erroneous, so what do they do to get the same result of
freezing it.

The context of the question is that with older version of LaTeX
the following command line

pdflatex '\documentclass{minimal}\begin{document}Hello!\end{document}

would produce a document named minimal.pdf, and now, with the latest
versions of LaTeX it produces a document named texput.pdf. What has been
done to get this change ?

Any kind of hint is welcome…

Julius Dittmar

unread,
Aug 14, 2021, 3:44:06 PM8/14/21
to
Am 14.08.21 um 18:27 schrieb vincent....@gmail.com:
I can't give you any details, but the way \begin{document} is processed
has been overhauled. The idea was (as far as I can know) to allow
packages to suspend parts of their work until all packages have been
loaded, so they can test against the presence of conflicting packages
and deal with the consequences without the need to load packages in the
right order.

These changes were part of the latex3 work, so if you want to know more,
that's where you might want to start your search.

Hope that helps,
Julius Dittmar

vincent....@gmail.com

unread,
Aug 14, 2021, 4:46:21 PM8/14/21
to
Julius Dittmar <Julius....@gmx.de> writes:

> Am 14.08.21 um 18:27 schrieb vincent....@gmail.com:
>> vincent....@gmail.com writes:
>>
>>> vincent....@gmail.com writes:
>>>
>>>> vincent....@gmail.com writes:
>>>>
>>>>> Hello,
>>>>>
>>>>> Look at this command line:
>>>>>
>>>>> pdflatex '\documentclass{article}\usepackage{lipsum}\input' foo
>>>>>

[...]

>> \documentclass or \RequirePackage were expanding \jobname to freeze it
>> proves out erroneous, so what do they do to get the same result of
>> freezing it.
>> The context of the question is that with older version of LaTeX
>> the following command line
>> pdflatex
>> '\documentclass{minimal}\begin{document}Hello!\end{document}
>> would produce a document named minimal.pdf, and now, with the latest
>> versions of LaTeX it produces a document named texput.pdf. What has been
>> done to get this change ?
>
> I can't give you any details, but the way \begin{document} is
> processed has been overhauled. The idea was (as far as I can know) to
> allow packages to suspend parts of their work until all packages have
> been loaded, so they can test against the presence of conflicting
> packages and deal with the consequences without the need to load
> packages in the right order.
>
> These changes were part of the latex3 work, so if you want to know
> more, that's where you might want to start your search.
>
> Hope that helps,
> Julius Dittmar
>

Thank youn for your feedback. Maybe in the end the best way for me to
understand how they implemented this change of behaviour in
\documentclass and \RequestPackage would be to scan the changes in the
github repo of the latex3 project … I was hoping that somebody already
had the answer.
0 new messages