Note this project current only support mac & linux, NOT windows as a bug in jsonrpc.
It’s base on mathjax, refer mathjax for math formula related stuffs. Default math formula delimiters:
` | inline asciimath |
`` | block asciimath |
$ | inline latex |
$$ | block latex |
nodejs
- used to run mathjax, if not available simple installation refer: Installing Node.js
(straight-use-package '(prettify-math :host nil :repo "https://github.com/shaqtsui/prettify-math" :files (:defaults "mathjax-jsonrpc.js")))
- add melpa in init.el if not available
(require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize)
- command:
M-x package-refresh-contents RET
M-x package-install RET prettify-math RET
Enable in current buffer: M-x prettify-math-mode RET
, or globally: M-x global-prettify-math-mode RET
.
Code example in init.el:
(setq prettify-math-delimiters-alist
'(("$" tex)
("$$" tex block)
(("\\(" . "\\)") tex block)
("`" asciimath)
("``" asciimath block)))
(require 'prettify-math)
- on-fly image generate, no disk temp file
- Responsive style(foreground/background color, size) base on surrunding text.
- JIT render instead of AOT render, which can support large files.
- Not only to support latex math expression, but also asciimath expression, in future other may supported.
- prettify-math implemented as minor mode, make it works in all major modes.