I would like to have something like a minipage with colored background, i.e. a box where you can predefine the width and the background color. My attempt

Some text

lead to a box which was a bit wider than the original minipage. Any suggestions?


You have to set \fboxsep=0pt to avoid the extra padding around the minipage. Try this:

  Some text

Some text
| improve this answer | |
  • 1
    Using a group the setting will be local. – egreg Apr 1 '13 at 19:54
  • @egreg True. I am not too sure what the OP wants though, as a colorbox without a bit of padding does not look very sexy. – Yiannis Lazarides Apr 1 '13 at 20:03
  • Possibly a very thin padding is better. – egreg Apr 1 '13 at 20:12
  • I works well; the aim is to produce boxes of given width which can be converted to images by the "preview"-package. – JF Meier Apr 2 '13 at 19:45

Test this. Wrapfigure is optional, but I like adding it and I like that it works!


\begin{tcolorbox}[colback=gray!5,colframe=green!40!black,title=In short]
Example text ... blabla         
| improve this answer | |
  • 3
    Why do you use a wrapfigure? Does it really solve the 'old' question? A full example with some screenshot would be appreciated! – user31729 Sep 22 '14 at 0:02

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.