emacs-orgmode
[Top][All Lists]
Advanced

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

Using org-latex-preview in other major modes


From: Tony Zorman
Subject: Using org-latex-preview in other major modes
Date: Sun, 07 Apr 2024 09:22:36 +0200
User-agent: Notmuch/0.38.3, Emacs 30.0.50

Hi,

I'm interested in adjusting org-latex-preview to work in other major
modes (most notably LaTeX-mode itself, so one can get rid of preview.el).
On the advice of Karthik (Cc'd) I'll move the discussion from private
mails to this list, so more people who might be interested can join in.

I've prodded the code a little bit and, mostly just following [1],
managed to implement basic previews in a relatively straightforward
fashion. Attached is a proof-of-concept—aptly named
latex-latex-preview.el :) The main user facing functions so far are
'latex-latex-preview' to preview the maths fragment at point, and
'latex-latex-preview-region' to preview all fragments in a region. Both
functions currently ignore things like numbered equations and
environments, though both do not seem exceptionally difficult to add
back in.

There's also a stub 'latex-latex-preview-auto-mode' minor mode. Stepping
in and out of already rendered environments works fine, with the preview
being regenerated if needed; only the implementation of
'org-latex-preview-auto--regenerate-overlay' had to change for that. The
mode does not currently feature live-previews. The innards of
'org-latex-preview-auto--detect-fragments-in-change' and
'org-latex-preview-live--setup' look a bit more org-specific, with
queries to 'org-element-*' functions all over the place, but all of that
looks fixable—at least from afar. I will continue prodding the code a
little bit and will report back with any bumps that are hit along the
way.

  Tony

[1]: https://abode.karthinks.com/org-latex-preview/latex-preview-everywhere.html

Attachment: latex-latex-preview.el
Description: application/emacs-lisp

-- 
Tony Zorman | https://tony-zorman.com/

reply via email to

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