[texhax] Adding section levels and repeated text.

Peter Davis pfd at pfdstudio.com
Sun Mar 27 23:26:18 CEST 2011


For a particular document, I'm trying to define up to six section levels,
using the \@startsection command.  However, any new levels (beyond
subsubsection) add the section title to the body text inside the section, in
addition to including it in the header.  In other words, the section title
is repeated, in body text, inside the section.  Can anyone explain this, or
how to prevent it?  Thank you!

-pd

Here's a simple sample:

\documentclass[11pt]{article}

\title{Adding Section Levels}

\begin{document}

\setcounter{secnumdepth}{6}

\makeatletter

\newcommand\hi{\@startsection %
  {section}{1}{0mm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalsize\sffamily\bfseries}}%

\newcommand\hii{\@startsection %
  {subsection}{2}{0mm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalsize\sffamily\bfseries}}%

\newcommand\hiii{\@startsection %
  {subsubsection}{3}{0mm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalsize\sffamily\bfseries}}%

\newcounter{subsubsubsection}
\newcommand\hiv{\@startsection %
  {subsubsubsection}{4}{0mm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalsize\sffamily\bfseries}}%
\renewcommand{\thesubsubsubsection}{\thesubsubsection.\arabic{subsubsubsection}}

\newcounter{subsubsubsubsection}
\newcommand\hv{\@startsection %
  {subsubsubsubsection}{5}{0mm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalsize\sffamily\bfseries}}%
\renewcommand{\thesubsubsubsubsection}{\thesubsubsubsection.\arabic{subsubsubsubsection}}

\newcounter{subsubsubsubsubsection}
\newcommand\hvi{\@startsection %
  {subsubsubsubsubsection}{6}{0mm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalsize\sffamily\bfseries}}%
\renewcommand{\thesubsubsubsubsubsection}{\thesubsubsubsection.\arabic{subsubsubsubsubsection}}

\makeatother

\hi{Level One}

Level oen paragraph.

\hii{Level Two}

Level two paragraph.

\hiii{Level Three}

Level three paragraph.

\hiv{Level Four}

Level four paragraph.

\hv{Level Five}

Level five paragraph.

\hvi{Level Six}

Level six paragraph.


\end{document}


-- 
----
The Tech Curmudgeon
http://www.techcurmudgeon.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110327/39e27af0/attachment.html>


More information about the texhax mailing list