Ask HN: What editor for LaTeX notes do you use?
6 comments
> 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/
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
- 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.
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.
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".
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".
1. Document is some plain text format with inline LaTeX support, e.g. Markdown with LaTeX or Org mode.
2. Editor provides a live, inline preview while you are typing, including LaTeX.
3. Plugin available for LaTeX shortcuts.
I am not a fan of side-by-side source and rendered PDF; on large documents it can be hard to find your place in the LaTeX soup. That's why I want the preview to be inline.
I have tried Obsidian, emacs org-mode, and Joplin.
Obsidian: - With the more complicated stuff, MathJax is limiting and not configurable (e.g. lack of diagrams or packages). This is the main reason I want to move away.
- Weird notion of vaults, for some reason Obsidian insists on being special. Why can't I open any file with Obsidian? The file explorer pane is garbage compared to what you'd find in VSCode.
- Latex Suite plugin is nice for custom LaTeX shortcuts.
- I have also had some serious papercuts where everything looked fine in the live preview and then has errors in the PDF export. New problem I've been having is that occasionally on export, some symbols are blank. Exporting again usually fixes it.
emacs org-mode:
- There is no live, inline LaTeX preview. Best I could find was emacs-webkit-katex-render[0], but it's basically creating a webkit widget and rendering KaTeX. It's a completely separate renderer from the rest of org-mode-latex. Again it's not configurable and won't support LaTeX packages. I'm not sure if AUCTeX is even amenable to live previews, might be too slow. org-fragtog hides the fragment while you're editing so no live preview through that plugin either.
- cdlatex looks nice for shortcuts. Probably more powerful and more polished than Latex Suite for Obsidian, but haven't explored it fully yet.
Joplin: - I moved to Obsidian from Joplin originally. I don't think Joplin supports live previews for LaTeX, but this might have changed since I last used it.
So far I haven't found a program that's the best at all 3. As much as I hate bloated Electron apps, it seems as though the web people are the only ones who have figured out how to do live LaTeX previews. Is there better software out there for LaTeX than Obsidian?
[0] https://github.com/fuxialexander/emacs-webkit-katex-render