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.

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}
share|improve this question
add comment

1 Answer

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 }}};}
share|improve this answer
add comment

Your Answer

 
discard

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.