Skip to content

Commit 64f2374

Browse files
committed
Merge branch 'issue1021' into develop. Issue #1021.
2 parents da8b1ea + 85f9612 commit 64f2374

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

unpacked/extensions/TeX/noErrors.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,51 @@
299299

300300
});
301301

302+
/*******************************************************************
303+
*
304+
* Fix CommonHTML output
305+
*/
306+
307+
HUB.Register.StartupHook("CommonHTML Jax Config",function () {
308+
HUB.Config({
309+
CommonHTML: {
310+
styles: {
311+
".MathJax_CHTML .noError": HUB.Insert({
312+
"vertical-align": (HUB.Browser.isMSIE && CONFIG.multiLine ? "-2px" : "")
313+
},CONFIG.style)
314+
}
315+
}
316+
});
317+
});
318+
319+
HUB.Register.StartupHook("CommonHTML Jax Ready",function () {
320+
var MML = MathJax.ElementJax.mml;
321+
var CHTML = MathJax.OutputJax.CommonHTML;
322+
var HTML = MathJax.HTML;
323+
324+
var MATH = MML.math.prototype.toCommonHTML,
325+
MERROR = MML.merror.prototype.toCommonHTML;
326+
327+
//
328+
// Override merror toHTML routine so that it puts out the
329+
// TeX code in an inline-block with line breaks as in the original
330+
//
331+
MML.merror.Augment({
332+
toCommonHTML: function (span) {
333+
if (!this.isError) {return MERROR.call(this,span)}
334+
span = this.CHTMLcreateSpan(span); span.className = "noError"
335+
if (this.multiLine) {span.style.display = "inline-block"}
336+
var text = this.data[0].data[0].data.join("").split(/\n/);
337+
for (var i = 0, m = text.length; i < m; i++) {
338+
HTML.addText(span,text[i]);
339+
if (i !== m-1) {HTML.addElement(span,"br",{isMathJax:true})}
340+
}
341+
return span;
342+
}
343+
});
344+
345+
});
346+
302347
/*******************************************************************/
303348

304349
HUB.Startup.signal.Post("TeX noErrors Ready");

0 commit comments

Comments
 (0)