org-latex-instant-preview
Org-latex-instant-preview
provides instant preview of LaTeX snippets via MathJax outputed SVG. Unlike webkit-katex-render, this does not need xwidget support.
Dependencies
Installation
You can install MathJax-node-cli
via npm
:
npm install mathjax-node-cli
You need to set org-latex-instant-preview-tex2svg-bin
to the location of the executable tex2svg
.
Usage
As Minor Mode
(use-package org-latex-instant-preview
:defer t
:hook (org-mode . org-latex-instant-preview-mode)
:init
(setq org-latex-instant-preview-tex2svg-bin
;; location of tex2svg executable
"~/node_modules/mathjax-node-cli/bin/tex2svg"))
Or just enable minor mode org-latex-instant-preview-mode
manually when it is needed.
Manually
(use-package org-latex-instant-preview
:defer t
:init
(setq org-latex-instant-preview-tex2svg-bin
;; location of tex2svg executable
"~/node_modules/mathjax-node-cli/bin/tex2svg"))
Start Instant Preview
Put your cursur in some LaTeX fragment or some math environments, and invoke
(org-latex-instant-preview-send-latex)
When you make modifications, an instant preview will be regenerated when Emacs is idle for org-latex-instant-preview-delay
seconds. The preview will NOT be updated when you move your cursor to another LaTeX snippet, but it will be updated if you make some modification to the new snippet. If you do want to update previews instantly when your cursor moves, check Experimental Usage.
Stop Instant Preview
(org-latex-instant-preview-stop)
Customization
Delay Time Before Re-compilation
Custom org-latex-instant-preview-delay
to change the number of seconds to wait before re-compilation after Emacs is idle.
tex2svg
Executable
Location of org-latex-instant-preview-tex2svg-bin
License
This piece work is licensed under UNLICENSE.