7

I'm looking for advise about handling sections a a special way. What I want:

  1. Sections should not be numbered,

  2. they should be listed in the TOC and be available in the page header,

  3. and they should have not left indention.

A very much abridged version of what I'm currently trying is this:

\documentclass{book}

% No section numbers.
\renewcommand{\thesection}{}

\begin{document}

\tableofcontents

\chapter{Foo}

% This section should be in the TOC and the page header.
\section{Bar}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. 

\end{document}

Unfortunately this does not produce the desired result. 1. and 2 work but 3. doesn't: the section titles have a left indention in the text.

How can I make all three requirenments work at the same time?

1 Answer 1

8

You only need to set the counter secnumdepth to 0:

\setcounter{secnumdepth}{0}

The value of this counter determines the depth of the numbering. 0 means until chapter, 1 means until section, 2 until subsection, etc.

This counter doesn't determine if the numbered or unnumbered section gets an entry into the table of contents. This can be customized in a similar way but with the counter tocdepth.

So to the requirements:

  1. Done by \setcounter{secnumdepth}{0}
  2. Ensured by a value of tocdepth of 1 or higher - no change needed, since 2 is default
  3. There's no indentation since there's no number and no reserved space for it.
1
  • One issue with this is that one gets things like "CHAPTER 1 FOO" in the header.
    – Kimball
    Sep 5, 2015 at 20:50

You must log in to answer this question.