TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to produce some fancy boxes. I have found the fancybox package that does the boxes I want.

What I can't find now is: How do I change their background color?

I would also like to make the box occupy the whole \textwidth.

Can anyone help?

share|improve this question
up vote 7 down vote accepted

You mean the fancybox (not fancyboxes) package? It does not support colors by itself.

I would use the framed package together with xcolor to define the fancy box you want. If you do not require special stuff like verbatim material you could simply go with:

% ...
\fcolorbox{<frame color>}{<background color>}{\parbox{\textwidth}{%
   \color{<text color>}%

Otherwise define an own framed environment. Then the box will be \textwidth wide by itself. It even support page break, i.e. splits over multiple pages if the internal text does.


  \def\FrameCommand{\fboxsep=\FrameSep \fcolorbox{<frame color>}{<background color>}}%
  \color{<text color>}\MakeFramed {\FrameRestore}}%
share|improve this answer
Sorry, I did meant fancybox. I have managed what I wanted with the sectionbox package. Does framed allow for shadowbox? – Tiago Veloso Feb 2 '11 at 9:28
@Tiago: It support all boxing macros. Just redefine \FrameCommand accordantly. – Martin Scharrer Feb 2 '11 at 9:50

use package mdframed the boxes can also have a pagebreak inside

share|improve this answer
The link is broken, here is one that works (for now) ctan.mirrorcatalogs.com/macros/latex/contrib/mdframed/… – AD. Oct 8 '13 at 19:58

For those who are (almost) complete beginners and want something they can directly use I stumble upon the "tcolorbox" package, here is a tutorial


share|improve this answer

Your Answer


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.