fischer@umn-cs.CS.UMN.EDU (Scott W. Fischer) (06/23/89)
Hello- I sent this originally to TeXhax, but I thought I'd send it out for others to look at also. I'm trying to define an EXAMPLEBOX environment. I would like to use it in one of the following two ways. \examplebox{box caption}{contents of box, pictures, lists, unlimited possibilities} or \begin{examplebox}[box caption] contents of box pictures lists etc \end{examplebox} The output I would like would be an outlined box with arbitrary contents with either the caption left justified on the first line of the box, or centered below (and outside) the box. Eventually I would like to have the examples automatically numbered, but that is a separate problem. Using example 21.3 of The TeXbook, I can get what I want if I assign the contents of the box to a box register and then use the first style of calling. If, however, I just place the contents of the box, rather than the register name, in the second pair of {} I get errors for having too many "}"s. I haven't been able to even come close with defining a boxed in environment. Any help, suggestions, similar style fragments would be greatly appreciated. Thanks. -- /\ /\ || Scott Fischer (612) 625-0876 || ADA, C, Pascal, Fortran //\\ .. //\\ || 4-192 EE/CS, 200 Union St. SE || phones, cabling, network ///\(( ))/\\\ || Minneapolis, MN 55455 || diag, documentation -- / < `' > \ || EM: fischer@umn-cs.cs.umn.edu || Slave labor does it all.
bts@sas.UUCP (Brian T. Schellenberger) (06/28/89)
This puts a box around arbitrary text. It also happens to set up \. for leaders, but that's a separate issue. The key is using \bgroup and \egroup. Also, if you want to allow arbitrary text, you *must* take a width a a parameter, or use a hard-coded one (possibly some smidge less than \textwidth). . . . \newenvironment {leaderbox*} [1] { \begingroup \par \noindent \hfill \setbox0=\vbox \bgroup \hsize #1 \@parboxrestore \let \. = \leaderfill } { \egroup \fbox{\box0} \hfill \penalty0 \par \endgroup } -- -- Brian, the Man from Babble-on. ...!mcnc!rti!sas!bts -- "Every jumbled pile of person has a thinking part that wonders what the part that isn't thinking isn't thinking of" -- THEY MIGHT BE GIANTS