commit 64f237405ea19089420cf3cbe9dd418ec4a6c997
parent da8b1ea1ffeca0dfc457f0bfeaf72369588cc49a
Author: Davide P. Cervone <dpvc@union.edu>
Date: Wed, 28 Jan 2015 11:46:58 -0500
Merge branch 'issue1021' into develop. Issue #1021.
Diffstat:
1 file changed, 45 insertions(+), 0 deletions(-)
diff --git a/unpacked/extensions/TeX/noErrors.js b/unpacked/extensions/TeX/noErrors.js
@@ -299,6 +299,51 @@
});
+ /*******************************************************************
+ *
+ * Fix CommonHTML output
+ */
+
+ HUB.Register.StartupHook("CommonHTML Jax Config",function () {
+ HUB.Config({
+ CommonHTML: {
+ styles: {
+ ".MathJax_CHTML .noError": HUB.Insert({
+ "vertical-align": (HUB.Browser.isMSIE && CONFIG.multiLine ? "-2px" : "")
+ },CONFIG.style)
+ }
+ }
+ });
+ });
+
+ HUB.Register.StartupHook("CommonHTML Jax Ready",function () {
+ var MML = MathJax.ElementJax.mml;
+ var CHTML = MathJax.OutputJax.CommonHTML;
+ var HTML = MathJax.HTML;
+
+ var MATH = MML.math.prototype.toCommonHTML,
+ MERROR = MML.merror.prototype.toCommonHTML;
+
+ //
+ // Override merror toHTML routine so that it puts out the
+ // TeX code in an inline-block with line breaks as in the original
+ //
+ MML.merror.Augment({
+ toCommonHTML: function (span) {
+ if (!this.isError) {return MERROR.call(this,span)}
+ span = this.CHTMLcreateSpan(span); span.className = "noError"
+ if (this.multiLine) {span.style.display = "inline-block"}
+ var text = this.data[0].data[0].data.join("").split(/\n/);
+ for (var i = 0, m = text.length; i < m; i++) {
+ HTML.addText(span,text[i]);
+ if (i !== m-1) {HTML.addElement(span,"br",{isMathJax:true})}
+ }
+ return span;
+ }
+ });
+
+ });
+
/*******************************************************************/
HUB.Startup.signal.Post("TeX noErrors Ready");