;; ----------------------------------------------------------------------------- ;; https://www.gnu.org/software/emacs/manual/html_node/org/Math-formatting-in-HTML-export.html ;; https://orgmode.org/manual/Math-formatting-in-HTML-export.html ;; https://emacs.stackexchange.com/questions/31271/siunitx-mathjax-org-mode-and-html-export ;; https://stackoverflow.com/questions/49300667/which-mathjax-cdn-script-should-be-used ;; modify path and mathml (setq org-html-mathjax-options '((path "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML") (scale "100") (align "center") (indent "2em") (mathml t))) (setq org-html-mathjax-template " ") ;; ----------------------------------------------------------------------------- ;; https://www.reddit.com/r/orgmode/comments/7u2n0h/tip_for_defining_latex_macros_for_use_in_both/ (add-to-list 'org-src-lang-modes '("latex-macros" . latex)) (defvar org-babel-default-header-args:latex-macros '((:results . "raw") (:exports . "results"))) (defun prefix-all-lines (pre body) (with-temp-buffer (insert body) (string-insert-rectangle (point-min) (point-max) pre) (buffer-string))) (defun org-babel-execute:latex-macros (body _params) (concat (prefix-all-lines "#+LATEX_HEADER: " body) "\n#+HTML_HEAD_EXTRA:
\\(\n" (prefix-all-lines "#+HTML_HEAD_EXTRA: " body) "\n#+HTML_HEAD_EXTRA: \\)
\n")) ;; Example: ;; #+BEGIN_SRC latex-macros ;; \newcommand{\Z}{\mathbb{Z}} ;; \newcommand{\Hom}{\mathrm{Hom}} ;; #+END_SRC (org-toggle-inline-images)