diff --git a/README.org b/README.org index f29a7b4..da6361f 100644 --- a/README.org +++ b/README.org @@ -1492,26 +1492,58 @@ LaTeX =BiBTeX= dialect for backwards compatibility. Listing LaTeX-section-label)))) #+end_src -*** [[https://gitlab.com/matsievskiysv/math-preview/-/blob/master/README.md][Math-preview]] :noexport: +*** [[https://gitlab.com/matsievskiysv/math-preview/-/blob/master/README.md][Math-preview]] :PROPERTIES: :CUSTOM_ID: sec:math-preview -:header-args:emacs-lisp: :tangle no :END: +[[https://gitlab.com/matsievskiysv/math-preview/-/blob/master/README.md][Math-preview]] uses [[https://docs.mathjax.org/en/latest/][Mathjax-3]] to display [[https://www.latex-project.org/][LaTeX]], [[https://www.w3.org/Math/][MathML]],and [[http://asciimath.org/][asciimath]] in Emacs +buffers with help of an external [[https://nodejs.org][node.js]] program. + #+caption[Configure =math-preview=]: #+caption: Configure =math-preview=. #+name: lst:configure-math-preview #+begin_src emacs-lisp (when (ensure-package-installation 'math-preview) (with-eval-after-load 'math-preview + ;; https://docs.mathjax.org/en/latest/input/tex/extensions/physics.html + (let ((physics (split-string " + abs absolutevalue acomm acos acosecant acosine acot acotangent + acsc admat anticommutator antidiagonalmatrix arccos arccosecant + arccosine arccot arccotangent arccsc arcsec arcsecant arcsin + arcsine arctan arctangent asec asecant asin asine atan atangent + bmqty bqty Bqty bra braket comm commutator cos cosecant cosh + cosine cot cotangent coth cp cross crossproduct csc csch curl dd + derivative det determinant diagonalmatrix diffd differential div + divergence dmat dotproduct dv dyad erf ev eval evaluated exp + expectationvalue exponential expval fderivative fdv flatfrac + functionalderivative grad gradient gradientnabla hypcosecant + hypcosine hypcotangent hypsecant hypsine hyptangent + identitymatrix Im imaginary imat innerproduct ip ket ketbra + laplacian ln log logarithm matrixdeterminant matrixel + matrixelement matrixquantity mdet mel mqty naturallogarithm norm + op order outerproduct partialderivative paulimatrix pb + pderivative pdv pmat pmqty Pmqty poissonbracket pqty Pr + principalvalue Probability pv PV qall qand qas qassume qc qcc + qcomma qelse qeven qfor qgiven qif qin qinteger qlet qodd qor + qotherwise qq qqtext qsince qthen qty quantity qunless qusing + rank Re real Res Residue sbmqty sec secant sech sin sine sinh + smallmatrixquantity smdet smqty spmqty sPmqty svmqty tan tangent + tanh tr Tr trace Trace va var variation vb vdot vectorarrow + vectorbold vectorunit vmqty vnabla vqty vu xmat xmatrix + zeromatrix zmat"))) + (cl-pushnew `("physics" . ,physics) + math-preview-tex-packages-autoload-packages)) + (setq math-preview-raise 0.5 + math-preview-scale 1 + math-preview-tex-default-packages '("autoload" "ams" "physics")) (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)) + (setq math-preview-command command) ;; https://stackoverflow.com/a/17509764 answers: ;; How to install an npm package from github directly? + (unless (file-directory-p "~/node_modules") + (make-directory "~/node_modules")) (cl-destructuring-bind (exit-code output) (shell-command-with-exit-code "npm" "install" "git+https://gitlab.com/matsievskiysv/math-preview.git")