# [lltx] spaces in \jobname

Manuel Pégourié-Gonnard mpg at elzevir.fr
Thu Jun 10 14:31:46 CEST 2010

Hi,

As pointed out in a recent thread [1], the problem with spaces in \jobname on
lualatex, already discussed in an older thread [2], is not fixed yet.

[1] http://tug.org/pipermail/lualatex-dev/2010-June/000678.html
[2] http://www.ntg.nl/pipermail/dev-luatex/2009-April/002549.html

In course of [2], Élie suggested to work around the problem by redefining
\jobname in the format. This is not so easy, since we don't want to add quotes
if \jobname doesn't contain spaces, but we still want \jobname to expand in one
step.

Another idea is to inspect \jobname at \everyjob time (at which point it is
always known, according to my tests) and redefine it if it contains spaces. For
example we could modify lualatex.ini so that it ends like:

\let\dump\relax
\input latex.ltx
\everyjob\expandafter{\the\everyjob
\begingroup
\def\testsp#1 #2\relax{%
\ifx\relax#2\relax
\let\fixjobname\empty
\else
\edef\fixjobname{\def\noexpand\jobname{"\jobname"}}%
\fi}%
\edef\dotest{\noexpand\testsp\jobname\space\relax}\dotest
\expandafter
\endgroup\fixjobname}
\pdfprimitive\dump

(and similarly for dvilualatex.ini, so probably factor this part out in one
common file).

Tested, it seems to work. (Though it doesn't look too pretty.)

Wdyt?

Manuel.