webkit-katex-render: an instant Latex Previewer for Emacs
Demo
Please checkout the demo video.Preparation
You need emacs compiled withxwidget support.
If you are on mac OS, you can use brew to install it.
brew tap d12frosted/homebrew-emacs-plus
brew install emacs-plus --HEAD --with-xwidgetsIf you are on Linux, maybe you can follow this blog post.
Install
use-package
(use-package webkit-katex-render
:init
;; if you use doom-emacs
(setq webkit-katex-render--background-color (doom-color 'bg))
;; if you want to set a different path to the html client
(setq webkit-katex-render--client-path "PATH/TO/CLIENT.html")
;; if you want to add your customized ~math-at-point~ function
(setq webkit-katex-render--math-at-point-function 'function))- My config for
doom-emacs
(def-package! webkit-katex-render :load-path "~/Source/playground/emacs-webkit-katex-render"
:commands (webkit-katex-render-mode)
:config
(setq webkit-katex-render--background-color (doom-color 'bg)))Usage
M-x webkit-katex-render-modeto start the minor mode- Move your cursor to a latex fragment (in either org mode or latex-mode)
- Try look around and type equations!
