# How to change margin when using shadethm package?

I'm using the shadethm package in order to have gray background for theorems. However, the outcome is not satisfactory because the margin is too narrow:

Can anyone show me how to change the margin of the shadethm package or show me another way to add shaded background to theorems while can specify margin?

• Welcome to TeX.SE! I'd highly recommend having a look at the mdframed package- it has all kinds of settings that can be tweaked easily :) – cmhughes Mar 20 '13 at 16:40
• @cmhughes, mdframed is quite good! Thank you for your recommendation! – HanXu Mar 21 '13 at 9:42

As cmhughes has mentioned, the mdframed package offers a lot more features and possibilities than shadethm, so I also suggest you to switch to mdframed. However, to answer your question, you can change the values for the lengths \shadeboxsep (controlling the distance between the start of color to start of text; in the four sides) and \shadetextwidth (width of the text body) , as in the following simple example in which I left 6pt between the frame and the text, but keeping the total width equal to \textwidth:

\documentclass{article}
\usepackage{lipsum}% just to generate text for the example

\begin{document}

\lipsum[4]
\begin{theo}
\lipsum[4]
\end{theo}

\end{document}


A simple example with mdframed, showing some of its features; in particular, the ability to control individually (for each of the four sides) the separation between the frame and the text (this cannot be done easily with shadethm):

\documentclass{article}
\usepackage{amsthm}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{lipsum}% just to generate text for the example

\newmdtheoremenv[
hidealllines=true,
innerleftmargin=8pt,%
innerrightmargin=8pt,%
innertopmargin=12pt,%
innerbottommargin=12pt,%
backgroundcolor=gray!50,%
skipbelow=\baselineskip,%
skipabove=\baselineskip]{theo}{Theorem}

\begin{document}

\lipsum[4]
\begin{theo}
\lipsum[4]
\end{theo}

\end{document}


I am the author of shadethm. It has been superceded, long ago. If you are starting a new project then you should use something else. (This is an answer because I am unable to comment.)