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.

Henri Menke
  • 109,596
MadyYuvi
  • 13,693

3 Answers3

3

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

Ignasi
  • 136,588
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

Martin Scharrer
  • 262,582
  • Thanks for the nice solution...it's work absolutely fine for me... – MadyYuvi Jan 22 '19 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 '19 at 15:15
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.

Peter Wilson
  • 28,066