Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a \framebox (I don't insist on using this command) and a minipage that causes whitespace, because the drawn box is not allowing any text before or after and it itself does not break over pages. The code looks like this:

    Title Goes Here
    Contents go here

Am I using the correct command? If so, how can I break it over pages? or if it is not possible to break it, I must give it a label and caption (just like a table or figure) and make it inline with text so that I can refer it in the article, but I don't know that either.

share|improve this question
use package mdframed. See documentation on how it has to be used –  Herbert May 26 '11 at 10:27
Thanks. That's it. Would you please state it as an answer so that I can mark it as correct answer. –  Yasser Sobhdel May 26 '11 at 10:44
Is there anything like it for blocks of math (I mean between two $, like $\phi^\rho$ and so). When such a block reaches end of line, it goes further to margins and I must correct it manually. Is there a way to correct it another way? –  Yasser Sobhdel May 26 '11 at 10:46
I don't get "the drawn box is not allowing any text before or after". This is not the behaviour of \framebox. –  Martin Scharrer May 26 '11 at 11:01
I mean the box is larger than half of the page, and it causes the previous page to have white spaces. and it starts at the beginning of next page. –  Yasser Sobhdel May 26 '11 at 13:42

1 Answer 1

up vote 1 down vote accepted

Something you can also give a try is this code from the memoir manual for a framed environment with a caption. It can break across pages and gives a continuation caption. It can also be referred to with a \ref


    \vbox{\nobreak \vskip -0.7\FrameSep
        \rlap{\strut#1}\nobreak\nointerlineskip% left justified
        \vskip 0.7\FrameSep
\newenvironment{titledframe}[2][\FrameFirst@Lab\ (cont.)]{%
    \def\FrameFirst@Lab{\textbf{\framename\ \theframecnt:\ #2}}%
    \advance\hsize -2\FrameRule
    \advance\hsize -2\FrameSep

    \begin{titledframe}{A titled frame}\label{frm:A}

    \begin{titledframe}{A New frame}\label{frm:B}
    In frames~\ref{frm:A} and \ref{frm:B}
share|improve this answer
Do you know anything for formulae, is it possible to have an script or so t automatically break the formula to the next line when it is exceeding the usual length and entering the margin? –  Yasser Sobhdel May 26 '11 at 15:16
@Yasser Sobhdel: No unfortunately not. There are a lot of rules regarding where to break a single equation into multi-line ones. I think it is very close to impossible to automate that. –  Danie Els May 26 '11 at 15:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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