I'm using amsthm and thmtools to customize theorem-like environments. I want a theorem enviroment that has a header that looks like the following: .

I tried to use something like headformat = {\begin{mdframed}Foo\end{mdframed}} but I did not compile.

Any ideas?

## Update

With thmtools this is also easy:

\documentclass{article}
\usepackage{amsthm}
\usepackage{etoolbox}
\usepackage{thmtools}
\usepackage{lipsum}

\declaretheoremstyle[
spaceabove=\topsep,
spacebelow=\topsep,
notefont=\mdseries, notebraces={(}{)},
bodyfont=\normalfont,
]{framed}
\declaretheorem[style=framed,name=Theorem]{theo}
\AtEndEnvironment{theo}{\vskip0.5ex\hrule height0.8pt}

\begin{document}

\section{A test section}
\begin{theo}
\lipsum[4]
\end{theo}

\end{document}


Notice, however, that the initial and final rules might be detached from the contents should a page break occur there.

## First version

This is terribly easy with tcolorbox (adjust the settings according to your needs):

The code:

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\newtcbtheorem[number within=section]{tcbtheorem}{Theorem}{
breakable,
boxrule=0.6pt,
colback=white,
arc=0pt,
outer arc=0pt,
leftrule=0pt,
rightrule=0pt,
colframe=black,
colbacktitle=white,
fonttitle=\bfseries,
coltitle=black,
left=0pt,
right=0pt,
}{the}

\begin{document}

\section{A test section}
\begin{tcbtheorem}{the title}{test}
\lipsum[4]
\end{tcbtheorem}

\end{document}

• Thank you, but I don't really want to make the switch totcolorbox. – Christopher Feb 5 '15 at 19:00
• @Chris No problem. However, take into account that using just thmtools is really difficult (I'd say almost impossible) to guarantee that the initial line won't be detached from the contents should a page break occur between them (I've already tried to do this just with thmtools before). – Gonzalo Medina Feb 5 '15 at 19:05
• @Chris please see my updated answer for a version using thmtools. – Gonzalo Medina Feb 5 '15 at 20:23