Last active
August 21, 2020 19:45
-
-
Save dpvc/15c2f7a1234e01a898c1a8127f1156e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> | |
<title>Change Script Sizes</title> | |
<script type="text/x-mathjax-config"> | |
MathJax.Hub.Register.StartupHook("mml Jax Ready", function () { | |
var MML = MathJax.ElementJax.mml; | |
var math = MML.math.prototype.defaults; | |
var mstyle = MML.mstyle.prototype.defaults; | |
math.scriptsizemultiplier = mstyle.scriptsizemultiplier = .85; | |
}); | |
</script> | |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_SVG"></script> | |
</head> | |
<body> | |
Math with less script size reduction: | |
$$ | |
x^{x^{x^x}} | |
$$ | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> | |
<title>Change Script Sizes</title> | |
<script> | |
MathJax = { | |
startup: { | |
ready() { | |
const {MmlMath} = MathJax._.core.MmlTree.MmlNodes.math; | |
const {MmlMstyle} = MathJax._.core.MmlTree.MmlNodes.mstyle; | |
MmlMath.defaults.scriptsizemultiplier = MmlMstyle.defaults.scriptsizemultiplier = .85; | |
MathJax.startup.defaultReady(); | |
} | |
} | |
} | |
</script> | |
<script type="text/javascript" id="MathJax-script" async | |
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"> | |
</script> | |
</head> | |
<body> | |
Math with less script size reduction: | |
$$ | |
x^{x^{x^x}} | |
$$ | |
</body> | |
</html> |
Awesome, thank you! These different techniques are helpful to be able to get at MathJax internals with different permutations (browser/node and v2/3).
I notice they are given to users to provide workarounds before a new version is released. Is there a place that already has these techniques listed and if not, where would be the best place for me to add them? MathJax-docs, MathJax-demos-node, ... others?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@philschatz, OK here's the way to do it.
First, make a directory
extensions
in the folder with your mathjax-node program, and place a file calledscriptsizemultipler.js
in it that containsThen in your mathjax-node application, use
This will load your extension from the extensions folder. Then your
mjAPI.typeset()
calls should use the modified script sizes.Note that the file name used and the
loadComplete()
call must match up correctly. Let me know if you have any questions.