Ikumi: Thanks for the quick turnaround on a patch. 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.
---- 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 ---- But if I just do it again, it works the second time through. ---- TeX Output exited as expected with code 1 at Mon Jun 13 12:07:00 Running `Preview-PDF2DSC' with ``pdf2dsc build/_region_.pdf build/_region_.prv/tmp319934yU/preview.dsc'' Preview-PDF2DSC finished at Mon Jun 13 12:07:00 Running `Preview-Ghostscript' with ``/usr/local/bin/gs -sOutputFile\=build/_region_.prv/tmp319934yU/pr1-\%d.png -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r121.447x121.645'' Preview-Ghostscript finished at Mon Jun 13 12:07:00 ---- 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. Fortunately, there is an easy workaround for now: don’t cache the preamble. Michael > On Jun 13, 2022, at 5:08 AM, Ikumi Keita <[email protected]> wrote: > > [EXTERNAL SENDER] > > [ Cc: Al Haji-Ali ] > > Hi Michael, > >>>>>> "Braun, Michael" <[email protected]> writes: >> I just upgraded to AucTeX 13.1.3, and want to use the new feature of >> putting intermediate and preview files in a subdirectory. So I set >> TeX-output-dir to “build”, and all works well for compiling pdf >> documents with the default and LuaTeX engines, and all preview >> functions with the default engine. With luatex, preview-document also >> works. But if TeX-engine is luatex, and I run preview-at-point or >> preview-buffer, I get the following error: >> Running `Preview-LaTeX' on `~/Documents/build/_region_' with ``lualatex >> --jobname=build/_region_ -file-line-error --output-directory="build/" >> --synctex=1 >> "\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{" _region_.tex "}"'' >> This is LuaHBTeX, Version 1.15.0 (TeX Live 2022) >> restricted system commands enabled. >> LaTeX2e <2022-06-01> pre-release-0 (develop 2022-6-12 branch) >> L3 programming layer <2022-06-02> >> No auxiliary output files. > >> ./build//_region_.tex:0: I can't write on file `build/_region_.log'. >> Please type another transcript file name >> ./build//_region_.tex:0: Emergency stop >> ./build//_region_.tex:0: ==> Fatal error occurred, no output PDF file >> produced! >> TeX Output exited as expected with code 1 at Sun Jun 12 16:42:15 >> LaTeX: LaTeX found no preview images > >> There is a build subdirectory, and in it there is a _region_.tex file, >> but no _region_.log file is generated. The error occurs whether or not >> I cache the preamble. If TeX-output-dir is nil, everything works well, >> as expected. > >> Here’s a minimal working example that generates the error. > >> ----- >> \documentclass{article} >> \begin{document} > >> test $\alpha + \beta$. %% preview should appear here. > >> \end{document} > >> % Local Variables: % >> % TeX-engine: luatex % >> % TeX-output-dir: "build" % >> % End: % >> —— > >> Any idea about what’s going on, and/or how to fix this? > > Thanks for your report. When TeX-output-dir option is enabled, > preview-latex have to omit subdirectory name from the parameter > "--jobname" in invocation of lualatex, which wasn't implemented. > > I think the attached patch fixes the problem. I'd like you to test it if > possible. > > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine > > <0001-Fix-region-preview-with-TeX-output-dir-feature.patch>
