\section

Synopsis, one of:

\section{title}
\section*{title}
\section[toc-title]{title}

Start a section. The standard LaTeX classes article, book, and report all have this command.

This produces a section.

In this Part we tend to be more interested in the function,
in the input-output behavior,
than in the details of implementing that behavior.

\section{Turing machines}
Despite this desire to downplay implementation,
we follow the approach of A~Turing that the
first step toward defining the set of computable functions
is to reflect on the details of what mechanisms can do.

For the standard LaTeX classes book and report the default output is like ‘1.2 title’ (for chapter 1, section 2), alone on its line and flush left, in boldface and a larger type (the type size is \Large). The same holds in article except that there are no chapters in that class so it looks like ‘2 title’.

The * form shows title. But it does not show the section number, does not increment the section counter, produces no table of contents entry, and does not affect the running header. (If you use the page style headings in a two-sided document then the header will be from the prior section.)

The optional argument toc-title will appear as the section title in the table of contents (see Table of contents etc.) and in running headers (see Page styles). If it is not present then title will be there. This shows the full name in the title of the section,

\section[Elizabeth~II]{Elizabeth the Second,
  by the Grace of God of the United Kingdom,
  Canada and Her other Realms and Territories Queen,
  Head of the Commonwealth, Defender of the Faith.}

but only ‘Elizabeth II’ on the contents page and in the headers. This has a line break in title but that does not work with headers so it is omitted from the contents and headers.

\section[Truth is, I cheated; my life story]{Truth is,
  I cheated\\my life story}

For determining which sectional units are numbered and which appear in the table of contents, the level number of a section is 1 (see Sectioning/secnumdepth and see Sectioning/tocdepth).

The paragraph that follows the section title is not indented, as is a standard typographical practice. One way to get an indent is to use the package indentfirst.

In general, to change the behavior of the \section command, there are a number of options. One is the \@startsection command (see \@startsection). There are also many packages on CTAN that address this, including titlesec. See the documentation but the example below gives a sense of what they can do.

\usepackage{titlesec}   % in preamble
\titleformat{\section}
  {\normalfont\Large\bfseries}  % format of title
  {\makebox[1pc][r]{\thesection\hspace{1pc}}} % label
  {0pt}                   % length of separation between label and title
  {}                      % before-code hook
\titlespacing*{\section}
  {-1pc}{18pt}{10pt}[10pc]

That puts the section number in the margin.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/_005csection.html