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}
Please advise.
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}
tcolorbox
or similar. As long as it works for you it is fine, however.
Jan 22, 2019 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
.
mdframed
package. Do you need the "continued" markers or can you do without them?