Tôi đã được tinh chỉnh với mã mẫu bên dưới. Tài liệu cho MathJax không hoàn chỉnh lắm. Có thể một người nào đó nhiều kinh nghiệm cho biết làm thế nào tôi nên sửa đổi các mã dưới đây để Tex chỉ phân tích cú pháp khi tôi đã xác định delimiters như $ \ alpha $. Tôi muốn làm cho nó hoạt động như trên math.stackexchange.Hiển thị MathJax động chỉ khi có dấu phân tách
<html>
<head>
<title>MathJax Dynamic Math Test Page</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [["$","$"],["\\(","\\)"]]
}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
</script>
</head>
<body>
<script>
//
// Use a closure to hide the local variables from the
// global namespace
//
(function() {
var QUEUE = MathJax.Hub.queue; // shorthand for the queue
var math = null; // the element jax for the math output.
//
// Get the element jax when MathJax has produced it.
//
QUEUE.Push(function() {
math = MathJax.Hub.getAllJax("MathOutput")[0];
});
//
// The onchange event handler that typesets the
// math entered by the user
//
window.UpdateMath = function (TeX) {
QUEUE.Push(["Text",math,"\\displaystyle{"+TeX+"}"]);
}
})();
</script>
<textarea id="MathInput" size="50" onkeyup="UpdateMath(this.value)"></textarea>
<div id="MathOutput">
You typed: ${}$
</div>
</body>
</html>
Lưu ý từ tương lai: cdn.mathjax.org sắp end-of-cuộc sống của mình, kiểm tra https: //www.mathjax.org/cdn-shutting-down/ cho các mẹo di chuyển. –