[comp.text] Getting Underlined Section Headings To Wrap

jw@aplvax.jhuapl.edu (Jeff Wong) (08/06/88)

	I am trying to create a new document style using the `article'
document style as a basis.  My problem occurs when I try to underline the
subsection headings.  I use the \underbar command and pass it parameter
#8 (the subsection heading), see the example code below.  This works
quite well if, and only if, the subsection heading is no longer than one line.
If it is longer, it doesn't wrap and goes shooting dramatically off the page.
I have tried placing a \parbox and a \begin{minipage} environment around
the {\underline{\uppercase{#8}}}, but this doesn't seem to have any effect.
Can anyone suggest an appropriate solution.  Thanks in advance.

	Amanda S. Hanes  (using Jeff Wong's account)
---------------------------------Sample Code---------------------------------
\def\@startsubsection#1#2#3#4#5#6{\if@noskipsec \leavevmode \fi
   \par \@tempskipa #4\relax
   \@afterindenttrue
   \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
   \if@nobreak \everypar{}\else
     \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi \@ifstar
     {\@ssect{#3}{#4}{#5}{#6}}{\@dblarg{\@sectsub{#1}{#2}{#3}{#4}{#5}{#6}}}}

\def\@sectsub#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else 
     \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname }\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@ 
        \begingroup #6\relax
          \@hangfrom{\@svsec
		\hskip \secindent \relax}
		{\interlinepenalty \@M
		\hskip -.33em {\underline{\uppercase{#8}}}\par} 
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{#6\hskip #3\@svsec \hskip \secindent #8\csname
             #1mark\endcsname {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
                       #7}}\fi
     \@xsect{#5}}