Install and configure the math-preview package

This commit is contained in:
Gerard Vermeulen 2022-02-27 10:41:31 +01:00
parent 3ab1d0de4b
commit ca47cf5cb7

View File

@ -215,6 +215,7 @@ the ~custom-file~ as [[info:emacs#Saving Customizations][saving customizations (
magit ; Git Text-based User Interface
marginalia ; minibuffer margin notes
markdown-mode ; markdown text mode
math-preview ; display LaTeX math with MathJax
no-littering ; keep `user-emacs-directory' clean
nov ; EPUB reader
orderless ; Emacs completion style
@ -1136,7 +1137,36 @@ advising to override ~TeX-brace-count-line~ with ~my-TeX-brace-count-line~.
(advice-add 'TeX-brace-count-line :override #'my-TeX-brace-count-line))
#+end_src
*** [[https://gitlab.com/matsievskiysv/math-preview/-/blob/master/README.md][Math-preview]]
:PROPERTIES:
:CUSTOM_ID: sec:math-preview
:END:
#+caption[Configure =math-preview=]:
#+caption: Configure =math-preview=.
#+name: lst:configure-math-preview
#+begin_src emacs-lisp
(with-eval-after-load 'math-preview
(let ((command (executable-find "~/node_modules/.bin/math-preview")))
(if command
(custom-set-variables
`(math-preview-command ,command)
'(math-preview-raise 0.5)
'(math-preview-scale 1))
;; https://stackoverflow.com/a/17509764 answers:
;; How to install an npm package from github directly?
(cl-destructuring-bind (exit-code output)
(shell-command-with-exit-code
"npm" "install" "git+https://gitlab.com/matsievskiysv/math-preview.git")
(if (= 0 exit-code) (message "%s" (string-trim output))
(error "%s" (string-trim output)))))))
#+end_src
*** TODO Improve the AUCTeX configuration slowly
:PROPERTIES:
:CUSTOM_ID: sec:configure-auctex-slowly
:END:
[[https://github.com/thisirs/dotemacs/blob/master/lisp/init-auctex.el][AUCTeX setup of an experienced user]]
** Writing Org files