# Padding in theorem environment with thmtools

I'm using thmtools to make shaded theorems, but there is no padding around the theorem body and that makes it ugly.

MWE:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[dvipsnames]{xcolor}

\colorlet{LightGray}{White!90!Periwinkle}

\declaretheoremstyle[
name=Theorem,
]{thmsty}
\declaretheorem[style=thmsty]{thm}

\begin{document}
\begin{thm}
In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
\end{thm}
\end{document}


Result:

I'd like to add padding all around the theorem. I read thmtools documentation but didn't find a way to do it. I don't mind if the shaded box gets larger than \textwidth.

• Use tcolorbox and it's tcbtheorem features, that provides much nicer boxes – user31729 Apr 20 '16 at 17:25

Here's the tcolorboxenvironment wrapper style for thm, providing nicer boxes (in my point of view), with effectively one line of code!

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}

\usepackage[dvipsnames]{xcolor}

\usepackage[most]{tcolorbox}

\colorlet{LightGray}{White!90!Periwinkle}

\declaretheoremstyle[
name=Theorem,
]{thmsty}
\declaretheorem[style=thmsty]{thm}

\begin{document}
\begin{thm}
In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
\end{thm}
\end{document}


• Indeed tcolorbox is very easy to use with the \tcolorboxenvironment command. I didn't know such a command existed. I'm choosing this answer because it's the easiest one to customize. – rubik Apr 20 '16 at 19:09
• @rubik: You're welcome -- please note that tcolorbox provides a lot of specialized theorem environments as well. – user31729 Apr 20 '16 at 19:49

Using the mdframed options in the theorem style allows one to set borders of specified size, here set to 6 or 8pt, depending.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[dvipsnames]{xcolor}

\colorlet{LightGray}{White!90!Periwinkle}

\declaretheoremstyle[
name=Theorem,
mdframed={
skipabove=8pt,
skipbelow=6pt,
hidealllines=true,
backgroundcolor={LightGray},
innerleftmargin=8pt,
innerrightmargin=8pt}
]{thmsty}
\declaretheorem[style=thmsty]{thm}

\begin{document}

\begin{thm}
In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
\end{thm}

In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
\end{document}


• Thanks, somehow I had missed the mdframed option! – rubik Apr 20 '16 at 19:06