emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tony Zorman <mail@tony-zorman.com>
To: Karthik Chikmagalur <karthikchikmagalur@gmail.com>,
	emacs-orgmode@gnu.org
Subject: Re: Using org-latex-preview in other major modes
Date: Tue, 09 Apr 2024 22:06:03 +0200	[thread overview]
Message-ID: <87cyqyqp1w.fsf@hyperspace> (raw)
In-Reply-To: <87y19oe4yd.fsf@gmail.com>

On Sun, Apr 07 2024 23:36, Karthik Chikmagalur wrote:
> You can ignore `org-latex-preview-live--src-buffer-setup', this is for
> previewing when using `org-edit-special' (C-c '), which does not apply
> to any other major mode.  So `org-latex-preview-live--ensure-overlay' is
> the only function you need to rewrite, which should be easy.

Oh, indeed, you are right; seems like it only looked intimidating! I
quickly hacked this in just now, and it works just fine.

As a very brief summary, one currently needs to—in addition to supplying
a preamble and a way to recognise maths and environments—patch the
following functions:

  · org-latex-preview--place-from-elements
  · org-latex-preview-auto--regenerate-overlay 
  · org-latex-preview-auto--maybe-track-element-here
  · org-latex-preview-live--ensure-overlay

The last two are only needed for the "live" part of the live previews to
work.

I will clean the code up a little bit (hopefully by the weekend, but no
promises), and try to add support for LaTeX environments instead of just
maths. I reckon that once this is finished one can get a pretty good
idea in which direction org-latex-preview.el would need to be nudged to
more easily facilitate this kind of integration. After that I guess
there's still the issue of caching and numbering, but I'll cross that
bridge once we get to it :)

  Tony

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


  reply	other threads:[~2024-04-09 20:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-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 [this message]
2024-04-21 19:10         ` Tony Zorman
2024-04-22  3:41           ` Karthik Chikmagalur
2024-04-22  9:29             ` Tony Zorman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cyqyqp1w.fsf@hyperspace \
    --to=mail@tony-zorman.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=karthikchikmagalur@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).