is nice for controlling the outer layout of theorems. on the other hand can take care of a number of other things great and small, in particular the detailed formatting of the title within the flow of text, but also stuff like maintaining a flexible list of theorems, properly setting autoref names, and so on. I know I can use the mdframed key to the \declaretheorem command to let it create a frame and control most aspects of that frame. What I'm missing, though, is a way to make use of the frametitle facilities of in this way.

Is there a way to redirect the title typesetting commands from into the frametitle argument to the mdframed environment it creates?

I see that I can add a hook before and a hook after the title, but at least my naive way of capturing the title between these two using \def\myframetitle\bgroup and \egroup failed:

\usepackage{thm-patch}% copied from thmdef-mdframed.sty
% The following was adapted from thmdef-mdframed.sty but does not work:
% Change the mymdframed to mdframed to make this compile at all:
\begin{thm}[Round] The world is round\end{thm}

And this is what it \emph{should} look like:
\begin{mdframed}[frametitle={Thm 1: Round},style=fstyle]
The world is round\end{mdframed}

I'll be happy to learn about any approach to get the two packages working together including the title. There must be some solution, e.g. by defining your own wrapper macros to handle the title argument, but I hope for some more elegant approaches from those who know more.

  • You can use \mdtheorem[style=fstyle]{thm}{Thm} May 10, 2013 at 17:13
  • @MarcoDaniel: Not using thmtools, I get warnings from hyperref about a missing autoref name for Thm. Furthermore, I can't control the formatting of the heading as well, e.g. I can't use different fonts for the theorem number and its name. I'm also worried about the list of theorems facilities, although I haven't tried them with mdtheorem alone.
    – MvG
    May 10, 2013 at 17:19
  • 2
    let me have a closer look. May 10, 2013 at 17:24

1 Answer 1


Let me try to provide an answer.

thmtools uses the default environment provided by amsthm. To use mdframed with frametitle you have to redefine the default environment of amsthm. However I don't know whether it's a good idea. With the simple test file below it works. Please note that all theorem environments are enclosed by mdframed.

In the example I also show how to modify the style of mdframed:

\usepackage{thmtools,thm-patch}% copied from thmdef-mdframed.sty

%  \ifhmode\unskip\unskip\par\fi
  \thm@headpunct{.}% add period after heading
  \thm@headsep 5\p@ plus\p@ minus\p@\relax
  #1% style overrides
  \@topsep \thm@preskip               % used by thm head
  \@topsepadd \thm@postskip           % used by \@endparenv
    \def\@tempa{\@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]}%
    \the\thm@headfont \thm@indent


\begin{thm}[Round] The world is round\end{thm}

And this is what it \emph{should} look like:

\begin{thm}The world is round\end{thm}


enter image description here

  • Please test it before you use it! May 10, 2013 at 19:06
  • That took some doing. May 10, 2013 at 19:37

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.