# Boxing the contents of all theorems but not the theorem heading

I created a theorem environment for examples and I want to have them boxed underneath the heading.

\documentclass{book}
\usepackage{amsmath}
\usepackage{amsthm}

\newtheoremstyle{break}
{5mm}
{5mm}
{}
{}
{\bfseries}
{}
{\newline}
{}
\theoremstyle{break}
\newtheorem{exmp}{Example}

\begin{document}

\begin{exmp}
This text should be framed in a box, but not the heading "Example".
\end{exmp}

\end{document}


Can I add an \fbox{} into this newtheorenstyle so I can use \begin{exmp} Text text text \end{exmp} and the "Text text text" will be inside of a frame box?

This accomplished it:

\documentclass{book}
\usepackage{amsmath}
\usepackage{amsthm}

\newtheoremstyle{break}
{5mm}
{5mm}
{}
{}
{\bfseries}
{}
{\newline}
{}
\theoremstyle{break}
\newtheorem{exmp}{Example}

\newcommand{\example}[1]{%
\begin{exmp}\framebox[\textwidth][l]{#1}%
\end{exmp}}

\begin{document}

\example{Text text text}

\end{document}


The frame is the width of the main body and the example inside is left-justified.

• My understanding is that oframed in the framed package allows these frames to naturally break across pages, but I could not get that to work. Would this be a new question? May 11 '20 at 13:35

I strongly encourage you to have a look at thmbox which was created precisely for that kind of purpose.

The following:

\documentclass{book}
\usepackage{amsmath}
\usepackage{amsthm}

\usepackage%[nounderline]
{thmbox}
\newtheorem[L]{thm}{Theorem}[section]
\newtheorem[L]{ex}[thm]{Example}

\begin{document}

\begin{ex}
Some text, some more text, a sufficient amount to get a full box with several lines.
\end{ex}

\vspace{45em}

\begin{ex}
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
\end{ex}

\end{document}

\end{document}


produces almost what you want:

and breaks nicely:

Refer to the manual for more tweaking option, but I believe that this will be more elegant than your "hand-made" solution.