|
296 | 296 | }
|
297 | 297 | if (this.rowspacing) {
|
298 | 298 | var rows = this.arraydef.rowspacing.split(/ /);
|
299 |
| - while (rows.length < this.table.length) {rows.push(this.rowspacing)} |
| 299 | + while (rows.length < this.table.length) {rows.push(this.rowspacing+"em")} |
300 | 300 | this.arraydef.rowspacing = rows.join(' ');
|
301 | 301 | }
|
302 | 302 | },
|
|
1613 | 1613 | var n;
|
1614 | 1614 | if (this.string.charAt(this.i) === "[") {
|
1615 | 1615 | n = this.GetBrackets(name,"").replace(/ /g,"");
|
1616 |
| - if (n && !n.match(/^(((\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) |
| 1616 | + if (n && !n.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) |
1617 | 1617 | {TEX.Error("Bracket argument to "+name+" must be a dimension")}
|
1618 | 1618 | }
|
1619 | 1619 | this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true}));
|
|
1622 | 1622 | if (n && top.arraydef.rowspacing) {
|
1623 | 1623 | var rows = top.arraydef.rowspacing.split(/ /);
|
1624 | 1624 | if (!top.rowspacing) {top.rowspacing = this.dimen2em(rows[0])}
|
1625 |
| - while (rows.length < top.table.length) {rows.push(top.rowspacing)} |
1626 |
| - rows[top.table.length-1] = (top.rowspacing+this.dimen2em(n)) + "em"; |
| 1625 | + while (rows.length < top.table.length) {rows.push(this.Em(top.rowspacing))} |
| 1626 | + rows[top.table.length-1] = this.Em(Math.max(0,top.rowspacing+this.dimen2em(n))); |
1627 | 1627 | top.arraydef.rowspacing = rows.join(' ');
|
1628 | 1628 | }
|
1629 | 1629 | } else {
|
|
1633 | 1633 | },
|
1634 | 1634 | emPerInch: 7.2,
|
1635 | 1635 | dimen2em: function (dim) {
|
1636 |
| - var match = dim.match(/^((?:\.\d+|\d+(?:\.\d*)?))(pt|em|ex|mu|pc|in|mm|cm)/); |
| 1636 | + var match = dim.match(/^(-?(?:\.\d+|\d+(?:\.\d*)?))(pt|em|ex|mu|pc|in|mm|cm)/); |
1637 | 1637 | var m = parseFloat(match[1]||"1"), unit = match[2];
|
1638 | 1638 | if (unit === "em") {return m}
|
1639 | 1639 | if (unit === "ex") {return m * .43}
|
|
1645 | 1645 | if (unit === "mu") {return m / 18}
|
1646 | 1646 | return 0;
|
1647 | 1647 | },
|
| 1648 | + Em: function (m) { |
| 1649 | + if (Math.abs(m) < .0006) {return "0em"} |
| 1650 | + return m.toFixed(3).replace(/\.?0+$/,"") + "em"; |
| 1651 | + }, |
1648 | 1652 |
|
1649 | 1653 | HLine: function (name,style) {
|
1650 | 1654 | if (style == null) {style = "solid"}
|
|
0 commit comments