% From: Peter Schmitt <A8131DAL%AWIUNI11.BITNET@SHSU.edu>
% Newsgroups: comp.text.tex
% Subject: Re: Titled boxed text
% Date: Fri, 22 Jan 93 14:30:41 MEZ
% > From: stuart@coral.cs.jcu.edu.au (Stuart Kemp)
% > Subject: Need help with macro
% > Date: 17 Jan 93 07:12:59 GMT
% >                       === Title ===
% >                       || Some    ||
% >                       || Text    ||
% >                       || Here    ||
% >                       =============
% The following definitions should work:
% (You may want to adapt the kern's to the values you prefer!)
\def\tboxit#1#2{{\setbox0=\hbox{\kern5pt#1\kern5pt}\edef\titlewidth{\the\wd0}%
                \setbox2=\vbox{#2}
                \setbox2=\vbox{%
                    \vbox to1pt{\vss\hbox to\wd2{\strut\hfil#1\hfil}\vskip0pt}%
                    \box2
                    }
                \Tboxit{\titlewidth}{\Tboxit{\titlewidth}{\box2}}}}
\def\Tboxit#1#2{\vbox{%
    \setbox0=\hbox{\vrule\kern3pt\vbox{\kern3pt#2\kern3pt}\kern3pt\vrule}%
    \hbox to\wd0{\hrulefill\kern#1\hrulefill}\nointerlineskip
    \box0
    \hrule
    }}
\endinput
%
%%% Tests:
\documentstyle[tboxit]{article}
\begin{document}
\setbox2=\vbox{\hsize6cm
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
              }
$$\tboxit{Title}{\box2}$$
\tboxit{New Title}{\vbox{\hsize7cm
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
   Test this boxing macro!
              }}
\end{document}
% Peter Schmitt                   a8131dal@awiuni11.edvz.univie.ac.at
%                                               schmitt@awirap.bitnet
% Institute of Mathematics                           Strudlhofgasse 4
% University of Vienna                                    A-1090 Wien
%                                                             Austria
