[comp.text] Doing ".ip" type paragraphs in LaTeX

salzman@rdlvax.UUCP (06/04/87)

I'd like to produce something similar to the ".ip" macro of troff -me
macros with TeX or LaTeX. Plain TeX has a macro "\item{xxx}" which
will do this:

    ITEM this is the paragraph.
         Etc., etc., etc...

  ITEM 1 this is the paragraph.
         Etc., etc., etc...

In LaTeX you can use "\begin{description} ... \item[xxx]" which will
do this:

    ITEM this is the paragraph.
         Etc., etc., etc....

    ITEM 1 this is the paragra-
         ph Etc., etc., etc.

And what I want is this (".ip" does it correctly):

    ITEM this is the paragraph.
         Etc., etc., etc....

    IT   this is the paragraph.
         Etc., etc., etc....

    ITEM 1
         this is the paragraph.
         Etc., etc., etc....

Get it? Headings are alligned vertically as well as the paragraphs. I'm
not a TeX guru yet, so does someone have a TeX macro that will do the
trick. It's a bit trick since you have to know whether or not the
heading will fit in the paragraph indent.... Any help would be appreciated.
Thanks!


--
* Isaac Salzman - Systems Analyst/Admin.                      ----     
* Research Development Labs (RDL)                            /o o/  /  
* 5721 W. Slauson Ave.                                       | v |  |  
* Culver City, California, 90230                            _|   |_/   
* AT&T: +1 213 410 1244, x118                              / |   |     
* UUCP: ...!{psivax,csun,sdcrdcf,ttidca}!rdlvax!salzman    | |   |     
* ARPA: salzman@rdlvax.RDL.COM				     |   |     
* NOTE: ** Our SMTP connection isn't up yet even though
*       we're in the host tables. Please use the UUCP
*       path to reply.

wtho@cgcha.UUCP (Tom Hofmann) (06/05/87)

> And what I want is this (".ip" does it correctly):
> 
>     ITEM this is the paragraph.
>          Etc., etc., etc....
> 
>     IT   this is the paragraph.
>          Etc., etc., etc....
> 
>     ITEM 1
>          this is the paragraph.
>          Etc., etc., etc....


Use the following in LaTeX:

-----------------------------------------------------------------
% New environment: itemlist
%
\newbox\itembox
\def\itemlistlabel#1{#1\hfill}
\def\itemlist#1{\setbox\itembox=\hbox{#1}%
                \list{}{\labelwidth\wd\itembox
		             \leftmargin\labelwidth
		             \advance\leftmargin by\itemindent
		             \advance\leftmargin by\labelsep
		             \let\makelabel\itemlistlabel}}
\let\enditemlist\endlist
-----------------------------------------------------------------

Then write

     \begin{itemlist}{<text>}
     \item[<item>] <anything>
     \item ...
     \end{itemlist}

where the width of <text> is the width of the item column.
If you write \begin{itemlist}{ITEM} in your example, it works as
you want in the first two cases, in the third case it creates:

     ITEM 1 this is the paragraph.
          Etc., etc., etc....

Tom Hofmann
CIBA-GEIGY AG
Scientific Computer Center
P.O.Box                        Phone: +41 61 / 372059
CH-4002 Basel                  uucp:  ...!mcvax!cgcha!wtho
Switzerland