
\catcode`@=11 % from plain.tex
\newdimen\pagewidth \newdimen\pageheight \newdimen\ruleht
\newif\ifvrule\vruletrue
% These values were modified:
%\hsize and \vsize are also used in the \output routine
   \hsize=35pc  \vsize=54pc  \maxdepth=2.2pt  \parindent=2pc
   \hoffset=.4in
\pagewidth=\hsize \pageheight=\vsize \ruleht=.5pt

% This routine is used by \output ; this is different from
%   the one found in App. E since some are not needed here.
\def\onepageout#1{\shipout\vbox{\offinterlineskip
  \vbox to \pageheight {\makeheadline
       #1 % the content of page
       \makefootline \boxmaxdepth=\maxdepth}}
  \advancepageno}

\output{\onepageout{\unvbox255}}
\newbox\partialpage
\def\begindoublecolumns{\begingroup
  \output={\global\setbox\partialpage=\vbox{\unvbox255\bigskip}}\eject
  \output={\doublecolumnout} \hsize=17pc \vsize=109pc}
% Again the sizes have been changed !! %note new values for \hsize and \vsize
% this needs to be done more tidily
\def\enddoublecolumns{\output={\balancecolumns}\eject
  \endgroup \pagegoal=\vsize}
\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  \dimen@=54pc \advance\dimen@ by-\ht\partialpage
  % Need to change the value of \dimen@ also...
  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  \onepageout\pagesofar
  \unvbox255 \penalty\outputpenalty}
\def\pagesofar{\unvbox\partialpage
  \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil
  \ifvrule\vrule\fi\hfil\box2}}
\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0
  \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  \divide\dimen@ by2 \splittopskip=\topskip
  {\vbadness=10000 \loop \global\setbox3=\copy0
    \global\setbox1=\vsplit3 to\dimen@
    \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  \setbox0=\vbox to\dimen@{\unvbox1}
  \setbox2=\vbox to\dimen@{\dimen2=\dp3 \unvbox3\kern-\dimen2 \vfil}
  \pagesofar}
\vrulefalse

%Example use:
%   \hrule \bigskip
%   \centerline{THE BEAUTY AND THE MOUSE} \bigskip
%   Once upon a time, there lived a beautiful girl in a place far, far away...
%   \begindoublecolumns
%   Her only friend was a computer that came with a mouse as its input device.
%   \enddoublecolumns
%   The beauty and the mouse lived happily ever after.
%   \end


