7

I am using mdframed to create big boxes that span more than one page, but they just leave an unframed side at the top and down of the page. Is there a way to solve this?

\documentclass{article}
\usepackage[demo]{graphicx}% demo option just for the example
\usepackage{blindtext}% demo option just for the example
\usepackage{amsmath}
\usepackage{amssymb} 
\usepackage{natbib}
\usepackage{float}
\usepackage[small]{caption}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[xcolor,framemethod=tikz]{mdframed}

\begin{document}
\global\mdfdefinestyle{tag}{%
    roundcorner=5pt,innerlinewidth=2pt,innerlinecolor=RubineRed,%
    middlelinewidth=3pt,middlelinecolor=white,%
    outerlinewidth=2pt,outerlinecolor=Melon,%
    backgroundcolor=Melon!20,%
}
\begin{mdframed}[style=tag]     
\begin{center}
    \blindtext
    \includegraphics[width=\textwidth]{foo}
         \captionof{figure}{This is foo.}
        \label{fig:foo}
    \blindtext
    \includegraphics[width=\textwidth]{foo}
         \captionof{figure}{This is foo2.}
        \label{fig:foo}
    \blindtext
    \blindtext
    \blindtext
\end{center}
Lots of text
\blindtext
\blindtext
\blindtext
\includegraphics[width=\textwidth]{foo}
         \captionof{figure}{This is foo3.}
        \label{fig:foo}
\end{mdframed}

\end{document}
ienissei
  • 6,223
  • Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill May 24 '12 at 05:22
  • Do post an image and remove the preceding !. Those with editing privileges will re-insert it to embed the image in your post. – Werner May 24 '12 at 05:25
  • So you want the frame to be closed on top and bottom whenever there is a page break? I think that that is a feature so that it is clear that this frame continues on to the next page, or is being continued from the previous page. – Peter Grill May 24 '12 at 06:31
  • 1
    Use the option everyline=true. The global is useless. It is only needed in my example files. – Marco Daniel May 24 '12 at 06:50

1 Answers1

4

I want to answer this question with some hints to your preamble.

  • The command \global in front of \mdfdefinestyle isn't needed. I used it in the documentation do define the style out of the group provided by showexpl
  • You load the package xcolor. As recommend it's the best way to do this. If the package xcolor is loaded mdframed will ignore the option xcolor.
  • To draw also a top and bottom line at splitted frames you can use the option everyline=true. However in my opinion it doesn't look well with such borders.

Use the following definition for tag:

\mdfdefinestyle{tag}{%
    roundcorner=5pt,innerlinewidth=2pt,innerlinecolor=RubineRed,%
    middlelinewidth=3pt,middlelinecolor=white,%
    outerlinewidth=2pt,outerlinecolor=Melon,%
    backgroundcolor=Melon!20,everyline=true%
}

Marco Daniel
  • 95,681
  • I replace above code but still same pblm. i am getting following error message. ! Package keyval Error: everyline undefined.

    See the keyval package documentation for explanation. Type H for immediate help.

    – manish Jun 28 '12 at 04:03