1

I need to write a boxed text as like as:

enter image description here

Currently, I am using

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

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

\end{document}

Please advise.

  • 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
2

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}{%
    \advance\linewidth-2\fboxsep
    \advance\linewidth-2\fboxrule
    \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}

enter image description here

  • 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
2

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}

enter image description here

2

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

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.