[Tex/LaTex] Breaking framed boxes across pages – or, a better design for a homework problem set

boxespage-breaking

My school's recommended homework document class file uses a boxedminipage to typeset problem statements so they appear in a box. However, this has the unfortunate consequence that they can't be broken across pages — so problem statements frequently tend to push themselves onto a new page.

Is there a way around this, such that the box can be broken across pages? Or does anyone have any better suggestions for a way to visually offset the problem statements from the solutions?

Best Answer

Here is a short example using the mdframed package that is capable of breaking a boxed environment across a page:

enter image description here

\documentclass{article}
\usepackage{mdframed}% http://ctan.org/pkg/mdframed
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}

\lipsum[1-4]

\newmdtheoremenv[outerlinewidth=2,leftmargin=40,rightmargin=40,%
    backgroundcolor=yellow,outerlinecolor=blue,innertopmargin=0pt,%
    splittopskip=\topskip,skipbelow=\baselineskip,%
    skipabove=\baselineskip,ntheorem,roundcorner=5pt]{theorem}{Theorem}[section]

\begin{theorem}[Your important theorem]
\lipsum[1]
\end{theorem}

\lipsum[1-3]

\end{document}

See the mdframed documentation for more information on how the mdframed environment can be used. In the above example, lipsum was used to generate dummy text, Lorem Ipsum style.

Related Question