On Sat, Nov 24, 2001 at 12:59:54AM -0500, James Lindenschmidt wrote:
> Is there any way to have a table of contents automagically generated when 
> using section*/subsection*/subsubsection* that don't have the automatic 
> numbering (as opposed to section/subsection/subsubsection)?
> 
> In other words, I don't want each section/subsection/subsubsection to be 
> numbered in the document, but I do want each section/subsection/subsubsection 
> to be listed in the table of contents.

Add the following lines to the preamble:
(note that you will have a Contents entry in the TOC, since the Contents
header is typset using \section*. It is possible to remove it.

\def\@startsection#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{#1}{#2}{#3}{#4}{#5}{#6}}%
    {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}

\def\@ssect#1#2#3#4#5#6#7{%
  \@tempskipa #5\relax
  \ifdim \@tempskipa>\z@
    \begingroup
      #6{%
        \@hangfrom{\hskip #3}%
          \interlinepenalty \@M #7\@@par}%
    \endgroup
    \addcontentsline{toc}{#1}{#7}%  
  \else
    \def\@svsechd{#6{\hskip #3\relax #7}}%
    \addcontentsline{toc}{#1}{#7}%  
  \fi
  \@xsect{#5}}

Reply via email to