Allow commas in place of decimals in TeX dimensions. Resolves issue #856.

This commit is contained in:
Davide P. Cervone 2014-08-18 14:09:05 -04:00
parent 4666badbe2
commit 4fb5c5e4e5

View File

@ -1653,7 +1653,7 @@
CrLaTeX: function (name) { CrLaTeX: function (name) {
var n; var n;
if (this.string.charAt(this.i) === "[") { if (this.string.charAt(this.i) === "[") {
n = this.GetBrackets(name,"").replace(/ /g,""); n = this.GetBrackets(name,"").replace(/ /g,"").replace(/,/,".");
if (n && if (n &&
!n.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) { !n.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) {
TEX.Error(["BracketMustBeDimension", TEX.Error(["BracketMustBeDimension",
@ -1916,14 +1916,14 @@
if (this.nextIsSpace()) {this.i++} if (this.nextIsSpace()) {this.i++}
if (this.string.charAt(this.i) == '{') { if (this.string.charAt(this.i) == '{') {
dimen = this.GetArgument(name); dimen = this.GetArgument(name);
if (dimen.match(/^\s*([-+]?(\.\d+|\d+(\.\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)\s*$/)) if (dimen.match(/^\s*([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)\s*$/))
{return dimen.replace(/ /g,"")} {return dimen.replace(/ /g,"").replace(/,/,".")}
} else { } else {
dimen = this.string.slice(this.i); dimen = this.string.slice(this.i);
var match = dimen.match(/^\s*(([-+]?(\.\d+|\d+(\.\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)) ?/); var match = dimen.match(/^\s*(([-+]?([.,]\d+|\d+([.,]\d*)?))\s*(pt|em|ex|mu|px|mm|cm|in|pc)) ?/);
if (match) { if (match) {
this.i += match[0].length; this.i += match[0].length;
return match[1].replace(/ /g,""); return match[1].replace(/ /g,"").replace(/,/,".");
} }
} }
TEX.Error(["MissingDimOrUnits", TEX.Error(["MissingDimOrUnits",