> emacs org-mode: There is no live, inline LaTeX preview.
There is, but we haven't managed to merge it into Org mode yet because we (the feature authors) and the Org maintainer have been busy with other things.
Thanks! I followed the instructions to install it, they were super straight forward. This is exactly what I was looking for! Some notes:
- FYI there’s a typo in the docs of the sample use-package declaration, should be one dash instead of two in "org-latex-preview--mode”.
- Live preview works for me but only if I first do M-x org-latex-preview, it doesn’t do it automatically. Probably an issue of missing config on my end, but I haven't been able to figure it out yet.
- Unrelated issue is that org-cdlatex isn’t recognizing \begin{array} as math, e.g. it is inserting text mode latex there instead of math mode. No idea here, I don’t think I touched cdlatex from the built-in Doom Emacs version.
Unfortunately I’m out of time to spend configuring emacs… I’ll have to continue using Obsidian for now, but this is really cool! Hopefully I’ll have some time to come back to configuring emacs soon
> Live preview works for me but only if I first do M-x org-latex-preview, it doesn’t do it automatically.
Not an error on your end. Live previews for _new_ fragments are only supported when entering \[..\] and \(..\) delimiters, and not $..$ and $$..$$. With the latter you'll have to preview it manually once, and live previews will update from then on.
It's only a few lines of Elisp to implement in-line preview according to your preferred style. I DIY'd one myself: my choice is to work a paragraph level, alternating blocks of TeX source with in-line image outputs. All you need to do (at minimum) is slurp a text paragraph, pipe it into a TeX command, and glue the output back in with (insert-image) or one of its friends. All the basic text-editing commands are on hand, because Emacs' API treats image objects (almost) identically to plain text.
Whichever package you use, it should be reasonably simple to edit this aspect of its behavior.
This is a glue pattern I like to reuse on my personal setup, that pipes a text paragraph through a chain of scripts; accepts an image file as output; and displays that after its source paragraph, overwriting a previous image. UX for "this text evaluates to an image".
> emacs org-mode: There is no live, inline LaTeX preview.
There is, but we haven't managed to merge it into Org mode yet because we (the feature authors) and the Org maintainer have been busy with other things.
Here are some screencasts:
- https://share.karthinks.com/olp-auto-mode-env-1.mp4
- https://share.karthinks.com/olp-auto-mode-inline-1.mp4
Here's a longer explainer (this is part 2/2): https://www.youtube.com/watch?v=u44X_th6_oY
Here are instructions if you want to try the fork of Org mode that provides this feature: https://abode.karthinks.com/org-latex-preview/
Thanks! I followed the instructions to install it, they were super straight forward. This is exactly what I was looking for! Some notes:
- FYI there’s a typo in the docs of the sample use-package declaration, should be one dash instead of two in "org-latex-preview--mode”.
- Live preview works for me but only if I first do M-x org-latex-preview, it doesn’t do it automatically. Probably an issue of missing config on my end, but I haven't been able to figure it out yet.
- Unrelated issue is that org-cdlatex isn’t recognizing \begin{array} as math, e.g. it is inserting text mode latex there instead of math mode. No idea here, I don’t think I touched cdlatex from the built-in Doom Emacs version.
Unfortunately I’m out of time to spend configuring emacs… I’ll have to continue using Obsidian for now, but this is really cool! Hopefully I’ll have some time to come back to configuring emacs soon
> Live preview works for me but only if I first do M-x org-latex-preview, it doesn’t do it automatically.
Not an error on your end. Live previews for _new_ fragments are only supported when entering \[..\] and \(..\) delimiters, and not $..$ and $$..$$. With the latter you'll have to preview it manually once, and live previews will update from then on.
Fixed the typo, thank you for reporting it.
It's only a few lines of Elisp to implement in-line preview according to your preferred style. I DIY'd one myself: my choice is to work a paragraph level, alternating blocks of TeX source with in-line image outputs. All you need to do (at minimum) is slurp a text paragraph, pipe it into a TeX command, and glue the output back in with (insert-image) or one of its friends. All the basic text-editing commands are on hand, because Emacs' API treats image objects (almost) identically to plain text.
Whichever package you use, it should be reasonably simple to edit this aspect of its behavior.
Cool! I am still new to emacs. Would you be willing to share the elisp? Would be a nice starting point for me :)
https://peri.pages.dev/tex-notes-snippet
This is a glue pattern I like to reuse on my personal setup, that pipes a text paragraph through a chain of scripts; accepts an image file as output; and displays that after its source paragraph, overwriting a previous image. UX for "this text evaluates to an image".