Subject: bug#35363: 12.1.2; Generation of previews fails under Windows 10

From: Ikumi Keita <[email-masked]>
Date: Mon, 29 Apr 2019 21:44:32 +0900

Hi Bernt,

>>>>> Bernt Guldbrandtsen <[email-masked]> writes:

> Should this feature be reported to the MiKTeX author as a bug, or
> should it be handled by modifying the relevant patterns in AUCTeX?

If my guess is correct, the simplest solution is to remove the MiKTeX
customize on the output format of latex log.  So I think that it would
be worth asking the MiKTeX author to do so.
However, I'm not 100% sure this is a bug of MiKTeX because the MiKTeX
author may have some good reason to customize the log format in such a
way.  In that case, solving this problem would not be so easy.
It requires that someone fluent at LaTeX programming in TeX language
(absolutely I'm not) revises preview.dtx so that the generated
preview.sty can output the necessary information even used under MiKTeX,
in order to use preview-latex in MiKTeX.

Just modifying the regular expression, discussed below, on AUCTeX side
helps almost nothing, because it doesn't make MiKTeX to output the key
ingredients like
l.6 \begin{displaymath}
which preview-latex needs in order to locate the position in the latex
document buffer to put the generated image.

Best regards,
Ikumi Keita

>> -----Original Message-----
>> I think that the reason of the fail is due to, at least partially, the log format
>> which MiKTeX produces.
>> 
>> -------- Bernt's log (by MikTeX) -------- ...
>> _region_.tex:9: Preview: Snippet 1 started
>> Preview: Tightpage -32891 -32891 32891 32891
>> _region_.tex:11: Preview: Snippet 1 ended.(1609687+0x22609920) ...
>> -----------------------------------------
>> 
>> -------- my log (by TeXLive) ------------ ...
>> ./tst-prv.tex:6: Preview: Snippet 1 started.
>> <-><->
>> 
>> l.6 \begin{displaymath}
>> 
>> Preview: Tightpage -32891 -32891 32891 32891
>> ./tst-prv.tex:8: Preview: Snippet 1 ended.(1609687+0x22609920).
>> <-><->
>> ...
>> -----------------------------------------
>> 
>> Compare the absence and presence of periods at the end of line of the
>> sentences "Snippet 1 {started,ended}".  Preview-latex searches in the log
>> message, in the function `preview-parse-messages', with the following regular
>> expression, which requires the period at the end of
>> line:
>> \\(?:Preview\\|Package Preview Error\\): Snippet \\([---0-9]+\\)
>> \\(started\\|ended\\(\ \\.? *(\\([---0-9]+\\)\\+\\([---0-9]+\\)x\\([---0-
>> 9]+\\))\\)?\\)\\."
>> 
>> In addition, Bernt's log lacks the information where to put the image in the latex
>> document buffer, which is embedded in my log as the line
>> l.6 \begin{displaymath}
>> 
>> Due to these two, at least, reasons, preview-latex cannot pick up necessary
>> information from the log messages.  I guess that MikTeX costomizes the log
>> output format of latex.  If this guess is correct, it would necessary for MikTeX to
>> discard that customize in order to use preview-latex with MikTeX.