对于我的任务,我使用 Cals 包。我为许多页面创建了表格,并在页面末尾进行换行。在这个包中,它描述了行分配。但它只适用于行,并且不会检测发生换行的单元格。当新页面开始时,内容总是插入到第一个单元格,即使换行操作发生在第二个单元格中。主要问题是如何正确检测哪个单元格换行以及如何将内容排版到正确的单元格。这个包是否允许将行拆分为页面末尾的单元格并在下一页中更正起始行(包括单元格)?
代码:
\makeatletter
\let\oldDispatch=\cals@row@dispatch
\newbox\rowBefore
\newbox\rowAfter
\newbox\decorationCopy
\newdimen\splitHeight
\def\cals@row@dispatch{%
\cals@ifbreak\iftrue
\splitHeight=\pagegoal \advance\splitHeight -\pagetotal
\ifdim \splitHeight>50pt % break inrow only if at least 100pt left
\advance\splitHeight -5pt
\setbox\rowBefore=\hbox{}
\setbox\rowAfter=\hbox{}
\def\next{%
\setbox0=\lastbox
\ifvoid0
\def\next{\global\setbox\rowBefore=\box\rowBefore
\global\setbox\rowAfter=\box\rowAfter
}%
\else
\setbox2=\vsplit0 to\splitHeight
\setbox\rowBefore=\hbox{\box2 \unhbox\rowBefore}%
\setbox\rowAfter=\hbox{\box0 \unhbox\rowAfter}%
\fi
\next}
\setbox0=\hbox{\unhbox\cals@current@row \next}
\setbox\decorationCopy=\copy\cals@current@cs
\setbox\cals@current@row=\box\rowBefore
\ht\cals@current@cs=\ht\cals@current@row
\oldDispatch
\cals@issue@break
\setbox\cals@current@row=\box\rowAfter
\cals@reheight@cells\cals@current@row
\setbox\cals@current@cs=\box\decorationCopy
%
\ht\cals@current@cs=\ht\cals@current@row
%\let\cals@current@context=b
\fi
\fi
\oldDispatch}
\begin{myenv}
\colwidths{{6.6cm}{10.97cm}}
\hrule width\hsize \vskip0pt
\brow \cell {\vspace{-15pt} \subsubsection{Very long text}}\cell { Very long text
} \erow
\end{myenv}