Prevent breaks right before a closing fence or right after an open fence.

This commit is contained in:
Davide P. Cervone 2012-02-08 18:05:07 -05:00
parent 5968ef8b74
commit 1f5b1854e5
4 changed files with 12 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
spacefactor: -100,
spaceoffset: 2,
spacelimit: 1, // spaces larger than this get a penalty boost
fence: 500
fence: 500,
close: 500
};
var ENDVALUES = {linebreakstyle: "after"};
@ -408,6 +409,9 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var penalty = Math.floor(offset / HTMLCSS.linebreakWidth * 1000);
if (penalty < 0) {penalty = PENALTY.toobig - 3*penalty}
if (values.fence) {penalty += PENALTY.fence}
if ((values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER &&
values.texClass === MML.TEXCLASS.OPEN) ||
values.texClass === MML.TEXCLASS.CLOSE) {penalty += PENALTY.close}
penalty += info.nest * PENALTY.nestfactor;
//
// Get the penalty for this type of break and

View File

@ -42,7 +42,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
spacefactor: -100,
spaceoffset: 2,
spacelimit: 1, // spaces larger than this get a penalty boost
fence: 500
fence: 500,
close: 500
};
var ENDVALUES = {linebreakstyle: "after"};
@ -365,6 +366,9 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var penalty = Math.floor(offset / SVG.linebreakWidth * 1000);
if (penalty < 0) {penalty = PENALTY.toobig - 3*penalty}
if (values.fence) {penalty += PENALTY.fence}
if ((values.linebreakstyle === MML.LINEBREAKSTYLE.AFTER &&
values.texClass === MML.TEXCLASS.OPEN) ||
values.texClass === MML.TEXCLASS.CLOSE) {penalty += PENALTY.close}
penalty += info.nest * PENALTY.nestfactor;
//
// Get the penalty for this type of break and