chmilar@calgary.UUCP (Michael Chmilar) (01/20/88)
\documentstyle{news} \begin{document} I have run into a situation where \TeX\ doesn't {\em quite\/} do what I want it to do. I've been beating my brains out trying to solve my problem; perhaps some kindly \TeX\ guru could offer a solution. \section{BACKGROUND} I have been a happy \LaTeX\ user for about six months now. It has suited me well, being able to meet (and exceed) my expectations. I have recently embarked upon a project which involves writing and documenting some C$++$ code. I thought that it would be pretty keen to define a new \LaTeX\ environment, called `class,' that would print info about C$++$ classes in a striking but well-formatted table. My results have (so far) been not quite right. \section{THE PROBLEM} Here is an approximation of the type of table I want: \begin{verbatim} --------------------------------------------------------------------- | Class: class_name Superclass: parent_name | | | | void afunction() What this function does- | | possibly a rather long | | description. | | listitem* next () Another description. | | void follow ( listitem* ) | | int func ( param, param, A function with a large | | param, another, number of parameters | | more, lastone ) | | double avar This is a variable, not a | | function, so it has no | | optional param list | | Inherited: | | double dfunc () Function inherited from | | superclass | --------------------------------------------------------------------- ^ ^ ^ ^ ^ var/func var/func optional Comment field Box type name parameter list \end{verbatim} This looks like it can be done pretty easily in the `tabular' environment. However, I would like to do something `clever:' sometimes, no function has any parameters; in this case, all functions are followed by `()', and a great deal of space is wasted; I would like to let the comment field have the {\em maximum\/} possible space (the parameter list is constrained to be no wider than some amount, after which it becomes multi-line. Another problem is that the first two fields are dynamically sized, while (normally) the last two must be static. If the first two become too wide, the comments are pushed past where they should go. I have read the {\em\TeX book\/} over the last few days, but I must admit that many of the `double dangerous bends' put me out to sea. From what I can understand of the `Dirty Tricks,' dynamic box sizing is possible, but it will take me some time to learn how to do this kind of stuff. I have already written some macros so that I can say things like \begin{verbatim} \begin{class}{class\_name}{parent\_name} \func rettype funcname(param, param) Comment\cr \var type varname Comment\cr \inherited \end{verbatim} but the box sizing has me stumped (at least for the moment---I haven't started injecting my \TeX\ into the mainline (yet!), and must still snort or smoke it, but I am getting there! \end{document} -- Michael Chmilar, University of Calgary, ..!{ihnp4,seismo!mnetor}!alberta!calgary!chmilar "What's your sign?" "It depends on my angle!"