Add filtering for padding in \bbox. Resolves issue #1183

This commit is contained in:
Davide P. Cervone 2016-07-07 15:31:01 -04:00
parent 6c7f18a72f
commit 081ff8dfac
2 changed files with 9 additions and 4 deletions

View File

@ -395,7 +395,11 @@
// Filter the styles for \bbox // Filter the styles for \bbox
// //
TEX.Parse.Augment({ TEX.Parse.Augment({
BBoxStyle: function (styles) {return SAFE.filterStyles(styles)} BBoxStyle: function (styles) {return SAFE.filterStyles(styles)},
BBoxPadding: function (pad) {
var styles = SAFE.filterStyles("padding: "+pad);
return (styles ? pad : 0);
}
}); });
}); });

View File

@ -67,8 +67,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
if (match) { if (match) {
if (def) if (def)
{TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Padding",name])} {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Padding",name])}
var pad = match[1]+match[3]; var pad = this.BBoxPadding(match[1]+match[3]);
def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]}; if (pad) def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]};
} else if (part.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)) { } else if (part.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)) {
if (background) if (background)
{TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Background",name])} {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Background",name])}
@ -91,7 +91,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
} }
this.Push(math); this.Push(math);
}, },
BBoxStyle: function (styles) {return styles} BBoxStyle: function (styles) {return styles},
BBoxPadding: function (pad) {return pad}
}); });
MathJax.Hub.Startup.signal.Post("TeX bbox Ready"); MathJax.Hub.Startup.signal.Post("TeX bbox Ready");