|
299 | 299 |
|
300 | 300 | });
|
301 | 301 |
|
| 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 | + |
302 | 347 | /*******************************************************************/
|
303 | 348 |
|
304 | 349 | HUB.Startup.signal.Post("TeX noErrors Ready");
|
|
0 commit comments