# How to create theorem boxes

I wrote a chapter for a book, and we use a structure.tex with a lot of definitios and macros. Now I'm writing other book and I would like to use those kind of boxes as below.

Note that when the box can't be in a single page, it divides in two and the box is not closed in the first page. Basically are two tipes of boxes.

I have the structure.tex. I tried to write a new .tex but there are a lot of errors and I have been all day trying make it work. There are various packages I can't understant. structure.tex

How can I define those things as \begin{name}.. \end{name} ?

## 1 Answer

This can be quite easily achieved with tcolorbox:

\documentclass{article}
\usepackage{amsmath}
\usepackage{cleveref}
\usepackage[most]{tcolorbox}
\newtcbtheorem{Theorem}{Theorem}{
enhanced,
sharp corners,
attach boxed title to top left={
yshifttext=-1mm
},
colback=white,
colframe=blue!75!black,
fonttitle=\bfseries,
boxed title style={
sharp corners,
size=small,
colback=blue!75!black,
colframe=blue!75!black,
}
}{thm}
\newtcbtheorem[no counter]{Proof}{Proof}{
enhanced,
sharp corners,
attach boxed title to top left={
yshifttext=-1mm
},
colback=white,
colframe=blue!25,
fonttitle=\bfseries,
coltitle=black,
boxed title style={
sharp corners,
size=small,
colback=blue!25,
colframe=blue!25,
}
}{prf}

\begin{document}
\begin{Theorem}{}{fermat}
No three positive integers $$a$$, $$b$$ and $$c$$ satisfy the equation $$a^{n} + b^{n} = c^{n}$$ for any integer greater than two.
\end{Theorem}
\begin{Proof}{Theorem \ref{thm:fermat}}{}
The proof is easy, but too large to fit in this box.
\end{Proof}
\end{document}


Have a read in its documentation for what each setting does (I will admit, the defaults are a little annoying, hence why there are so many options). It also supports breaking boxes across pages!