[texhax] Adding section levels and repeated text.

jfbu jfbu at free.fr
Sun Mar 27 23:56:52 CEST 2011


Le 27 mars 11, à 23:26, Peter Davis a écrit :

> 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{subsubsub 
> section}}
>
> \newcounter{subsubsubsubsection}
> \newcommand\hv{\@startsection %
>   {subsubsubsubsection}{5}{0mm}%
>   {-\baselineskip}%
>   {0.5\baselineskip}%
>   {\normalsize\sffamily\bfseries}}%
> \renewcommand{\thesubsubsubsubsection}{\thesubsubsubsection.\arabic{sub 
> subsubsubsection}}
>
> \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 following seems to work:
(as an aside there was a missing "sub" at level 6)

\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[1]{\@startsection %
{subsubsubsection}{4}{0mm}%
{-\baselineskip}%
{0.5\baselineskip}%
{\normalsize\sffamily\bfseries}[]{#1}}%
\renewcommand{\thesubsubsubsection}{\thesubsubsection.\arabic{subsubsubs 
ection}}

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

\newcounter{subsubsubsubsubsection}

\newcommand\hvi[1]{\@startsection %
{subsubsubsubsubsection}{6}{0mm}%
{-\baselineskip}%
{0.5\baselineskip}%
{\normalsize\sffamily\bfseries}[]{#1}}%
\renewcommand{\thesubsubsubsubsubsection}{\thesubsubsubsubsection.\arabi 
c{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}

Regards,
Jean-Francois



More information about the texhax mailing list