%%% fixing \vtop

% \catcode`\|13
% \def\stripit#1>{}
% \def|#1|{{\tt\toks0{#1}\edef\next{\the\toks0}%
%  \expandafter\stripit\meaning\next}\unskip}

\verb|\vtop| happens to lose the correct top of line information when it
starts with a whatsit.  We can reconstitute this in the following
manner:

\beginverbatim
\def\fvtop#{\vtop\bgroup
	\setbox0\vbox\bgroup
	\aftergroup\fvboxii
	\let\next=}

\def\fvboxii{\setbox0\vtop{\break\unvbox0}%
	\dimen0=\maxdimen
	\ifdim\dp0>0pt \advance\dimen0-\dp0 \fi
	{\splittopskip\dimen0 \setbox0\vsplit0to0pt}%
	\advance\dimen0-\ht0%
	{\splittopskip-\maxdimen\setbox0\vsplit0to0pt}%
	\advance\dimen0\ht0%
	\hrule height\dimen0 depth-\dimen0
	\unvbox0
  \egroup}
\endverbatim

The trick here is to use \verb|\vsplit| which pads the
followup box sufficiently to reach a given line height on the top
line. We essentially tell it to make this line fit \verb|\maxdimen| minus
a safety margin and see how far it gets.  Then we remove the padding
with another split and start the box with a strut that establishes the
corrected height.

\beginverbatim
\def\example{\hbox{First good line}%
\hbox{Second good line}%
\hbox{Third good line}}

\leavevmode
\vtop{\example}%
\vtop{\write-1{}\example}%
\fvtop{\write-1{}\example}
\endverbatim

%%%

\def\fvtop#{\vtop\bgroup
	\setbox0\vbox\bgroup
	\aftergroup\fvboxii
	\let\next=}

\def\fvboxii{\setbox0\vtop{\break\unvbox0}%
	\dimen0=\maxdimen
	\ifdim\dp0>0pt \advance\dimen0-\dp0 \fi
	{\splittopskip\dimen0 \setbox0\vsplit0to0pt}%
	\advance\dimen0-\ht0%
	{\splittopskip-\maxdimen\setbox0\vsplit0to0pt}%
	\advance\dimen0\ht0%
	\hrule height\dimen0 depth-\dimen0
	\unvbox0
  \egroup}

\leftskip 2em
\def\example{\hbox{First good line}%
\hbox{Second good line}%
\hbox{Third good line}}

\leavevmode
\vtop{\example}%
\vtop{\write-1{}\example}%
\fvtop{\write-1{}\example}
