bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54200: 13.0.14; Preview incorrectly folds math environments with TeX


From: Ikumi Keita
Subject: bug#54200: 13.0.14; Preview incorrectly folds math environments with TeX-engine LuaTeX
Date: Wed, 09 Mar 2022 18:17:00 +0900

Hi Liam and David,

>>>>> David Kastrup <dak@gnu.org> writes:
> Liam Hupfer via bug-auctex via Bug reporting list for AUCTeX
> <bug-auctex@gnu.org> writes:

>> When I run `preview-buffer` on the attached file, I get a preview that
>> looks like "The probability of an initial subsequence of length 3",
>> where multiple math environments are folded into the "3" preview. If I
>> move the point over the preview, it unfolds and I can see the other
>> previews have been generated, but they are not visible due to the
>> incorrect folding. Any ideas?

When I try the provided sample with pdflatex, it works without problem.
However, when I change `TeX-engine' to use lualatex as the original
report of Liam did, the issue reproduces (TeX Live 2021).

It seems that the different outcomes come from subtle difference of the
format of log output:

Output of pdflatex
                                                  |Aligned
l.6 ...lity of an initial subsequence of length \(
                                                  n\) is \(2^{-n}\). For exa...
                                                  |

Output of lualatex
                                                    |Not aligned
l.6 ...bility of an initial subsequence of length \(
                                                  n\) is \(2^{-n}\). For exa...
                                                  |

As can be seen in the above quotes, the log message from lualatex is two
characters long in the first line than pdflatex, which breaks alignment
of the two lines. This hinders the parse by `preview-parse-messages'.
The relavant portion is:
----------------------------------------------------------------------
                                   (and (re-search-forward "\
^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\(?:\\^*\\(?:[89a-f][0-9a-f]\\|[]@-\\_?]\\)\\|\
\[0-9a-f]?\\)\\)?\\([^\n\r]*?\\)\r?
\\([^\n\r]*?\\)\\(\\(?:\\^+[89a-f]?\\)?\\.\\.\\.\\)?\r?$" nil t)
                                        (string-to-number (match-string 1))))
                            ;; And a string of the context to search for.
                            string (and line (match-string 3))
                            after-string (and line (buffer-substring
                                                    (+ (match-beginning 4)
                                                       (- (match-end 3)
                                                          (match-beginning 0)))
                                                    (match-end 4)))
----------------------------------------------------------------------
This code assumes that the two lines in question are aligned to obtain
`after-string'. I confirmed that it works for lualatex when I modify the
code as:
----------------------------------------------------------------------
                            after-string (and line (buffer-substring
                                                    (+ (match-beginning 4)
                                                       -2 ;; Ad-hock hack
                                                       (- (match-end 3)
                                                          (match-beginning 0)))
                                                    (match-end 4)))
----------------------------------------------------------------------

David, can you tell which is responsible for these superfluous two
characters, preview.sty or lualatex itself?

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine





reply via email to

[Prev in Thread] Current Thread [Next in Thread]