2
$\begingroup$

When highlighting text using Style and Background, as in Style["Test ", White, Background -> Lighter@Blue] is there a way to pad (ie, enlarge) the bounding box?

The bottom of the background seems coincident with the base of the text: here

$\endgroup$
3
$\begingroup$
Style[Pane[" Test "], White, Background -> Lighter@Blue]

enter image description here

Edit

Controlling the padding:

Style[Pane[" Test ", ImageMargins -> 10], White,  Background -> Lighter@Blue]
$\endgroup$
  • $\begingroup$ Ok that works. But is there no way to parametrically control size? (Other than rendering an independent Rectangle) $\endgroup$ – alancalvitti Jul 21 '12 at 19:22
  • 1
    $\begingroup$ @alancalvitti Add that request to the question. I tried to answer it in its current state $\endgroup$ – Dr. belisarius Jul 21 '12 at 19:23
  • $\begingroup$ @alancalvitti See edit $\endgroup$ – Dr. belisarius Jul 21 '12 at 19:25
3
$\begingroup$

You could play with the FrameMargins ...

Framed[Style["Test", White], FrameStyle -> None, FrameMargins -> 2, 
 Background -> Lighter@Blue] 

test

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.