% /u/sy/beebe/tex/namelist.sty, Mon Oct 14 13:00:09 1991
% Edit by Nelson H. F. Beebe <beebe@magna.math.utah.edu>
%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Nelson H. F. Beebe",
%%%     version         = "1.00",
%%%     date            = "14 October 1991",
%%%     filename        = "namelist.sty",
%%%     address         = "Center for Scientific Computing
%%%                        Department of Mathematics
%%%                        South Physics Building
%%%                        University of Utah
%%%                        Salt Lake City, UT 84112
%%%                        USA
%%%                        Tel: (801) 581-5254
%%%                        FAX: (801) 581-4148",
%%%     checksum        = "30570 89 388 3988",
%%%     email           = "beebe@magna.math.utah.edu (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "namelist, list environment",
%%%     supported       = "yes",
%%%     docstring       = "This LaTeX option file defines a new list
%%%                        environment, namelist, which is a variant
%%%                        of the standard description environment.
%%%                        It takes an additional required argument,
%%%                        the name of the LONGEST \item[] label, and
%%%                        then sets the item width and indentation so
%%%                        that all item labels lie to the left of
%%%                        their descriptive text, rather than being
%%%                        run in together as with the description
%%%                        environment.   Thus, you write
%%%
%%%                        \documentstyle[...,namelist,...]{...}
%%%                        ...
%%%                        \begin{namelist}{Summer Gnat Harvest}
%%%                        \item[Spring Gnat Harvest] ...
%%%                        \item[Summer Gnat Harvest] ...
%%%                        \item[Fall Gnat Harvest] ...
%%%                        \item[Winter Gnat Harvest] ...
%%%                        \end{namelist}
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================


\newcommand{\namelistlabel}[1]{%
    \setbox\@tempboxa=\hbox{#1\hfill}%
    \ifdim\wd\@tempboxa>\labelwidth%
        % I have not been able to figure out just what the width
        % should be here, despite hours of experiment.  The amount of
        % overfullness seems to have no relation to the parameters
        % \leftmargin, \labelwidth, \labelsep, \linewidth,
        % \rightmargin, \leftmargin, \textwidth, and
        % \@totalleftmargin.  In desperation, I'm setting it to
        % \textwidth, which generates an overfull box message which I
        % then eliminate by enlarging \hfuzz below.  This, however,
        % eliminates overfull box messages in the entire environment,
        % which is not good.
        \hbox to \textwidth {\box\@tempboxa\hfill}%
    \else%
        \box\@tempboxa%
    \fi}

\def\nounderfullmessages{\hbadness=10000}

\newenvironment{namelist}[1]{%
\begin{list}{}%
    {%
      \hfuzz=\textwidth %eliminate overfull box messages on long labels
      \nounderfullmessages
      \newdimen\saveleftmargin
      \saveleftmargin=\leftmargin
      \advance \leftmargin by -\labelwidth
      \let\makelabel\namelistlabel%
      \settowidth{\labelwidth}{#1}%
      \advance \leftmargin by \labelwidth
    }%
  }{%
\leftmargin=\saveleftmargin
\end{list}}

\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%[End of namelist.sty]%%%%%%%%%%%%%%%%%%%%%%%%%%
