8

Follow-up question to the accepted answer here and here. The latter seems promising, with the caveat that it doesn't work.

  • I'm using mdframed with tikz - but without "theorems". However, I too would like to see the title upon page breaks with a "continued" hint. How?

Screenshot, followed by MWE:

enter image description here

\documentclass[a4paper]{article}


\usepackage{graphicx}

% \usepackage[heightrounded=true, textheight=735pt, textwidth=430pt, layoutvoffset=27pt, hcentering, includefoot, headheight=26pt, headsep=10pt, footskip=10pt, showframe]{geometry}


\usepackage[framemethod=TikZ]{mdframed}

% \mdfsetup{skipabove=0pt,skipbelow=1\topskip, nobreak=true, innertopmargin=0.5\baselineskip, innerbottommargin=0.5\baselineskip, frametitleaboveskip=2pt, frametitlebelowskip=1pt}
%%%

\mdfdefinestyle{my_style_testing}{frametitlebackgroundcolor=pink}

\usepackage{lipsum}

\begin{document}

\lipsum[4]
\vspace{5cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{mdframed}[style=my_style_testing,frametitle=\color{blue}{What an interesting title this is...}]

hello world

\lipsum[1]

\vspace{5cm}

\lipsum[3]

\vspace{5cm}

\lipsum[2]

\end{mdframed}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\end{document}

2 Answers2

5

Possibly you'll need some minor adjustments:

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[framemethod=TikZ]{mdframed}

% \mdfsetup{skipabove=0pt,skipbelow=1\topskip, nobreak=true, innertopmargin=0.5\baselineskip, innerbottommargin=0.5\baselineskip, frametitleaboveskip=2pt, frametitlebelowskip=1pt}
%%%

\makeatletter
\mdfdefinestyle{my_style_testing}{
  frametitlebackgroundcolor=pink,
  splittopskip=3\baselineskip,
  middleextra={
    \node[
      text width=\the\dimexpr\linewidth-2\mdf@outerlinewidth@length-%
         2\mdf@middlelinewidth@length-2\mdf@innerlinewidth@length-%
         2\mdf@innerleftmargin@length\relax,
      anchor=north west,
      font=\mdf@frametitlefont,
      inner xsep=\mdf@innerleftmargin@length,
      outer sep=0pt,
      mdfframetitlebackground,
      rounded corners={max(\mdf@roundcorner@length%
                                         -\mdf@innerlinewidth@length%
                                        -.5\mdf@middlelinewidth@length,0)%
                                    }%
    ] at (P-|O) {\mdf@frametitle\ (Continued)};
  },
  secondextra={
    \node[
      text width=\the\dimexpr\linewidth-2\mdf@outerlinewidth@length-%
         2\mdf@middlelinewidth@length-2\mdf@innerlinewidth@length-%
         2\mdf@innerleftmargin@length\relax,
      anchor=north west,
      font=\mdf@frametitlefont,
      inner xsep=\mdf@innerleftmargin@length,
      outer sep=0pt,
      mdfframetitlebackground,
      rounded corners={max(\mdf@roundcorner@length%
                                         -\mdf@innerlinewidth@length%
                                        -.5\mdf@middlelinewidth@length,0)%
                                    }%
    ] at (P-|O) 
    {%
      \vbox{%
        \parskip\z@\relax%
        \parindent\z@\relax%
        \vskip\mdf@frametitleaboveskip@length%
        \mdf@frametitle\ (Continued)%
        \mdf@@frametitlerule\relax%
        \unvbox\mdf@splitbox@one\relax%
      }%
    };
  }
}
\makeatother

\usepackage{lipsum}

\begin{document}

\lipsum[4]
\vspace{5cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{mdframed}[style=my_style_testing,frametitle=\color{blue}{What an interesting title this is...}]

hello world

\lipsum[1]

\vspace{5cm}

\lipsum[3]

\vspace{5cm}

\lipsum[2]

\end{mdframed}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • I think I still need help regarding the "minor adjustments": the second ("continued") title is significantly thicker than the original one. I'd like them to be exactly the same. How? – nutty about natty Jun 20 '14 at 21:55
0

If it's a short document, a "manual" solution, i.e. "faking it": just another box/frame with continued in title, will do the trick. For longer documents the "automatic" solution would be desirable, though.