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}
6
  • Do you want just the text for the title or the text with the formatting (background color, etc)? Commented Jun 20, 2014 at 15:48
  • @GonzaloMedina The whole thing again (pink frame and all) plus "continued..." Commented Jun 20, 2014 at 15:53
  • At first glance, this looks almost like an answer to me. Commented Jun 20, 2014 at 16:09
  • 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. Commented Jun 22, 2014 at 10:00
  • related: tex.stackexchange.com/a/95988/5049
    – cgnieder
    Commented Jun 22, 2014 at 12:44

2 Answers 2

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

1
  • 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? Commented Jun 20, 2014 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .