How to configure mathjax?
I want to configure the mathjax with the following scripts:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], linebreaks: { automatic:true }, EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50) },tex2jax: { inlineMath: [ ["$", "$"], ["\\(","\\)"] ], displayMath: [ ["$$","$$"], ["\\[", "\\]"] ], processEscapes: true, ignoreClass: "tex2jax_ignore|dno",skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']},TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } }, Macros: { href: "{}" } },messageStyle: "none"}); </script>
<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}});
</script>
Where to do this configuration? I add this configuration to page.st, but it seems to be not correct.
You could put this in one of the page templates (see the
manual). Or you could adjust mathjax-script in your
config file to point to a local installation of MathJax
with these settings.
I put the following script in page.st
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
</script>
When I gitit in the terminal and view the source of a page, the above script is interpreted into
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ [','], ["\(","\)"] ], displayMath: [ ['',''], ["\[","\]"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
</script>
That is, some $ and \ are missing.
You need to escape $ and \ as $ and \ in page templates. (At least, that's my recollection - see the documentation.)
+++ Edenharder [Dec 21 15 00:40 ]:
I put the following script in page.st
When I gitit in the terminal and view the source of a page, the above script is interpreted into
That is, some $ and \ are missing.
— Reply to this email directly or [1]view it on GitHub.
References
- https://github.com/jgm/gitit/issues/524#issuecomment-166233559
I have tried to escape $ and \ as \$ and \\ in page templates, and one also need to escape \ as \\ in each page (markdown files). Even so, there is some error.
\\[
A+\alpha
\\]
will output
A+
and the corresponding code in source file is <p>\[ A+\]</p>. That is, every tex command following \ will be eaten by the interpreter.
If your page format is Markdown, then use $$ for display math.
+++ Edenharder [Dec 21 15 17:11 ]:
I have tried to escape $ and \ as $ and \ in page templates, and one also need to escape \ as \ in each page (markdown files). Even so, there is some error. [ A+\alpha ]
will output A+ and the corresponding code in source file is
[ A+]
. That is, every tex command following \ will be eaten by the interpreter.— Reply to this email directly or [1]view it on GitHub.
References
- https://github.com/jgm/gitit/issues/524#issuecomment-166471146
Thanks. I know $$ will work, but I'd like to use \[ and \].
[ and ] have other meanings in Markdown; they are escaped square brackets, and we need to keep this meaning.
+++ Edenharder [Dec 21 15 20:00 ]:
Thanks. I know $$ will work, but I'd like to use [ and ].
— Reply to this email directly or [1]view it on GitHub.
References
- https://github.com/jgm/gitit/issues/524#issuecomment-166499954