Math & ScienceA colored box around theorems and definitions

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
petey
Posts: 10
Joined: Sat Feb 27, 2010 9:23 pm

A colored box around theorems and definitions

Post by petey »

Hi guys,

I would like to have a colored box around theorems and definitions. How can I do that ?

Thanks in advance.
petey
Last edited by petey on Sat Jul 17, 2010 11:28 am, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10397
Joined: Mon Mar 10, 2008 9:44 pm

A colored box around theorems and definitions

Post by Stefan Kottwitz »

Hi petey,

you could use \colorbox or \fcolorbox, like

Code: Select all

\fcolorbox{frame color name}{box color name}{text}
Those commands are described in the documentation to the color and graphicx packages (grfguide.pdf).

Stefan
LaTeX.org admin
petey
Posts: 10
Joined: Sat Feb 27, 2010 9:23 pm

Re: A colored box around theorems and definitions

Post by petey »

Hi Stefan,

Thanks! I tried them and they work as long as I don't put a theorem inside. Strange.

petey
User avatar
Stefan Kottwitz
Site Admin
Posts: 10397
Joined: Mon Mar 10, 2008 9:44 pm

A colored box around theorems and definitions

Post by Stefan Kottwitz »

You could try the framed package. It provides more features than the color package with its boxes.

Stefan
LaTeX.org admin
petey
Posts: 10
Joined: Sat Feb 27, 2010 9:23 pm

Re: A colored box around theorems and definitions

Post by petey »

Hi Stefan,

Thank you very much :D! It works perfectly.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: A colored box around theorems and definitions

Post by localghost »

Now that the problem is solved, please mark the topic accordingly as described in Section 3 of the Board Rules.


Best regards
Thorsten
petey
Posts: 10
Joined: Sat Feb 27, 2010 9:23 pm

Re: A colored box around theorems and definitions

Post by petey »

Done.

Thanks again for all the help and a great forum.

Best regards
petey
Post Reply