diff --git a/unpacked/extensions/toMathML.js b/unpacked/extensions/toMathML.js
index aae34f73a..8ea82e383 100644
--- a/unpacked/extensions/toMathML.js
+++ b/unpacked/extensions/toMathML.js
@@ -160,7 +160,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
if (annotation) {
if (nested) {data.unshift(space+" "); data.push(space+" ")}
data.unshift(space+" ");
- data.push(space+' '+jax.originalText+"");
+ var xmlEscapedTex = jax.originalText.replace(/([&<>])/g, function(item) {
+ return { '>': '>', '<': '<','&': '&' }[item]
+ });
+ data.push(space+' '+xmlEscapedTex+"");
data.push(space+" ");
}
return space+"<"+tag+attr+">\n"+data.join("\n")+"\n"+space+""+tag+">";