(click anywhere to close)

# [LaTeX] Sectioning

category: Writing | course: LaTeX | difficulty:

The first step in creating a well-structured document is sectioning – dividing the text into smaller and smaller sections, subsections and paragraphs. LaTeX has very good support for this, as long as you don’t want a hierarchy more than 3 levels deep. But, that would result in a mess anyway, so you don’t want that.

These sectioning commands are available, in order of importance:

 Command Hierarchy Level Remarks \part{name} -1 \chapter{name} 0 Only available in books and reports \section{name} 1 \subsection{name} 2 \subsubsection{name} 3 \paragraph{name} 4 \subparagraph{name} 5

Letters don’t have any sectioning commands, and using them in such a document will result in an error.

\documentclass{book}

\begin{document}
\chapter{Chapter}
Lorem ipsum

\section{Section}
Lorem ipsum

\subsection{Subsection}
Lorem ipsum

\subsubsection{Subsubsection}
Lorem ipsum

\paragraph{Paragraph}
Lorem ipsum

\subparagraph{Subparagraph}
Lorem ipsum

\end{document}


## Advantages of Sectioning

The most important reason to use this is, of course, that is keeps your documents structured and well-organized. But, they also simplify your life quite a bit, for these reasons:

• They automatically gradually decrease font size, which means that, for instance, \part will be typeset with large letters, and \subsubsection typeset with small letters.
• They automatically number your sections. For example, the first \subsection after the second \section command will automatically have the number 2.1 prefixed.
• They make it easy to create an automatically updated table of contents.

## Turn off Numbering

If you don’t want a section to be numbered, use its star variation.

\section{I am a section}
\section*{Me too!}
\section{And three make a crowd.}


If your document has been structured well, all you have to do to create a table of contents is call the command \tableofcontents.

This only takes into account numbered sections, however, which means you need to add others you want to include manually. This is done by adding

\addcontentsline{toc}{sectionType}{name}

right after you declare the section.

\tableofcontents

\section{First One}
Lorem ipsum...
\section{Second One}
Lorem ipsum...
\section*{Third One}
Lorem ipsum...


## Title Page

Right after you start the document, you have the opportunity to create a good-looking title page with some special commands: \title{title}, \author{authors}, \date{date}

Authors need to be separated by the \and command – most other commands and symbols won’t work on a title page. You can also use the \thanks{text} command to thank anyone.

You don’t need to define all of them, and if you leave out the date, LaTeX will just use today’s date. But, even if you’ve defined them, you need to tell the processor when you’re done with your title page and it can be created. This is done with the \maketitle command.

\title{This Is A Title!}
\author{Made by Me \and Myself \and I}
\date{\today}

\maketitle


## Abstract

Most (scientific) papers start by providing an abstract or summary of what’s inside, and LaTeX has the abstract environment for that. It automatically adds the text Abstract above it, but you’ll learn later on how to customize that.

\begin{abstract}
This documents is about something very interesting that you can't really understand without reading it, but this will give you the summary anyway.
\end{abstract}

CONTINUE WITH THIS COURSE
Do you like my tutorials?
To keep this site running, donate some motivational food!
Crisps
(€2.00)
Chocolate Milk
(€3.50)
Pizza
(€5.00)