# What is the intelligent way of setting the text width for a specific theorem in \newtheoremstyle?

I'm using a \newtheoremstyle to generate a \newtheorem called Example. However, I want the Example (the theorem) and the text, everything, to have a smaller text width than the normal text, and I don't know the efficient way of doing this, and avoid repeating code each time.

Is there an intelligent way to do this in the \newtheoremstyle? Or elsewhere?

-
Note that it is unusual around here to have any greeting. –  lockstep Feb 26 '11 at 18:05

The thmtools package can help with this.

\documentclass{article}
\usepackage{amsthm,thmtools}
\usepackage{xcolor}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{Example}
\lipsum[2]
\end{Example}
\end{document}


This puts the Example is a box that is 20em wide.

Edit:
In a comment, you mention centering for the first time. Here's a way to get centering. It takes a little bit more work.

\documentclass{article}
\usepackage{amsthm,thmtools}
\usepackage{lipsum}
\declaretheorem[style=definition]{Example}
\moveright\dimexpr(\linewidth-20em)/2\vbox\bgroup
\hsize=20em
\linewidth=\hsize
}
\begin{document}
\lipsum[1]
\begin{Example}
\lipsum[2]
\end{Example}
\end{document}


This doesn't rely on the shaded extension. Instead, it puts the theorem in a \vbox of the appropriate size and then moves that right (\linewidth-20em)/2.

-
Thanks, this looks like a great solution. However, I'm looking at the Thmtools Users’ Guide and can't find anything about centering that example. I want exactly what you posted, but centered. How can I do this? –  Paul Feb 26 '11 at 18:45
@Paul: I've added a way to get centering. –  TH. Feb 26 '11 at 19:22
thanks for your suggestions, but I find really complicated the installation of thmtools on windows. I haven't been able to implement this yet. –  Paul Mar 4 '11 at 13:36
@Paul: I cannot help with that. I only rarely use Windows and never TeX on Windows. All I can say is it comes with TeX Live. –  TH. Mar 4 '11 at 21:05
@TH: MikTeX works seamlessly with Windows, both its 32-bits and its 64-bits. It includes and installs thmtools –  Peter Jones Sep 24 '11 at 10:02