6

I've discovered what appears to be a bug in the mdframed package. My goal was to use a package which allows me to create shaded theorem environments which span multiple pages (thmtools does not allow this). Run this minimal example:

\documentclass{memoir}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{mdframed}
\usepackage{blindtext}

\newmdtheoremenv{theorem}{Theorem}

\begin{document}
\chapter{Hello}
\marginpar{\vspace*{9pt}\chapnumfont\thechapter}  % COMMENT IN/OUT

\begin{theorem}
\blindtext[2]
\end{theorem}

\begin{theorem}
\blindtext[3]
\end{theorem}
\end{document}

When the marked line is commented out, then the theorems render as expected -- that is, the second theorem spans the first and second page. However, when the marked line is commented in, then the two theorems are generated on separate pages. The marked line simply adds in the chapter number on the side.

BadGood

Does anybody know the source of the bug? Moreover, is there a way to work around this? I want the theorems to span the pages, as the package was designed!

1 Answer 1

6

Although I don't know exactly what's going on, I don't think it's a bug in mdframed, but a bad interaction of \marginpar. As a workaround you can use \marginnote from the marginnote package:

\documentclass{memoir}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{mdframed}
\usepackage{marginnote}
\usepackage{blindtext}

\newmdtheoremenv{theorem}{Theorem}

\begin{document}
\chapter{Hello}
\marginnote{\chapnumfont\thechapter}

\begin{theorem}

\blindtext[2]
\end{theorem}

\begin{theorem}
\blindtext[3]
\end{theorem}
\end{document}

enter image description here

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.