在多列输出中定义与 Plain TeX 等效的图形*

在多列输出中定义与 Plain TeX 等效的图形*

前段时间我尝试figure*为 Plain TeX 定义类似的东西。结果列高错误。

(看:Plain TeX 中双列输出的宽图

有提示要记住 vsize,所以我尝试了一下。请查看以下 MWE:

% For Plain LuaTeX
\catcode`@=11
\raggedbottom

\newdimen\fullhsize
\newdimen\columnsep
\columnsep 1cm
\fullhsize\hsize
\advance\hsize-\columnsep
\divide\hsize\tw@

\newdimen\fullvsize
\fullvsize\vsize

\def\fullline{\hbox to\fullhsize}
\def\makeheadline{\vbox to\z@{\vskip-22.5\p@
    \fullline{\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip}
\def\makefootline{\baselineskip24\p@\lineskiplimit\z@
    \fullline{\the\footline}}

% Twocolumn output
\newif\if@firstcolumn \@firstcolumntrue
\newbox\firstcolumn

\output={\ifvoid\widetopins\else%%%%%%%% try to change vsize
    \global\advance\vsize-\ht\widetopins
    \global\advance\vsize-\dp\widetopins\fi
    \if@firstcolumn \global\setbox\firstcolumn=\columnbox
    \global\@firstcolumnfalse
    \else
    \doubleformat \global\@firstcolumntrue\fi
    \ifnum\outputpenalty>-20000 \else\dosupereject\fi}

\def\doubleformat{\shipout\vbox{
    \makeheadline
    \ifvoid\widetopins\else\fullline{\box\widetopins}\fi
    \fullline{\box\firstcolumn\hfil\columnbox} \makefootline}
    \advancepageno
    \global\vsize\fullvsize}% reset \vsize

\def\columnbox{\leftline{\pagebody}}

% like figure* in LaTeX
\newinsert\widetopins
\skip\widetopins\z@skip
\count\widetopins=0 %%%%%%%% to change vsize manually
\dimen\widetopins=.5\vsize

\def\widetopinsert{\p@gefalse\par\begingroup
    \setbox\z@\vbox\bgroup\hsize\fullhsize}
\def\endwideinsert{\egroup
    \insert\widetopins{\penalty100 % floating insertion
    \splittopskip\z@skip
    \splitmaxdepth\maxdimen \floatingpenalty\z@
    \ifp@ge \dimen@\dp\z@
    \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero
    \else \box\z@\nobreak\bigskip\fi}\endgroup}

\def\mypicture{\vrule height 100pt depth 40pt width300pt}

\def\text{Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.}

\text\text\text

\widetopinsert
\centerline{\mypicture}
\endwideinsert

\text\text\text\text\text

\bye

在此处输入图片描述

从图片中可以看出,两个列都是错误的。两个列都进入了底部边距,而第二个列在顶部有空白。我做错了什么?如何\vsize正确更改?

相关内容