From: "Rudolf Adamkovič" <salutis@me.com>
To: emacs-orgmode@gnu.org
Subject: Update Org to MathJax 3
Date: Fri, 07 Oct 2022 15:36:54 +0200 [thread overview]
Message-ID: <m2a667n4ax.fsf@me.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1371 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Use-MathJax-3-instead-of-2.7.patch --]
[-- Type: text/x-patch, Size: 2770 bytes --]
From ca2eaf5bcc9ea01e764f6088e37d74ec2be6e426 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@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
[-- Attachment #3: Type: text/plain, Size: 300 bytes --]
--
"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č <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
next reply other threads:[~2022-10-07 14:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 13:36 Rudolf Adamkovič [this message]
2022-10-08 7:20 ` Update Org to MathJax 3 Ihor Radchenko
2022-10-08 21:32 ` Rudolf Adamkovič
2022-11-05 0:20 ` [PATCH] " Rudolf Adamkovič
2022-11-05 12:01 ` Ihor Radchenko
2022-11-05 16:56 ` Rudolf Adamkovič
2022-11-05 22:44 ` Rudolf Adamkovič
2022-11-06 3:52 ` Ihor Radchenko
2022-11-06 23:49 ` Rudolf Adamkovič
2022-11-07 3:02 ` Ihor Radchenko
2022-11-07 20:56 ` Rudolf Adamkovič
2022-11-08 5:20 ` Ihor Radchenko
2022-11-08 23:37 ` Rudolf Adamkovič
2022-11-09 0:05 ` Rudolf Adamkovič
2022-11-09 5:40 ` Ihor Radchenko
2022-11-09 23:01 ` Rudolf Adamkovič
2022-11-10 2:34 ` Ihor Radchenko
2022-11-11 12:50 ` Rudolf Adamkovič
2022-11-13 4:24 ` Ihor Radchenko
2022-11-13 20:52 ` Rudolf Adamkovič
2022-11-14 4:33 ` Ihor Radchenko
2022-11-19 13:10 ` Bastien Guerry
2022-11-21 2:51 ` Ihor Radchenko
2022-11-22 20:56 ` Rudolf Adamkovič
2022-11-23 11:11 ` Ihor Radchenko
2022-11-23 23:08 ` Rudolf Adamkovič
2022-11-09 2:49 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2a667n4ax.fsf@me.com \
--to=salutis@me.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.