Article View: comp.text.tex
Article #10649Re: Titled boxed text
From: Peter Schmitt
Date: Fri, 22 Jan 1993 13:30
Date: Fri, 22 Jan 1993 13:30
72 lines
2824 bytes
2824 bytes
I have not seen an answer on this, so maybe it is still open:
> From: stuart@coral.cs.jcu.edu.au (Stuart Kemp)
> Subject: Need help with macro
> Date: 17 Jan 93 07:12:59 GMT
>
> I would like to have a macro that can be given two parameters, a vbox and a
> title, and I would like the macro to draw a "double-box" (i.e. 2 lines,
> about 1mm apart) all around the vbox, and have the title appear on the lines
> at the top (without the horizontal lines visible under the title). i.e.
>
>
> === Title ===
> || Some ||
> || Text ||
> || Here ||
> =============
>
> I can do it without the 'Title' (\boxit{\boxit{\vbox{...}}}) ... can anyone
> help me out with this extra bit?
>
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
}}
%%% Tests:
\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
Peter
Peter Schmitt a8131dal@awiuni11.edvz.univie.ac.at
schmitt@awirap.bitnet
-----------------------------------------------------------------------------
Institute of Mathematics Strudlhofgasse 4
University of Vienna A-1090 Wien
Austria
Technical Details
Message-ID:
<10258298@MVB.SAIC.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!ucivax!news.service.uci.edu!unogate!mvb.saic.com!info-texShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!ucivax!news.service.uci.edu!unogate!mvb.saic.com!info-tex From: Peter Schmitt <A8131DAL%AWIUNI11.BITNET@SHSU.edu> Newsgroups: comp.text.tex Subject: Re: Titled boxed text Message-ID: <10258298@MVB.SAIC.COM> Date: Fri, 22 Jan 93 14:30:41 MEZ Organization: Info-Tex<==>Comp.Text.Tex Gateway X-Gateway-Source-Info: Mailing List Lines: 72