bbox
The bbox extension defines a non-standard macro for adding background colors, borders, and padding to your math expressions.
- \bbox[options]{math}
puts a bounding box around
mathusing the providedoptions. The options can be one of the following:A color name used for the background color.
A dimension (e.g.,
2px) to be used as a padding around the mathematics (on all sides).Style attributes to be applied to the mathematics (e.g.,
border: 1px solid red).A combination of these separated by commas.
Here are some examples:
\bbox[red]{x+y} % a red box behind x+y
\bbox[2pt]{x+1} % an invisible box around x+y with 2pt of extra space
\bbox[red,2pt]{x+1} % a red box around x+y with 2pt of extra space
\bbox[5px, border: 2px solid red]{x+1}
% a 2px red border around the math 5px away
These render as follows: