Hello Timothy, I love what you and Karthink have done here!  Typesetting is so much faster now!  And the little nuggets like error reporting and intelligent sizing & coloring is so going to boost my org QoL.  Thank you so much for your work!

I've been trying this on and off for a few days now, and it works really well, except for one thing.  I'm using XeLaTeX, and whenever I typeset a LaTeX fragment containing a letter that sticks below the baseline (g, j, y, etc), the fragment is typeset too small, almost like subscripts.  It reproduces when this is the only setting I have:

(use-package org
    :ensure nil
    :custom
    (org-latex-compiler "xelatex") ;; drop this line and the issue goes away
)

Minimal 1-line org file to trigger the bug:
abc $d$ $y$ -- the y is typeset too small compared to abc.  The d is just the right size.

You mention in a separate email that XeLaTeX is known to cause hassles, but is this one of them?  I could migrate to PDFLaTeX, but I'd lose the convenience of editing with unicode-math.

On Sun, Mar 12, 2023 at 9:35 PM Timothy <orgmode@tec.tecosaur.net> wrote:
Hi All,

After months of work, Karthink and I have prepared a rather large patch-set
completely overhauling the LaTeX preview system. I hope to have a patch set
shortly, but in the mean time it would be good to get some more people testing
this.

To test this feature, please check out the `dev' branch of
<https://git.tecosaur.net/tec/org-mode.git> (it’s the default branch). There are
also some other changes there currently, but I don’t think anything is broken.

You can view the almost-ready path set/diff here:
<https://git.tecosaur.net/tec/org-mode/compare/c8401d2f..6d60738>, see the
ORG-NEWS and org-manual entries to get a bit more of an idea of what’s changed.
The short version is that now:
• Previews are generated in bulk, and hundreds of LaTeX fragments can be processed per second.
• Images are placed continuously as they are generated.
• Preview generation is asynchronous and will not block Emacs.
• Inline previews are aligned and scaled to match the font baseline and size.
• Previews scale along with text when the text scale is changed.
• Previews are coloured to match surrounding text and the active theme.
• SVG previews automatically change colors when the active theme changes.
• Error encountered when compiling LaTeX fragments can be accessed by mousing over preview images.
• Preview overlays can hide and show themselves dynamically based on cursor position.
• Org mode can auto-generate LaTeX previews as you type or edit the text of existing ones.
• Org mode can keep equation numbering consistent by regenerating previews as needed.

If you do come across any issues, please let me know either in a reply here or
the org-mode matrix room. If you could also run
<https://gist.github.com/karthink/0ac48411a81459c0f3fd7557c4e817db> and share the
diagnostic info, that would be quite helpful.

Lastly, Karthink has prepared a video giving an overview of the new
capabilities, you can give it a watch here:
<https://www.youtube.com/watch?v=n-AfvuV-bYo>

All the best,
Timothy

--
Timothy (‘tecosaur’/‘TEC’), Org mode contributor.
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/tec>.


--
Jun Inoue