Karthik, thanks for the email, including those screencasts. You are
right, lualatex is too slow for use in generating previews.

Do you have any ideas about how we could improve the handling of utf-8
without sacrificing the speed of the preview system?

Leo

On Wed, Apr 02 2025, Pedro Andres Aranda Gutierrez <paag...@gmail.com> wrote:

> Thanks for the complete explanation. This is an argument with real weight
> and I fully understand.
> That lualatex is slower to start up is something even the overleaf.com
> people are struggling with.
>
> So we have to live with weak UTF.8 support w/preview versus good UTF-8
> support with sloooow preview
> (sigh)
>
> Maybe things improve in the future. At least we have had the next round of
> discussions and can take it from here
> if (or when) things get better in LuaLaTeX.
>
> Best, /PA
>
>
> On Wed, 2 Apr 2025 at 18:11, Karthik Chikmagalur <
> karthikchikmaga...@gmail.com> wrote:
>
>> > Let’s start the discussion. We need feedback on this.
>> >
>> > Pros and Contras of moving on to using lualatex as default compiler.
>>
>> Another vote for NOT changing the default from pdflatex.
>>
>> In the upcoming LaTeX preview feature rewrite, previews using lualatex
>> are 10-50x slower than previews with pdflatex.  pdflatex previews are
>> fast enough that you can get live updates as you type[1]:
>>
>> https://karthinks.com/img/olp-auto-mode-1.mp4
>> https://karthinks.com/img/olp-auto-mode-array.mp4
>> https://karthinks.com/img/olp-auto-mode-tikz.mp4
>>
>> When org-pdf-compiler is set to lualatex, the update time for a LaTeX
>> fragment goes from 0.3-0.6 seconds to 3-20 seconds, depending on the
>> size of the LaTeX preamble.  At that point LaTeX previews are more or
>> less useless for getting quick feedback on your edits, and the value of
>> using LaTeX previews goes down considerably.
>>
>> There are two reasons for this.
>>
>> 1. lualatex is slower to start up than pdflatex.  I have not measured
>> how much the difference is, but it's noticeable.
>> 2. lualatex does not support precompilation, as you cannot save lua
>> state or opentype fonts in the precompile dump.  This slows down
>> lualatex by a large factor.
>>
>> https://tex.stackexchange.com/questions/593723/lualatex-and-mylatexformat-precompiling-not-working
>>
>> We have tried some mitigations, including using pdflatex for LaTeX
>> previews but lualatex for exports (by introducing an
>> org-preview-pdf-compiler variable), but this does not work because of
>> the incompatibilities between LaTeX preambles created for pdflatex and
>> lualatex, and because of unicode characters in LaTeX fragments, etc.
>>
>> Users who are aware of this tradeoff or do not use org-latex-preview can
>> change org-latex-compiler to lualatex.  Most other users will only
>> notice that LaTeX previews don't work well and that LaTeX exports take
>> much longer than expected.
>>
>> Karthik
>>
>> [1]: org-latex-preview can extend to all of Emacs, providing live LaTeX
>> previews in all major modes, all of which will get much slower:
>> https://www.youtube.com/watch?v=u44X_th6_oY
>>

Reply via email to