Subject: Re: bug#36522: 12.1.2; Cannot preview document with TeX-engine: luatex

From: Ikumi Keita <[email-masked]>
Date: Tue, 09 Jul 2019 16:42:30 +0900

[ I resend this message because I missed to include
[email-masked] in Cc: header.  Luke, please keep this address in
Cc: when you reply. ]

Hi Luke,

>>>>> Luke Lau <[email-masked]> writes:
> I noticed that the command used to run lualatex is always:

> Running `Preview-LaTeX' on `test' with ``lualatex --jobname=test  -file-line-error   "\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.tex "}}”''

> I’m not seeing the -ini option passed to it, as seems to be set up here? http://git.savannah.gnu.org/cgit/auctex.git/tree/preview.el.in#n3283

> Could this be causing it to skip the DVI file?

I don't think so.  The difference is just a result of your answer to
"Cache preamble?" question.  You can toggle the state by C-c C-p C-f and
C-c C-p C-c C-f.

And now I think I figured out the reason.  Comparing your log and mine
in detail, I noticed that your run of lualatex didn't load luatex85.sty:
,----[ your log ]
| (/Users/luke/.emacs.d/elpa/auctex-12.1.2/latex/preview.sty (/Users/luke/.emacs.d/elpa/auctex-12.1.2/latex/prtightpage.def) (/Users/luke/.emacs.d/elpa/auctex-12.1.2/latex/prauctex.def
| No auxiliary output files.
| 
| 
| (/Users/luke/.emacs.d/elpa/auctex-12.1.2/latex/prauctex.cfg)) (/Users/luke/.emacs.d/elpa/auctex-12.1.2/latex/prfootnotes.def)
| Preview: Fontsize 10pt
| )
`----
,----[ my log ]
| (/usr/local/texlive/texmf-local/tex/latex/preview/preview.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/luatex85/luatex85.sty) (/usr/local/texlive/texmf-local/tex/latex/preview/prtightpage.def) (/usr/local/texlive/texmf-local/tex/latex/preview/prauctex.def
| No auxiliary output files.
| 
| 
| (/usr/local/texlive/texmf-local/tex/latex/preview/prauctex.cfg)) (/usr/local/texlive/texmf-local/tex/latex/preview/prfootnotes.def)
| Preview: Fontsize 10pt
| Preview: PDFoutput 1
| )
`----

I suppose that the lack of luatex85.sty made preview.sty unaware that
the current engine (luatex) produces PDF instead of DVI, which led to
the absence of "Preview: PDFoutput 1" in your log.  Without this tag,
preview-latex expects DVI output and uses dvips.

What does the command
kpsewhich luatex85.sty
outputs?  On my machine, it looks like this:
~> kpsewhich luatex85.sty
/usr/local/texlive/2019/texmf-dist/tex/generic/luatex85/luatex85.sty
If you get null result, then I suppose that basic-tex 2019 does not
contain luatex85.sty.

In that case, download luatex85 package from
https://www.ctan.org/pkg/luatex85
and install it in your personal texmf tree.  Then preview-latex will
work well.

Regards,
Ikumi Keita