[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Preview with TeX-output-dir and luatex
From: |
Ikumi Keita |
Subject: |
Re: Preview with TeX-output-dir and luatex |
Date: |
Tue, 14 Jun 2022 15:33:03 +0900 |
Hi Michael,
>>>>> "Braun, Michael" <braunm@mail.smu.edu> writes:
> It works as long as I do not cache the preamble. If I do cache the
> preamble, then on the *first try only*, the preview commands
> (-at-point, -buffer, or -document) generates the following error.
Thanks for testing. I didn't check that case, sorry.
> ----
> TeX Output exited as expected with code 1 at Mon Jun 13 12:05:55
> Running `Preview-DviPS' with ``dvips -Pwww build/_region_.dvi -o
> build/_region_.prv/tmp31993roO/preview.ps''
> Parser: End of Preview snippet 1 unexpected
> Preview-DviPS killed: 9 at Mon Jun 13 12:05:55
> ----
It first failed at dumping cached preamble:
,----
| Running `Preview-LaTeX' on `tst-prv' with ``lualatex -ini
--output-directory="build/" -interaction=nonstopmode "&lualatex"
prv_tst-prv.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{" tst-prv.tex "}"''
| This is LuaHBTeX, Version 1.15.0 (TeX Live 2022) (INITEX)
| restricted system commands enabled.
| (./prv_tst-prv.ini
| LaTeX2e <2021-11-15> patch level 1
| L3 programming layer <2022-02-24>
(/usr/local/texlive/2022/texmf-dist/tex/latex/mylatex/mylatex.ltx))
| ! I can't find file `'.
`----
Due to this error, preview-latex resorted to default operation mode of
LaTeX->Dvips->Ghostscript, which further failed because lualatex didn't
produce ps file needed by dvips.
> But if I just do it again, it works the second time through.
[...]
> So for some reason, preview-…. wants to run dvips the first time
> after opening the file in a new session, but afterwards, then it knows
> what to do.
The reason is that preview-latex detected failing the generation of
cached preamble and switched silently to non-cache mode.
In the same setting, pdflatex and xelatex successfully generate cached
preamble:
,----
| Running `Preview-LaTeX' on `tst-prv' with ``pdflatex -ini
--output-directory="build/" -interaction=nonstopmode "&pdflatex"
prv_tst-prv.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{" tst-prv.tex "}"''
| This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (INITEX)
| restricted \write18 enabled.
| entering extended mode
| (./prv_tst-prv.ini
| LaTeX2e <2021-11-15> patch level 1
| L3 programming layer <2022-02-24>
(/usr/local/texlive/2022/texmf-dist/tex/latex/mylatex/mylatex.ltx))
(/usr/local/texlive/2022/texmf-dist/tex/latex/tools/.tex File ignored)
`----
So it seems that lualatex invoked with "-ini" cannot read in empty
".tex" file when "--output-directory" option is specified. This is
specific to lualatex and I can't tell the reason. I'm afraid that only
lualatex (or luatex) developers know where this difference comes from.
> Fortunately, there is an easy workaround for now: don’t cache the
> preamble.
Actually preview-latex provides only limited support for preamble cache
with lualatex[1]:
,----
| Note that support for preamble cache is limited for LaTeX variants.
| c.f. <https://github.com/davidcarlisle/dpctex/issues/15>
| * XeLaTeX cannot use preamble cache at all. The reason is
| intrinsic in XeLaTeX, so preview-latex can't help.
| * LuaLaTeX works with preamble cache only when the preamble is
| simple enough, i.e., when it doesn't load opentype fonts and
| it doesn't use lua codes in preamble.
`----
But I don't think the current case falls into these exceptional cases. :-(
Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
[1] https://www.gnu.org/software/auctex/manual/preview-latex/Keys-and-lisp.html