Preview LaTeX in Org Mode with Emacs in MacOS
Contents
Using the right Emacs Version
I failed to preview LaTeX with emacs-plus. If you have installed d12frosted/emacs-plus, uninstall it and use emacs-mac.
brew tap railwaycat/emacsmacport
brew install emacs-mac
If you like the fancy spacemacs icon, install it with cask: brew cask install emacs-mac-spacemacs-icon
Install Tex
- Download and install BasicTeX.pkg here.
- Add
/Library/TeX/texbinto PATH. - Install
dvisvgmbysudo tlmgr update --self && sudo tlmgr install dvisvgm collection-fontsrecommended
Emacs settings
- Add TeX related bin to path:
(setenv "PATH" (concat (getenv "PATH") ":/Library/TeX/texbin")) - Tell Org Mode to create svg images:
(setq org-latex-create-formula-image-program 'dvisvgm)
Now you can see the rendered LaTeX equation by calling org-preview-latex-fragment or using shortcut ,Tx.
If you want to load LaTeX previews automatically at startup, add this at the beginning of org file: #+STARTUP: latexpreview.
update 31-07-19
_and...are not displayed in Emacs, as some fonts are missing.tlmgr install collection-fontsrecommendedshould fix this.If
Org Preview Latexbuffer output warnprocessing of PostScript specials is disabled (Ghostscript not found), runbrew install ghostscript.