Hello,
How to make theorems show inside a box filled with a certain color ?
I need it also to split over two pages if the theorem was at the end of a page.
Regards,
Math & Science ⇒ How to make Theorems with colored boxes?
NEW: TikZ book now 40% off at Amazon.com for a short time.

How to make Theorems with colored boxes?
Hi,
you could try the shaded environment from the framed package. A little example:
you could try the shaded environment from the framed package. A little example:
Code: Select all
\documentclass{article}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{framed}
\colorlet{shadecolor}{orange!15}
\newtheorem{theorem}{Theorem}
\newenvironment{theo}
{\begin{shaded}\begin{theorem}}
{\end{theorem}\end{shaded}}
\begin{document}
\begin{theo}
Some important theorem.
\end{theo}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
How to make Theorems with colored boxes?
You could also try the shadethm package:
Code: Select all
\documentclass{article}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{shadethm}
\newshadetheorem{thm}{Theorem}
\definecolor{shadethmcolor}{HTML}{EDF8FF}
\definecolor{shaderulecolor}{HTML}{45CFFF}
\setlength{\shadeboxrule}{.4pt}
\begin{document}
\begin{thm}
Some important theorem.
\end{thm}
\end{document}
Re: How to make Theorems with colored boxes?
Thanks very much!
It worked with me.
but how to make shading with two colors (the shading changes gradually from the first color to the second color vertically or horizontally)?
It worked with me.
but how to make shading with two colors (the shading changes gradually from the first color to the second color vertically or horizontally)?
How to make Theorems with colored boxes?
If you want a gradient background, then you need to use something different. One way is to use TikZ. Here's an example using both horizontal and vertical gradients:
Code: Select all
\documentclass{article}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{tikz}
\newtheorem{thm}{Theorem}
\newcommand{\statetheoremhoriz}[2][\textwidth]{
\par\noindent\tikzstyle{mybox} = [draw=blue,left color=cyan!50,
right color=cyan!5,thick,rectangle,inner sep=6pt]
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{#1}{#2}\end{minipage}
};
\end{tikzpicture}
}
\newcommand{\statetheoremvert}[2][\textwidth]{
\par\noindent\tikzstyle{mybox} = [draw=blue,top color=cyan!50,
bottom color=cyan!5,thick,rectangle,inner sep=6pt]
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{#1}{#2}\end{minipage}
};
\end{tikzpicture}
}
\newcommand{\statetheoremsolid}[2][\textwidth]{
\par\noindent\tikzstyle{mybox} = [draw=blue,fill=cyan!50,
thick,rectangle,inner sep=6pt]
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{#1}{#2}\end{minipage}
};
\end{tikzpicture}
}
\begin{document}
\statetheoremhoriz{
\begin{thm}
Some important theorem. It is very important. So important that
it is in a shaded box with a horizontal gradient.
\end{thm}
}
\statetheoremvert{
\begin{thm}
Another important theorem. It is very important. So important
that it is in a shaded box with a vertical gradient.
\end{thm}
}
\statetheoremsolid{
\begin{thm}
Not such an important theorem. That is why it is in a box with
solid shading.
\end{thm}
}
\end{document}
Re: How to make Theorems with colored boxes?
Thank you very much!
Regards,
Regards,