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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10330
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: 10330
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