The Structure of a Document

Last updated on 2025-04-30 | Edit this page

Estimated time: 12 minutes

Overview

Questions

  • How are LaTeX documents structured?

Objectives

  • Identify the different kinds of section commands in LaTeX.
  • Create a list within a LaTeX document.

Sections


In a word processor, you might use headings to organize your document.In LaTeX, we’ll use the section commands:

  • \section{...}
  • \subsection{...}

LaTeX will handle all of the numbering, formatting, vertical spacing, fonts, and so on in order to keep these elements consistent throughout your document. Let’s add sections to our document.

LATEX

% This command tells LaTeX what kind of document we are creating (article).
\documentclass{article}


% Everything before the \begin{document} command is called the preamble.
\begin{document} % The document body starts here
Hello World!

This is my first LaTeX document.

% The section command automatically numbers and formats the section heading.
\section{Sections}

I can add content to my first section!

% The subsection command does the same thing, but for sections within sections.
\subsection{Subsection}

I can put a subsection inside my first section.

\section{Second Section}

And this text will go into another section.

\end{document}

You should have something that looks like this:

Our document with sections added.

Callout

There are many different section commands in LaTeX, including \subsubsection{...}, \paragraph{...}, \chapter{...}, and more. Each of these commands will create a new section heading with a different level of indentation and numbering.

Some of these commands are only available in certain document classes, so be sure to check the documentation for the class you are using.

Lists


In LaTeX, as in markdown, there are two types of lists: ordered and unordered. They are both defined with \begin{...} and \end{...} commands, as we saw with the document body. Let’s add an ordered list to our document.

We’ll replace our “Second Section” with one for “Lists” and add an ordered list:

LATEX

% This command tells LaTeX what kind of document we are creating (article).
\documentclass{article}


% Everything before the \begin{document} command is called the preamble.
\begin{document} % The document body starts here
Hello World!

This is my first LaTeX document.

% The section command automatically numbers and formats the section heading.
\section{Sections}

I can add content to my first section!

% The subsection command does the same thing, but for sections within sections.
\subsection{Subsection}

I can put a subsection inside my first section.

\section{Lists}

There are two types of lists: ordered and unordered.

\subsection{Ordered}

Ordered lists have a number or letter associated with each item.

\begin{enumerate}
  \item Item 1
  \item Item 2
  \item Item 3
\end{enumerate}

\end{document}

When you compile this document, you should see something like this in the preview pane:

Our document with an enumerated list.

Callout

Note that the \item commands do not need to be enclosed in braces. These commands do not take any arguments, so they can be used as standalone commands. The text that follows the \item command will be treated as the content of the list item. However, you are able to specify your own bullet point symbols with \item[] manually. For instance, if you want a list with small letters in brackets you can use the following LaTeX code:

LATEX

% This command tells LaTeX what kind of document we are creating (article).
\documentclass{article}


% Everything before the \begin{document} command is called the preamble.
\begin{document} % The document body starts here

% List with custom bullet point symbols
\begin{itemize}
  \item[(a)] Item 1
  \item[(b)] Item 2
  \item[(c)] Item 3
\end{itemize}

\end{document}

Adding an unordered list is just as easy. We can use the exact same syntax, but replace the enumerate environment with itemize.

LATEX

% This command tells LaTeX what kind of document we are creating (article).
\documentclass{article}


% Everything before the \begin{document} command is called the preamble.
\begin{document} % The document body starts here
Hello World!

This is my first LaTeX document.

% The section command automatically numbers and formats the section heading.
\section{Sections}

I can add content to my first section!

% The subsection command does the same thing, but for sections within sections.
\subsection{Subsection}

I can put a subsection inside my first section.

\section{Lists}

There are two types of lists: ordered and unordered.

\subsection{Ordered}

Ordered lists do not have numbers or letters associated with each item.

\begin{enumerate}
  \item Item 1
  \item Item 2
  \item Item 3
\end{enumerate}

\subsection{Unordered}

Unordered lists are just a series of items preceded by a marker.

\begin{itemize}
  \item Item 1
  \item Item 2
  \item Item 3
\end{itemize}

\end{document}
Our document with an unordered list.

Challenges


Challenge 1: What needs to change?

We have the following in our LaTeX document:

LATEX

\documentclass{article}

\begin{document}

\begin{enumerate}
  \item Banana Bread
  \item Carrot Muffins
  \item Apple Cake
\end{enumerate}

\end{document}

How would we modify this to change this ordered list to an unordered list?

You would need to change the enumerate environment to itemize:

LATEX

\documentclass{article}

\begin{document}

\begin{itemize}
  \item Banana Bread
  \item Carrot Muffins
  \item Apple Cake
\end{itemize}

\end{document}

Challenge 2: Can you do it?

We would like to have the following appear in our LaTeX document:

  • Apples
    1. Gala
    2. Fuji
    3. Granny Smith
  • Bananas
  • Oranges

How would you write this in LaTeX?

LATEX

\documentclass{article}

\begin{document}

\begin{itemize}
  \item Apples
  \begin{enumerate}
    \item Gala
    \item Fuji
    \item Granny Smith
  \end{enumerate}
  \item Bananas
  \item Oranges
\end{itemize}

\end{document}

Challenge 3: Enumerate your list manually

We would like to have the following appear in our LaTeX document:

  1. Gala
  2. Fuji
  3. Granny Smith

How would you write this in LaTeX without using enumerate but itemize with \item[]?

LATEX

\documentclass{article}

\begin{document}

\begin{itemize}
  \item[1.] Gala
  \item[2.] Fuji
  \item[3.] Granny Smith
\end{itemize}

\end{document}

Key Points

  • LaTeX documents are structured using section commands.
  • There are many different section commands in LaTeX, including \subsubsection{...}, \paragraph{...}, \chapter{...}, and more.
  • Lists in LaTeX are created using the enumerate and itemize environments.