-
Notifications
You must be signed in to change notification settings - Fork 107
/
tex-mml.html
78 lines (76 loc) · 2.13 KB
/
tex-mml.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width">
<title>MathJax v3 with TeX input and MathML output</title>
<style>
mjx-container[display="block"] {
display: block;
margin: 1em 0;
}
</style>
<script>
MathJax = {
//
// Load only TeX input and the contextual menu
//
loader: {load: ['input/tex', 'ui/menu']},
//
// When page is ready:
// disable the assistive-mathml menu item
// render the document
//
startup: {
pageReady() {
MathJax.startup.document.menu.menu.findID('Accessibility', 'AssistiveMml').disable();
MathJax._.mathjax.mathjax.handleRetriesFor(() => MathJax.startup.document.render());
}
},
//
// Use dollar signs for in-line delimiters in addition to the usual ones
//
tex: {inlineMath: {'[+]': [['$', '$']]}},
//
// Override the usual typeset render action with one that generates MathML output
//
options: {
menuOptions: {
settings: {
assistiveMml: false
}
},
renderActions: {
assistiveMml: [], // disable assistive mathml
typeset: [150,
(doc) => {for (math of doc.math) {MathJax.config.renderMathML(math, doc)}},
(math, doc) => MathJax.config.renderMathML(math, doc)
]
},
menuOptions: {
settings: {
assistiveMml: false
}
}
},
//
// The action to use for rendering MathML
//
renderMathML(math, doc) {
math.typesetRoot = document.createElement('mjx-container');
math.typesetRoot.innerHTML = MathJax.startup.toMML(math.root);
math.display && math.typesetRoot.setAttribute('display', 'block');
}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/startup.js"></script>
</head>
<body>
<h1>MathJax MathML Output</h1>
<p>
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</p>
</body>
</html>