带框的文本,分页符处有“继续”文本

带框的文本,分页符处有“继续”文本

我需要写一个像这样的盒装文字:

在此处输入图片描述

目前,我正在使用

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

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

\end{document}

请指教。

答案1

基于egregs 回答“可破坏的 vbox”我编写了以下环境。它收集垂直输入,然后使用 plainTeX 的内部拆分机制 ( \vsplit) 拆分它,并将两个部分放在 中\fbox。这对于跨三页拆分的大型材料不起作用,但可以添加此功能。

\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}

在此处输入图片描述

答案2

另一个带有tcolorbox包的解决方案。

\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}

在此处输入图片描述

答案3

这也许对你有帮助。

continue软件包可在多页文档的页面上打印“连续”标记。您可以根据需要定义标记,并在任何位置开始和停止。阅读手册> texdoc continue

相关内容