Hello smart people! With all the talk about Emacs 29, I figured we should update Org Mode to use MathJax 3, to catch up with the rest of the world.
>From the documentation (for MathJax 3.0 released in 2019): > Version 3.0 of MathJax is a complete rewrite of MathJax from the > ground up, and its usage and configuration is significantly different > from that of MathJax version 2. In practice, MathJax 3.2 renders mathematics faster and better, plus it significantly improves LaTeX support. For instance, one can typeset calculus with the built-in (!) 'physics' package, like in LaTeX. More information on the recent progress (made in 2019-2021): https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.html https://docs.mathjax.org/en/latest/upgrading/whats-new-3.1.html https://docs.mathjax.org/en/latest/upgrading/whats-new-3.2.html See the attached [working, but WIP] patch. My question for you: How do we change the 'org-html-mathjax-options'? - 'scale' has now the value in [0, 1] and not in [0, 100] - 'scale' should exist as a number and not string - 'font' did not make it to MathJax 3 [*] - 'linebreaks' did not make it to MathJax 3 [*] - 'autonumber' has the values in lowercase now - 'autonumber' became 'tags' in MathJax terminology [*] coming in MathJax 4, currently in alpha How does Org mode approach these kind of breaking changes? Rudy
>From ca2eaf5bcc9ea01e764f6088e37d74ec2be6e426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salu...@me.com> Date: Fri, 7 Oct 2022 15:03:48 +0200 Subject: [PATCH] ox-html: Use MathJax 3 instead of 2.7 * lisp/ox-html.el (org-html-mathjax-options): WIP * lisp/ox-html.el (org-html-mathjax-template): WIP --- lisp/ox-html.el | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 9b77e4f8d..c6242d4bc 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1166,12 +1166,12 @@ See `format-time-string' for more information on its components." ;;;; Template :: Mathjax (defcustom org-html-mathjax-options - '((path "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML" ) - (scale "100") + '((path "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js") + (scale "1") ;; TODO: 0-1 AND NOT 0-100; NUMBER AND NOT STRING (align "center") - (font "TeX") - (linebreaks "false") - (autonumber "AMS") + (font "TeX") ;; TODO: NOT SUPPORTED + (linebreaks "false") ;; TODO: NOT SUPPORTED + (autonumber "ams") ;; TODO: NOW CALLED TAGS AND IN LOWERCASE (indent "0em") (multlinewidth "85%") (tagindent ".8em") @@ -1244,27 +1244,28 @@ For further information about MathJax options, see the MathJax documentation: (const "right"))))) (defcustom org-html-mathjax-template - "<script type=\"text/x-mathjax-config\"> - MathJax.Hub.Config({ - displayAlign: \"%ALIGN\", - displayIndent: \"%INDENT\", - - \"HTML-CSS\": { scale: %SCALE, - linebreaks: { automatic: \"%LINEBREAKS\" }, - webFont: \"%FONT\" - }, - SVG: {scale: %SCALE, - linebreaks: { automatic: \"%LINEBREAKS\" }, - font: \"%FONT\"}, - NativeMML: {scale: %SCALE}, - TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"}, - MultLineWidth: \"%MULTLINEWIDTH\", - TagSide: \"%TAGSIDE\", - TagIndent: \"%TAGINDENT\" - } -}); + "<script> + window.MathJax = { + tex: { + ams: { + multlineWidth: '%MULTLINEWIDTH' + }, + tags: '%AUTONUMBER', + tagSide: '%TAGSIDE', + tagIndent: '%TAGINDENT' + }, + chtml: { + scale: %SCALE, + displayAlign: '%ALIGN', + displayIndent: '%INDENT' + }, + svg: { + scale: %SCALE + } + }; </script> -<script src=\"%PATH\"></script>" + +<script id=\"MathJax-script\" async src=\"%PATH\"></script>" "The MathJax template. See also `org-html-mathjax-options'." :group 'org-export-html :type 'string) -- 2.37.3
-- "Mathematics takes us still further from what is human into the region of absolute necessity, to which not only the actual world, but every possible world, must conform." -- Bertrand Russell, 1902 Rudolf Adamkovič <salu...@me.com> [he/him] Studenohorská 25 84103 Bratislava Slovakia