GeneralBox with rounded corners

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Chau
Posts: 2
Joined: Fri Jun 13, 2008 3:06 pm

Box with rounded corners

Post by Chau »

Hi folks!

I've looking for a method to create a box in my document with a grey background colour or something. I want the shape of the box to be rectangular, but with rounded corners and the edges should have their own colour too.

Is this possible? I've seen it used in different books for describing either examples or algorithms.

/Casper

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

propell
Posts: 44
Joined: Fri May 30, 2008 11:16 am

Re: Box with rounded corners

Post by propell »

The fancybox package is a good place to start:
http://www.ctan.org/tex-archive/help/Ca ... cybox.html

Other alternatives are listings.sty framed.sty and boites.sty:
http://www.ctan.org/tex-archive/help/Ca ... oites.html

For really fancy boxes you can try using TikZ or PSTricks. Here is a TikZ example:
http://www.fauskes.net/pgftikzexamples/ ... -and-math/

Unfortunately this only works well if the box fits on a page, since there is no automatic page breaking inside a tikzpicture environment.

Hope this helps.

Regards,
Kjell Magne Fauske
Chau
Posts: 2
Joined: Fri Jun 13, 2008 3:06 pm

Box with rounded corners

Post by Chau »

propell wrote:The fancybox package is a good place to start:
http://www.ctan.org/tex-archive/help/Ca ... cybox.html
This works very well, but I can't seem to change the colour of the background. Do you have any ideas for that?

/Casper
propell
Posts: 44
Joined: Fri May 30, 2008 11:16 am

Re: Box with rounded corners

Post by propell »

Unfortunately I don't see any obvious way to set the background color. This thread recommends using framed.sty or boites.sty:
http://groups.google.com/group/comp.tex ... e611ce2e2b

Not sure if they support rounded corners... :(

- Kjell Magne
Post Reply