# Framed boxed text with “continued” text on page break

I need to write a boxed text as like as:

Currently, I am using

\documentclass{book}
\usepackage{framed}
\begin{document}

\begin{framed}
\section{Box 15...}
...
\end{framed}

\end{document}


• Do you need an automatic page break or do you can break the text manually? – Martin Scharrer Jan 16 at 13:57
• @MartinScharrer It is better, if I get auto pagebreak, please... – MadyYuvi Jan 16 at 13:59
• Well, framed text with page break can be done easily with the mdframed package. Do you need the "continued" markers or can you do without them? – Martin Scharrer Jan 16 at 14:02
• @MartinScharrer Sorry to trouble you, I require the auto pagebreak with "continued" marked also too by auto. able to understand the pain, but pl help... – MadyYuvi Jan 16 at 14:07
• No problem, just needed to clarify that. – Martin Scharrer Jan 16 at 14:10

Based on egregs answer to "Breakable vboxes" I coded the following environment. It collects its vertical input and then breaks it using plainTeX's internal breaking mechanism (\vsplit) and places both part in an \fbox. This will not work for large material which break across three pages, but this feature could be added.

\documentclass{article}

\usepackage{blindtext}% just for example text

\newbox\totalbox
\newbox\partialbox
\newdimen\partialboxdim

\newenvironment{continueframe}{%
\hsize=\linewidth
\partialboxdim=\dimexpr\pagegoal-\pagetotal-\pageshrink-6pt-\baselineskip\relax
\setbox\totalbox=\vbox\bgroup\begingroup
}{%
\endgraf\endgroup\egroup
\setbox\partialbox=\vsplit\totalbox to\partialboxdim
\par\smallskip
\hbox{\fbox{\vbox{\unvbox\partialbox}}}\nopagebreak
\par\smallskip\mbox{}\hfill\textbf{Continued on next page}\par\pagebreak%
\hbox{\fbox{\vbox{\noindent\textbf{Contuined from last page}\par\smallskip\unvbox\totalbox}}}%
\par\medskip
}

\begin{document}

\blindtext
\blindtext
\blindtext

\begin{continueframe}
\blindtext
\blindtext
\blindtext
\end{continueframe}

\blindtext
\blindtext
\blindtext

\end{document}


• Thanks for the nice solution...it's work absolutely fine for me... – MadyYuvi Jan 22 at 14:28
• @MadyYuvi: Glad I could help you. Please note that my code might be less stable or supported by features of some packages as a released package like tcolorbox or similar. As long as it works for you it is fine, however. – Martin Scharrer Jan 22 at 15:15

Another solution with tcolorbox package.

\documentclass{article}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}

\newtcolorbox[auto counter]{mybox}[2][]{%
breakable,
enhanced,
sharp corners,
colback=white,
fonttitle=\bfseries,
title=Box~\thetcbcounter:\ #2,
enlarge bottom at break by=5mm,
enlarge top at break by=5mm,
overlay first={%
\draw[black, line width=0.5mm](frame.south west)--(frame.south east);
\node[anchor=north east] at (frame.south east) {continued on next page};
},
overlay middle={%
\draw[black, line width=0.5mm](frame.south west)--(frame.south east);
\draw[black, line width=0.5mm](frame.north west)--(frame.north east);
\node[anchor=north east] at (frame.south east) {continued on next page};
\node[anchor=south west] at (frame.north west) {continued from next page};
},
overlay last={%
\draw[black, line width=0.5mm](frame.north west)--(frame.north east);
\node[anchor=south west] at (frame.north west) {continued from next page};},
#1
}

\begin{document}
\lipsum[1-2]
\begin{mybox}{Combined off-springs size theories}
\lipsum[3-16]
\end{mybox}

\end{document}


This may be of some help to you.

The continue package prints "continuation" marks on pages of multipage documents. The marks can be defined as you wish and started and stopped at any point. To read the manual > texdoc continue.

• Thanks for the continue package, will look into this, and use the same... – MadyYuvi Jan 22 at 14:29