Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is possible to set up a doc structure level newlevel, which is not subordinated by any other counters like section, subsection, subsubsection, etc., that is, when the else sec counter is added 1, the new level counter does not change. So we get a document like this:

section 1: the first section

subsection 1.1: the 1st subsection of the fist section

subsection 1.2: the 2nd subsection of the fist section

newlevel 1: I

subsection 1.3: the 3rd subsection of the fist section

newlevel 2: Have

section 2: the second subsection of the fist section

newlevel 3: A

subsection 2.1: the 1st subsection of the second section

subsection 2.2: the 2nd subsection of the second section

subsection 2.3: the 3rd subsection of the second section

newlevel 4: Dream

The most essential reason why I want to implement these is I can get display newlevel's label and title in both TOC and Header.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Yes it is possible. The counters of subsection etc are only reset when the section counters is set because they are defined this way:

\newcounter {subsection}[section]

So simply define your newlevel so that uses an independent counter, and then use \@startsection:

\documentclass{article}
\usepackage{color}
\makeatletter
\newcounter{newlevel}
\newcommand\newlevel{\@startsection {newlevel}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\color{blue}\normalfont\Large\bfseries}}
\newcommand\newlevelmark[1]{}
\begin{document}
\section{a}
\subsection{b}
\newlevel{I}

\newlevel{have}
\section{b}
\newlevel{a}

\subsection{c}
\newlevel{dream}
\end{document}
share|improve this answer
    
@U.F. Thanks. But even if I add a line \pagestyle{headings} in forearea (and add some blindtexts), I couldn't get a newlevel's title in header --- there's the section label and title, while I want the newlevel's label and title. –  Stufazi Hoqckt Apr 22 '11 at 23:36
    
You will have to redefine \newlevelmark and perhaps \sectionmark depending on your needs. E.g. \renewcommand\newlevelmark[1]{\markright{My new title: \thenewlevel~#}} and \renewcommand\sectionmark[1]{} –  Ulrike Fischer Apr 23 '11 at 9:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.