[comp.text] A few more .ip macros

clayton@thumper.UUCP (06/08/87)

Tom Hoffman wrote a latex macro that almost solves the .ip paragraph
problem.  I found his mixture of tex and latex confusing, so I rewrote
his solution in latex:

   \newenvironment{itemlist}[1]
      {\begin{list}{}{\settowidth{\labelwidth}{#1}
               \setlength{\leftmargin}{\labelwidth}
               \addtolength{\leftmargin}{\itemindent}
               \addtolength{\leftmargin}{\labelsep}
               \renewcommand{\makelabel}[1]{##1\hfill}}}%
      {\end{list}}

I also took a whack at a complete solution:

   % Back to tex we go.

   \def\ml#1{%
         \newbox \newlabel
	 \setbox \newlabel =\hbox{#1}%
         \ifdim \wd\newlabel >\labelwidth
            \newdimen \pad \pad=\textwidth
            \advance \pad by-\rightmargin
            \advance \pad by-\itemindent
            \advance \pad by-\labelsep
            \hbox to\pad {#1\hfill}%
            \else
	    #1\hfill \fi}
   
   \newenvironment{itemlist}[1]
      {\begin{list}{}{\settowidth{\labelwidth}{#1}
          \setlength{\leftmargin}{\labelwidth}
          \addtolength{\leftmargin}{\itemindent}
          \addtolength{\leftmargin}{\labelsep}
          \let\makelabel=\ml}}%
      {\end{list}}

This seems to work; it even nests, but the inner itemlists cause
overfull \hbox errors.  When I find I'm writing macros like \ml I
usually stop, calm down, and look for another solution.  However, I'm
going to cut my losses and let this one go.  Here's a hint for anybody
who picks it up:  white-space is very important (which is partly why I'm
letting this go).