-
LaTeX fragment preview implemented with three components:
-
kitty-gfx--org-latex-preview-advice: Around advice onorg-latex-previewthat bypasses the(display-graphic-p)guard. The image generation pipeline (latex + dvipng/dvisvgm) works fine in terminal -- only the entry point and display step assume a GUI. Handles C-u (clear region) and C-u C-u (clear buffer) prefix args. -
kitty-gfx--org-make-preview-overlay-advice: Around advice onorg--make-preview-overlaythat intercepts overlay creation. Instead of an Emacs image spec (which doesn't render in terminal), displays the generated PNG/SVG via our existing Kitty graphics pipeline. Tags the overlay withorg-overlay-type=org-latex-overlayso org's cleanup functions still find it. -
kitty-gfx--org-clear-latex-preview: Cleanup function that removes Kitty placements for LaTeX overlays, used by the preview advice for C-u prefix arg.
Test org file updated with LaTeX fragment examples. Byte-compiles and load-tests clean. Needs manual testing with dvipng or dvisvgm installed.
-
-
Previous Value Current Value Open
In Review
-
Verified working. All three test fragments render correctly:
- Inline: $E = mc^2$
- Display: integral equation with equation number
- Inline: summation formula
Required fixes beyond initial implementation:
clear-image-cacherequires GUI frame — suppressed withcl-letf- Terminal face attributes return
"unspecified-fg"which breaksorg-latex-color-format— forced concrete fallback colors (Black fg, Transparent bg)
-
Fixed in b60fcce. C-c C-x C-l now renders LaTeX fragments as images in terminal Emacs via Kitty graphics. Advises org-latex-preview, org--make-preview-overlay, and adds clear-preview support. User verified working.
-
Previous Value Current Value In Review
Closed
| Type |
New Feature
|
| Priority |
Major
|
| Assignees |
Not assigned
|
Reported by: pathemata (Reddit)
Add support for rendering LaTeX fragments in org-mode buffers using Kitty graphics. Currently org renders LaTeX fragments to PNG via dvipng/dvisvgm for GUI Emacs. In terminal Emacs with kitty-graphics-mode, these previews could be displayed using the same Kitty graphics pipeline.
Approach:
org-latex-preview(org 9.7+) ororg-toggle-latex-fragment(older)kitty-gfx-display-imageat the fragment locationRelated: nabla.nvim was mentioned as a reference for fancier math rendering in terminals (Unicode-based approach).