LaTeX Document Structure

This article discusses LaTeX document structure for letter, article, report, and book document classes.
1 Introduction
LaTeX is a markup-based typesetting system widely used for writing scientific works, reports, books, and theses.
One popular platform for writing and composing LaTeX documents is Overleaf, an online editor that enables real-time collaboration and provides complete documentation and templates.
Before starting document writing, it’s important to understand the basic structure of LaTeX documents.
A .tex file generally consists of three main parts:
- Preamble – initial document settings before
\begin{document} - Body – main document content between
\begin{document}and\end{document} - Additional sections – such as appendices, bibliography, or index
2 General Structure of LaTeX Documents
The minimal structure of a LaTeX document is as follows:
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{Document Title}
\author{Author Name}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
Your introduction text here.
\end{document}
Overleaf explains that every LaTeX document must begin with a \documentclass{} declaration and end with \end{document}.
3 Preamble
The preamble contains all initial settings before the document begins. It typically includes:
3.1 Document Class
\documentclass[12pt, a4paper]{article}
The document class determines the type and general style of the document.
Some standard classes:
| Class | Description |
|---|---|
article |
For articles, short reports, or papers |
report |
For long reports, final projects, or dissertations |
book |
For books with chapters |
letter |
For formal letters |
3.2 Packages
Packages extend LaTeX’s capabilities.
Common examples:
\usepackage[utf8]{inputenc} % Set text encoding
\usepackage[T1]{fontenc} % Set font encoding
\usepackage{graphicx} % Insert images
\usepackage{amsmath, amssymb} % Mathematical symbols and formulas
3.3 Document Metadata
Metadata contains information such as title, author, and date.
\title{LaTeX Document Example}
\author{Author Name}
\date{\today} % or can be left empty with {}
This metadata is used when the \maketitle command is called in the document body.
4 Document Body
This section contains the main content between \begin{document} and \end{document}.
Example basic structure:
\begin{document}
\maketitle
\section{Introduction}
Opening or introductory section of the topic.
\section{Methodology}
Explaining research methods or steps.
\subsection{Steps}
More detailed explanation of the method.
\section{Conclusion}
Final conclusion of the discussion.
\end{document}
4.1 Section Numbering
LaTeX automatically numbers sections (\section, \subsection, etc.).
For unnumbered sections, use an asterisk:
\section*{Acknowledgments}
4.2 Adding Images
Use the graphicx package:
\usepackage{graphicx}
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{image.png}
\caption{Example Image}
\label{fig:example}
\end{figure}
4.3 Writing Formulas and Equations
Use the amsmath package:
\begin{equation}
E = mc^2
\end{equation}
5 Additional Sections (Optional)
For academic documents or books, LaTeX provides additional divisions such as:
5.1 Frontmatter, Mainmatter, and Backmatter
\frontmatter % For front matter (abstract, table of contents)
\tableofcontents
\mainmatter % Main content (chapters, subchapters)
\chapter{Introduction}
\backmatter % Back matter (bibliography, appendices)
\appendix
\chapter{Appendix}
5.2 Bibliography
Use biblatex for automatic bibliography:
\usepackage{biblatex}
\addbibresource{bibliography.bib}
...
\printbibliography
6 Minimal Document Example
Here’s an example of the simplest valid document:
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{Hello World in LaTeX}
\author{Author}
\date{}
\begin{document}
\maketitle
\section{Introduction}
This is a minimal document example in LaTeX.
\end{document}
7 Tips and Best Practices
- Use separate folder structure (
/images,/chapters,/bib) to make large documents easier to manage. - Separate each chapter into
.texfiles and call them with\input{}or\include{}. - Use the Overleaf Outline Panel to quickly view document structure.
- Avoid loading excessive unnecessary packages to maintain compilation performance.
8 Conclusion
The basic structure of LaTeX documents is highly organized and modular.
By understanding the division between preamble, body, and additional sections, writers can manage technical documents more efficiently.
Overleaf provides complete guides, practical examples, and templates that make it easier for new users to learn and write professional documents.
8.1 📚 References
- Learn LaTeX in 30 Minutes – Overleaf
- Sections and Chapters – Overleaf
- How to Write a Thesis in LaTeX (Part 1): Basic Structure – Overleaf
- Inserting Images – Overleaf
- Bibliography Management with BibLaTeX – Overleaf
- Using the File Outline in Overleaf