Within my rails application I use mathjax (TEX-AMS_HTML) to render latex formulas.
When entering formulas in a comment I use the codecogs Equation Editor with TinyMCE.
My current mathjax config ontop of (TEX-AMS_HTML) is:
"HTML-CSS": {linebreaks: { automatic: true, width: "container" }},
displayAlign: "left",
extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"],
jax: ["input/TeX","output/HTML-CSS"],
TeX: { extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] },
tex2jax: { ignoreClass: "w1", processClass: "active|comments-content" }
My problem is that some formulas are not rendering out, consider the following:
\[ foo\textup{bar} \]
This renders foo \textup bar. I have also noticed some symbols rendering textually such as:
\[ \AE \SS \]
This would render \AE \SS instead of the appropriate symbols.
I have tried switching to SVG, adjusting inline/display settings and cannot solve this.
Anyone have some idea as to why this is happening?
EDIT: Here is a contained example
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Mathjax</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
"HTML-CSS": {linebreaks: { automatic: true, width: "container" }},
displayAlign: "left",
extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"],
jax: ["input/TeX","output/HTML-CSS"],
TeX: { extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] },
tex2jax: { ignoreClass: "w1", processClass: "active|comments-content" }
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="wrapper">
<div id="main">
<div class="w1">
<div class="comments-content">
<p>\[foo\textup{bar}\AE\SS\]</p>
<p>\[K_{E}=\frac{1}{2}m(\frac{80}{3.6})^{2}\]</p>
</div>
</div>
</div>
</div>
</body>
</html>
Which renders as: http://i.imgur.com/bUJXZPX.png
Notice that whilst mathjax is working and correctly renders the 2nd line, the first line of latex is not escaped.
EDIT2 (22/06/2017):
"Note from the future: cdn.mathjax.org is nearing its end-of-life, check mathjax.org/cdn-shutting-down for migration tips (and perhaps update your answer for future readers)" - Thanks to user Peter Krautzberger
Basically this means the cdn used in my code example will need to be replaced with a localised version of mathjax.
inlineMath: [["\[","\]"]
– gab06