Skip to content

Commit 6b38a81

Browse files
authored
Merge pull request #1673 from dpvc/issue1666
Allow negative dimensions in \Rule and add \rule macro. #1666
2 parents afb499f + 650cd0f commit 6b38a81

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

unpacked/jax/input/TeX/jax.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@
868868
mskip: 'Hskip',
869869
mspace: 'Hskip',
870870
mkern: 'Hskip',
871+
rule: 'rule',
871872
Rule: ['Rule'],
872873
Space: ['Rule','blank'],
873874

@@ -1582,11 +1583,26 @@
15821583
d = this.GetDimen(name);
15831584
var mml, def = {width:w, height:h, depth:d};
15841585
if (style !== 'blank') {
1585-
if (parseFloat(w) && parseFloat(h)+parseFloat(d))
1586-
{def.mathbackground = (this.stack.env.color || "black")}
1587-
mml = MML.mpadded(MML.mrow()).With(def);
1588-
} else {
1589-
mml = MML.mspace().With(def);
1586+
def.mathbackground = (this.stack.env.color || "black");
1587+
}
1588+
this.Push(MML.mspace().With(def));
1589+
},
1590+
rule: function (name) {
1591+
var v = this.GetBrackets(name),
1592+
w = this.GetDimen(name),
1593+
h = this.GetDimen(name);
1594+
var mml = MML.mspace().With({
1595+
width: w, height:h,
1596+
mathbackground: (this.stack.env.color || "black")
1597+
});
1598+
if (v) {
1599+
mml = MML.mpadded(mml).With({voffset: v});
1600+
if (v.match(/^\-/)) {
1601+
mml.height = v;
1602+
mml.depth = '+' + v.substr(1);
1603+
} else {
1604+
mml.height = '+' + v;
1605+
}
15901606
}
15911607
this.Push(mml);
15921608
},

0 commit comments

Comments
 (0)