2

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: enter image description here.

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

Any ideas?

3

Update

With thmtools this is also easy:

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

\declaretheoremstyle[
  spaceabove=\topsep, 
  spacebelow=\topsep,
  headfont=\normalfont\bfseries,
  notefont=\mdseries, notebraces={(}{)},
  bodyfont=\normalfont,
  postheadspace=1em,
  preheadhook={\hrule height0.8pt\vskip1ex},
  postheadhook={\mbox{}\newline\vskip-1.75ex\hrule\vskip1ex\noindent}
]{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}

enter image description here

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):

enter image description here

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}
|improve this answer|||||
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.