## How to use sections and paragraphs in LaTeX. A brief introduction to headings and more about document layout.

[Open document online]

We have created a very basic document in the previous lesson, but when writing a paper, it's necessary to structure the content into logic units. To achieve this, LaTeX offers us commands to generate section headings and number them automatically. The commands to create section headings are straightforward:

\section{}
\subsection{}
\subsubsection{}

\paragraph{}
\subparagraph{}

## Example output for section and subsection

In order to get this output, we just have to add a few lines to our program from lesson 1:

\documentclass{article}

\title{Title of my document}
\date{2013-09-01}
\author{John Doe}

\begin{document}

\maketitle
\pagenumbering{gobble}
\newpage
\pagenumbering{arabic}

\section{Section}

Hello World!

\subsection{Subsection}

Structuring a document is easy!

\end{document}

## Hierarchy of all sectioning elements

The following picture shows the hierarchical structure of all elements:

I have used the following code to get this output:

\documentclass{article}

\begin{document}

\section{Section}

Hello World!

\subsection{Subsection}

Structuring a document is easy!

\subsubsection{Subsubsection}

More text.

\paragraph{Paragraph}

Some more text.

\subparagraph{Subparagraph}

Even more text.

\section{Another section}

\end{document}


It's very easy to structure documents into sections using LaTeX. This feature also exists in Word, but most people don't use it properly. In LaTeX it is very effortless to have consistent formatting throughout your paper. In the next lesson I will give a short introduction to packages and show some basic math typesetting. This is where LaTeX really excels.

## Summary

• LaTeX uses the commands \section, \subsection and \subsubsection to define sections in your document