Subject: bug#65628: Document preview fails with long filenames

From: John Holman <[email-masked]>
Date: Thu, 31 Aug 2023 09:13:23 +0100

Hi Ikumi

Many thanks - your suggestion to use the customize option to add
--max-print-line=1000 to the pdflatex command line works at least for the
current test case.
Adding -max-print-line=1000 - one hyphen rather than two - also works.
Perhaps auctex should be changed to add this as standard, since  bug#27088
suggests it could occur in various contexts?

Resulting output:

Running `Preview-LaTeX' on `012345678901234546789012' with ``pdflatex
 -file-line-error    -max-print-line=1000
"\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{" "012345678901234546789012.tex" "}"''
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (MiKTeX 23.5) (preloaded
format=pdflatex.fmt)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-11>

No auxiliary output files.

(012345678901234546789012.tex
(C:\Users\johng\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(C:\Users\johng\AppData\Local\Programs\MiKTeX\tex/latex/base\size10.clo))
(C:\Users\johng\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def)
No file 012345678901234546789012.aux.
(c:/Users/johng/.emacs.d/elpa/auctex-13.2.1/latex\preview.sty
(C:\Users\johng\AppData\Local\Programs\MiKTeX\tex/latex/luatex85\luatex85.sty)
(c:/Users/johng/.emacs.d/elpa/auctex-13.2.1/latex\prtightpage.def)
(c:/Users/johng/.emacs.d/elpa/auctex-13.2.1/latex\prauctex.def
No auxiliary output files.

(c:/Users/johng/.emacs.d/elpa/auctex-13.2.1/latex\prauctex.cfg))
(c:/Users/johng/.emacs.d/elpa/auctex-13.2.1/latex\prfootnotes.def)
Preview: Fontsize 10pt
Preview: PDFoutput 1
)
012345678901234546789012.tex:4: Preview: Snippet 1 started.
<-><->

l.4 \(
      x=y\)
Preview: Tightpage -32891 -32891 32891 32891
012345678901234546789012.tex:4: Preview: Snippet 1
ended.(282168+127431x1593186).
<-><->

l.4 \(x=y\)

[1{C:/Users/johng/AppData/Local/MiKTeX/fonts/map/pdftex/pdftex.map}] )
(see the transcript file for additional
information)<C:/Users/johng/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmmi10.pfb><C:/Users/johng/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on 012345678901234546789012.pdf (1 page, 17918 bytes).
Transcript written on 012345678901234546789012.log.

TeX Output exited as expected with code 1 at Thu Aug 31 09:08:27
Running `Preview-PDF2DSC' with ``pdf2dsc "012345678901234546789012.pdf"
"012345678901234546789012.prv/tmpU0X9fd"/preview.dsc''

Preview-PDF2DSC finished at Thu Aug 31 09:08:27
Running `Preview-Ghostscript' with
``"c:/Users/johng/AppData/Local/Programs/MiKTeX/miktex/bin/x64/rungs.exe"
^"-sOutputFile=012345678901234546789012.prv/tmpU0X9fd/pr1-^%d.png^" "-q"
"-dDELAYSAFER" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted" "-dTextAlphaBits=4"
"-dGraphicsAlphaBits=4" "-sDEVICE=png16m" "-r106.74x106.68"''

Preview-Ghostscript finished at Thu Aug 31 09:08:28

On Thu, 31 Aug 2023 at 06:21, Ikumi Keita <[email-masked]> wrote:

> Hi John,
>
> >>>>> John Holman <[email-masked]> writes:
>
> > Document preview works when the filename has no more than 22 characters,
> > e.g. test.tex, but fails with message "Ghostscript filter: No bounding
> box"
> > when the filename has more, e.g. 01234567890123456789012.tex. However
> > buffer preview always works.
>
> I think the origin of this issue is the same as bug#27088:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27088
>
> The log you provided seems to have extra line break discussed in the
> above bug record thread:
> > The contents of the *.. output* buffer are then
>
> > 012345678901234546789012.tex:4: Preview: Snippet 1
> > ended.(282168+127431x1593186
> > ).
> > <-><->
>
> > l.4 \(x=y\)
>
> As I corrected in the above thread, MikTeX doesn't see the environment
> variable max_print_line unfortunately and you can try one of the
> following two options:
> (1) Add command line option --max-print-line=1000 to latex.
>     I expect you can use the customize option `preview-LaTeX-command'
>     for that purpose.
> (2) Edit the MikTeX config file and modify max_print_line parameter.
>
> Regards,
> Ikumi Keita
> #StandWithUkraine #StopWarInUkraine
>