Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted
Style[Pane[" Test "], White, Background -> Lighter@Blue]

enter image description here

Edit

Controlling the padding:

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

You could play with the FrameMargins ...

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

test

share|improve this answer
    
Thank you, so Framed it is. –  alancalvitti Jul 21 '12 at 19:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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