Skip to content

Commit 081ff8d

Browse files
committed
Add filtering for padding in \bbox. Resolves issue #1183
1 parent 6c7f18a commit 081ff8d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

unpacked/extensions/Safe.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@
395395
// Filter the styles for \bbox
396396
//
397397
TEX.Parse.Augment({
398-
BBoxStyle: function (styles) {return SAFE.filterStyles(styles)}
398+
BBoxStyle: function (styles) {return SAFE.filterStyles(styles)},
399+
BBoxPadding: function (pad) {
400+
var styles = SAFE.filterStyles("padding: "+pad);
401+
return (styles ? pad : 0);
402+
}
399403
});
400404

401405
});

unpacked/extensions/TeX/bbox.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
6767
if (match) {
6868
if (def)
6969
{TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Padding",name])}
70-
var pad = match[1]+match[3];
71-
def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]};
70+
var pad = this.BBoxPadding(match[1]+match[3]);
71+
if (pad) def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]};
7272
} else if (part.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)) {
7373
if (background)
7474
{TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Background",name])}
@@ -91,7 +91,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
9191
}
9292
this.Push(math);
9393
},
94-
BBoxStyle: function (styles) {return styles}
94+
BBoxStyle: function (styles) {return styles},
95+
BBoxPadding: function (pad) {return pad}
9596
});
9697

9798
MathJax.Hub.Startup.signal.Post("TeX bbox Ready");

0 commit comments

Comments
 (0)