From: Ihor Radchenko <yantar92@posteo.net>
To: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Cc: Tony Zorman <mail@tony-zorman.com>, emacs-orgmode@gnu.org
Subject: Re: Using org-latex-preview in other major modes
Date: Thu, 10 Oct 2024 17:35:05 +0000 [thread overview]
Message-ID: <87o73rkgja.fsf@localhost> (raw)
In-Reply-To: <87a5fffmuc.fsf@gmail.com>
Karthik Chikmagalur <karthikchikmagalur@gmail.com> writes:
>> Abstracting away previews is certainly welcome.
>> RMS explicitly asked Org mode team to work towards this goal:
>> https://list.orgmode.org/E1kIkxv-0007iy-Av@fencepost.gnu.org/
>
> I recently spent some time on this feature (LaTeX previews in all
> major-modes) and produced a few prototypes. You can see some demos in
>
> https://www.youtube.com/watch?v=u44X_th6_oY [1]
Thanks!
Also, talking about calc previews... there is https://github.com/johnbcoughlin/calctex
> The way support for other major modes works right now is based on the
> following observation: The `org-latex-preview' feature uses a tiny
> subset of the `org-element' API. Specifically, it uses only the
> functions
>
> - `org-element-context'
> - `org-element-property', referring to the properties :value,
> :begin and :end, and optionally :post-blank and :post-affiliated
> - `org-element-type', which returns either latex-fragment,
> latex-environment or any other symbol
I think that it will be better to reuse thingatpt.el to retrieve object
boundaries: fragments and sections.
> In addition, it uses two functions to generate the preamble and find
> section bounds:
>
> - `org-latex-preview--get-preamble'
> - `org-latex-preview--section-bounds'
For preamble, we may simply use buffer-local variable.
Something like
(defvar-local latex-preview-make-preamble-function #'latex-preview-default-preamble ...)
Then, major modes may set it as needed.
--
Ihor Radchenko // yantar92,
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/yantar92>
next prev parent reply other threads:[~2024-10-10 17:38 UTC|newest]
Thread overview: 13+ 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-10-08 0:40 ` Karthik Chikmagalur
2024-10-10 17:35 ` Ihor Radchenko [this message]
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
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=87o73rkgja.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=karthikchikmagalur@gmail.com \
--cc=mail@tony-zorman.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).