emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using org-latex-preview in other major modes
@ 2024-04-07  7:22 Tony Zorman
  2024-04-07 11:59 ` Ihor Radchenko
  2024-04-07 17:48 ` Karthik Chikmagalur
  0 siblings, 2 replies; 13+ messages in thread
From: Tony Zorman @ 2024-04-07  7:22 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: karthikchikmagalur

[-- Attachment #1: Type: text/plain, Size: 1632 bytes --]

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 #2: latex-latex-preview.el --]
[-- Type: application/emacs-lisp, Size: 7445 bytes --]

[-- Attachment #3: Type: text/plain, Size: 44 bytes --]


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-10-10 17:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-07  7:22 Using org-latex-preview in other major modes Tony Zorman
2024-04-07 11:59 ` Ihor Radchenko
2024-04-07 18:06   ` Karthik Chikmagalur
2024-04-09 14:11     ` Ihor Radchenko
2024-10-08  0:40   ` Karthik Chikmagalur
2024-10-10 17:35     ` Ihor Radchenko
2024-04-07 17:48 ` Karthik Chikmagalur
2024-04-08  6:23   ` Tony Zorman
2024-04-08  6:36     ` Karthik Chikmagalur
2024-04-09 20:06       ` Tony Zorman
2024-04-21 19:10         ` Tony Zorman
2024-04-22  3:41           ` Karthik Chikmagalur
2024-04-22  9:29             ` Tony Zorman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).