Hi Jean,
Thanks a lot again, the proposed method works on the command line! I'll
implement it in the actual preview-latex code.
By the way, if I remember correctly, filenames with multiple contiguous
spaces are not supported by TeX, aren't they? Standard pdflatex just
fails for such file names:
----------------------------------------------------------------------
[bash]$ cp ppp\ qqq.tex aaa\ \ bbb.tex
[bash]$ pdflatex aaa\ \ bbb.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded
format=pdflatex)
restricted \write18 enabled.
entering extended mode
! I can't find file `"aaa bbb.tex"'.
<*> "aaa bbb.tex"
(Press Enter to retry, or Control-D to exit)
Please type another input file name:
----------------------------------------------------------------------
So I suppose that it is not necessary for preview-latex to support such
file names.
jfbu <address@hidden> writes:
In short, in presence of the /AUCTEXINPUT hack, the original space hack
simply ceases functioning because the space catcode is reset to "ignore"
too soon (at \everyjob)
How to fix this ?
With this new version of ini file
\ifx\pdfoutput\undefined\else\let\PREVIEWdump\dump\def\dump{%
\edef\next{{\pdfoutput=\the\pdfoutput\relax\the\everyjob}}%
\everyjob\next\catcode`\ 10 %
\catcode`/ 0 %
\def\AUCTEXINPUT##1{\catcode`/ 12\relax\catcode`\
9\relax\input{\detokenize{"##1"}}}%
\let\dump\PREVIEWdump\dump}\fi\input mylatex.ltx \relax%
Notice that when ##1 (i.e. the filename) will be grabbed) the / is of
catcode 0, so ##1 is tokenized accordingly. Which in principle could
perhaps cause an issue \detokenize{aaa/b23} would give aaa/b<space>123
but as / is not legal in filenames in contexts I know of, I did not even
test this anticipation.
I have also added quotes inside the \detokenize.
I tested with a file with filename "test mylátex.tex"
I. Generation of format
etex -ini "&pdflatex" prv_test_mylátex.ini
"\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes]{preview}[2004/11/05]\fi}"
"\input{\detokenize{\"test mylátex.tex\"}}"
where file prv_test_mylátex.ini contains the above contents (from
\ifx\pdfoutput to \relax%)
and attention to the added quotes inside the \detokenize argument.
II. Usage of format
pdflatex -fmt="prv_test_mylátex.fmt" /AUCTEXINPUT{test mylátex.tex}
Could you try this out ?
Best
Jean-François
Best regards,
Ikumi Keita