Skip to content

Commit 567d6ae

Browse files
committed
Allow nobreak to work past the width of the container. Resolves issue #1970.
1 parent c4eca32 commit 567d6ae

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

unpacked/jax/output/CommonHTML/autoload/multiline.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,10 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
669669
// Get the penalty for this type of break and
670670
// use it to modify the default penalty
671671
//
672-
var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO];
672+
var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]||0;
673673
if (!MathJax.Object.isArray(linebreak)) {
674-
// for breaks past the width, don't modify penalty
675-
if (offset >= 0) {penalty = linebreak * info.nest}
674+
// for breaks past the width, keep original penalty for newline
675+
if (linebreak || offset >= 0) {penalty = linebreak * info.nest}
676676
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
677677
//
678678
// If the penalty is no better than the current one, return false
@@ -715,13 +715,13 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
715715
// Get the penalty for this type of break and
716716
// use it to modify the default penalty
717717
//
718-
var linebreak = PENALTY[linebreakValue];
718+
var linebreak = PENALTY[linebreakValue]||0;
719719
if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit &&
720720
!this.mathbackground && !this.background)
721721
linebreak = [(w+PENALTY.spaceoffset)*PENALTY.spacefactor];
722722
if (!MathJax.Object.isArray(linebreak)) {
723-
// for breaks past the width, don't modify penalty
724-
if (offset >= 0) {penalty = linebreak * info.nest}
723+
// for breaks past the width, keep original penalty for newline
724+
if (linebreak || offset >= 0) {penalty = linebreak * info.nest}
725725
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
726726
//
727727
// If the penalty is no better than the current one, return false

unpacked/jax/output/HTML-CSS/autoload/multiline.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,10 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
686686
// Get the penalty for this type of break and
687687
// use it to modify the default penalty
688688
//
689-
var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO];
689+
var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]||0;
690690
if (!MathJax.Object.isArray(linebreak)) {
691-
// for breaks past the width, don't modify penalty
692-
if (offset >= 0) {penalty = linebreak * info.nest}
691+
// for breaks past the width, keep original penalty for newline
692+
if (linebreak || offset >= 0) {penalty = linebreak * info.nest}
693693
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
694694
//
695695
// If the penalty is no better than the current one, return false
@@ -733,13 +733,13 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
733733
// Get the penalty for this type of break and
734734
// use it to modify the default penalty
735735
//
736-
var linebreak = PENALTY[linebreakValue];
736+
var linebreak = PENALTY[linebreakValue]||0;
737737
if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit &&
738738
!this.mathbackground && !this.background)
739739
{linebreak = [(w+PENALTY.spaceoffset)*PENALTY.spacefactor]}
740740
if (!MathJax.Object.isArray(linebreak)) {
741-
// for breaks past the width, don't modify penalty
742-
if (offset >= 0) {penalty = linebreak * info.nest}
741+
// for breaks past the width, keep original penalty for newline
742+
if (linebreak || offset >= 0) {penalty = linebreak * info.nest}
743743
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
744744
//
745745
// If the penalty is no better than the current one, return false

unpacked/jax/output/SVG/autoload/multiline.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,10 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
607607
// Get the penalty for this type of break and
608608
// use it to modify the default penalty
609609
//
610-
var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO];
610+
var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]||0;
611611
if (!MathJax.Object.isArray(linebreak)) {
612-
// for breaks past the width, don't modify penalty
613-
if (offset >= 0) {penalty = linebreak * info.nest}
612+
// for breaks past the width, keep original penalty for newline
613+
if (linebreak || offset >= 0) {penalty = linebreak * info.nest}
614614
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
615615
//
616616
// If the penalty is no better than the current one, return false
@@ -653,13 +653,13 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
653653
// Get the penalty for this type of break and
654654
// use it to modify the default penalty
655655
//
656-
var linebreak = PENALTY[linebreakValue];
656+
var linebreak = PENALTY[linebreakValue]||0;
657657
if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit*1000 &&
658658
!this.mathbackground && !this.backrgound)
659659
{linebreak = [(w/1000+PENALTY.spaceoffset)*PENALTY.spacefactor]}
660660
if (!MathJax.Object.isArray(linebreak)) {
661-
// for breaks past the width, don't modify penalty
662-
if (offset >= 0) {penalty = linebreak * info.nest}
661+
// for breaks past the width, keep original penalty for newline
662+
if (linebreak || offset >= 0) {penalty = linebreak * info.nest}
663663
} else {penalty = Math.max(1,penalty + linebreak[0] * info.nest)}
664664
//
665665
// If the penalty is no better than the current one, return false

0 commit comments

Comments
 (0)