Subject: bug#62445: 13.1.10; bug in preview-region applied to repeated math environments

From: Paul Nelson <[email-masked]>
Date: Sat, 25 Mar 2023 17:45:52 +0100

Thanks for your response.  Here is my complete *_region_ output* for the
example I described.  -file-line-error already seems to be included.
Please let me know if I missed something.

Running `Preview-LaTeX' on `~/doit/_region_' with ``pdflatex
 -file-line-error   --synctex=1
"\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes,showlabels]{preview}[2004/11/05]\fi}"
"\input" "\detokenize{" _region_.tex "}"''
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded
format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
No auxiliary output files.

(./_region_.tex  !name(test.tex)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amscls/amsart.cls
Document Class: amsart 2017/10/31 v2.20.4
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
No file _region_.aux.
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/preview.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/luatex85/luatex85.sty)
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prtightpage.def)
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prauctex.def
No auxiliary output files.

(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prauctex.cfg))
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prfootnotes.def)
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prshowlabels.def)
Preview: Fontsize 10pt
Preview: PDFoutput 1
) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsb.fd)
 !name(test.tex) !offset(-2)
./_region_.tex:5: Preview: Snippet 1 started.
<-><->

l.5 $
     x$
Preview: Tightpage -32891 -32891 32891 32891
./_region_.tex:5: Preview: Snippet 1 ended.(282168+0x374556).
<-><->

l.5 $x$

[1{/usr/local/texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
 !name(test.tex) !offset(-4)
\newlabel{tocindent-1}{0pt}
\newlabel{tocindent0}{0pt}
\newlabel{tocindent1}{0pt}
\newlabel{tocindent2}{0pt}
\newlabel{tocindent3}{0pt}
 )
(see the transcript file for additional
information)</usr/local/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb>
Output written on _region_.pdf (1 page, 8292 bytes).
SyncTeX written on _region_.synctex.gz.
Transcript written on _region_.log.

TeX Output exited as expected with code 1 at Sat Mar 25 17:42:58
Running `Preview-PDF2DSC' with ``pdf2dsc _region_.pdf
_region_.prv/tmpAnnFJy/preview.dsc''

Preview-PDF2DSC finished at Sat Mar 25 17:42:58
Running `Preview-Ghostscript' with ``/usr/local/bin/gs
-sOutputFile\=_region_.prv/tmpAnnFJy/pr1-\%d.pbm -q -dNOPAUSE -dNOSAFER
-DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4
-sDEVICE\=pnmraw -r238.169x239.282''

Preview-Ghostscript finished at Sat Mar 25 17:42:58

On Sat, Mar 25, 2023 at 5:41 PM David Kastrup <[email-masked]> wrote:

> Paul Nelson <[email-masked]> writes:
>
> > Emacs  : GNU Emacs 29.0.50 (build 3, x86_64-apple-darwin21.6.0, NS
> > appkit-2113.60 Version 12.6 (Build 21G115))
> >  of 2022-11-06
> > Package: 13.1.10
> >
> > Take the following document:
> >
> > #+begin_src latex
> > \documentclass{amsart}
> > \begin{document}
> >  $x$ $x$
> > \end{document}
> > #+end_src
> >
> >
> > Run ~preview-region~ on the region consisting of the first $x$.  This
> works
> > as expected.
> >
> > Next, run ~preview-region~ on the region consisting of just the second
> > $x$.  This does not preview the second $x$.  Instead, it refreshes the
> > overlay on the first $x$.
> >
> > The relevant output:
> >
> > #+begin_quote
> > ./_region_.tex:5: Preview: Snippet 1 started.
> > <-><->
> >
> > l.5 $
> >      x$
> > Preview: Tightpage -32891 -32891 32891 32891
> > ./_region_.tex:5: Preview: Snippet 1 ended.(282168+0x374556).
> > <-><->
> >
> > l.5 $x$
> >
> > #+end_quote
> >
> >
> > The issue here is that there's not enough context for
> > ~preview-parse-messages~ to determine which $x$ to overlay.
>
> I'd just add -file-line-error to the options you are calling TeX with.
> That makes for more reliable error message interpretation.
>
> --
> David Kastrup
>