5

How I can delete frametitle after pagebreak in mdframed box?

I try to make a box with the title "Summary" by mdframed package.

With the code I attach, the title "Summary" appears in the second page after pagebreak. But I think it seems not good looking. How I can delete the title "Summary " after pagebreak?

\documentclass{book}

\usepackage[framemethod=pgf]{mdframed}
\usepackage{lipsum}

\tikzstyle{titlebox} = [draw=black,white,fill=white,text=black,right, minimum height=.5cm]

\makeatletter
\renewrobustcmd\mdfcreateextratikz{%
    \node[titlebox,xshift=\tmplen,anchor=center] at (P-|O) {\raisebox{3\depth}{\mdf@frametitlefont{ Summary }}};}

\newlength\tmplen

\mdfdefinestyle{myboxstyle}{%
outerlinewidth=.4pt,
innerlinewidth=0pt,
roundcorner=0pt,
linecolor=black,
innertopmargin=1.5\baselineskip,
innerbottommargin=.5\baselineskip,
skipabove=4.5ex,
skipbelow=3ex,
needspace=3\baselineskip,
frametitlefont=\sffamily\bfseries,
leftmargin=-.5em,
rightmargin=-.5em,
settings={\tmplen=\dimexpr\linewidth-\leftmargin+\rightmargin-2\mdf@outerlinewidth@length\relax\tmplen=.5\tmplen},
}
\makeatother

\begin{document}
\lipsum[3]

\begin{mdframed}[style=myboxstyle]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\end{mdframed}

\end{document}
3

The command \mdfcreateextratikz is executed in every frame. If you want to add material to special frame segments use the commands \mdf@Xextra whereby X stands for:

  • single
  • first
  • middle
  • second

In your case:

\renewrobustcmd\mdf@singleextra{%
    \node[titlebox,xshift=\tmplen,anchor=center] at (P-|O) {\raisebox{3\depth}{\mdf@frametitlefont{ Summary }}};}
\renewrobustcmd\mdf@firstextra{%
    \node[titlebox,xshift=\tmplen,anchor=center] at (P-|O) {\raisebox{3\depth}{\mdf@frametitlefont{ Summary }}};}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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