Document Structure & Sectioning
Learn how to configure document classes, custom page styles, sectioning hierarchies, and multi-file project structures.
Document Structure & Preamble
Comprehensive syntax, arguments, options, and copyable snippets for document structure & preamble.
\documentclass{class}
Declares the document class (article, report, book, letter, beamer, etc.)
Document Classes & Options:
• Classes: article (papers/essays), report (theses with chapters), book (two-sided books), beamer (slides).
• Font Sizes: 10pt, 11pt, 12pt.
• Paper Sizes: a4paper, letterpaper.
• Layouts: twocolumn, onecolumn, titlepage, draft, final.
\documentclass{article}
\usepackage{package}
Loads a package
\usepackage{amsmath}
\usepackage[options]{package}
Loads a package with options
\usepackage[utf8]{inputenc}
\begin{document}
Starts the document body
\begin{document}
\end{document}
Ends the document body
\end{document}
\title{text}
Sets the document title
\title{A Study of Light Scattering}
\author{text}
Sets the document author(s)
\author{Deb}
\date{text}
Sets the document date
\date{\today}
\maketitle
Typesets the title block
\maketitle
\newcommand{\name}[n]{def}
Defines a new command with n arguments
\newcommand{\vect}[1]{\mathbf{#1}}
\renewcommand{\name}[n]{def}
Redefines an existing command
\renewcommand{\arraystretch}{1.5}
\providecommand{\name}{def}
Defines a command only if not already defined
\providecommand{\eps}{\varepsilon}
\newenvironment{name}{begin}{end}
Defines a new environment
\newenvironment{note}{\begin{quote}\itshape}{\end{quote}}
\renewenvironment{name}{begin}{end}
Redefines an existing environment
\renewenvironment{abstract}{\small}{}
\input{file}
Inserts contents of another file
\input{chapter1}
\include{file}
Includes another file (starts new page)
\include{chapter2}
\includeonly{file1,file2}
Restricts which \include files are processed
\includeonly{chapter1,chapter3}
\newpage
Starts a new page
\newpage
\clearpage
Flushes floats and starts a new page
\clearpage
\cleardoublepage
Clears page, ensures next page is odd-numbered
\cleardoublepage
\pagebreak
Suggests a page break
\pagebreak
\nopagebreak
Suggests no page break
\nopagebreak
\linebreak
Suggests a line break
\linebreak
\nolinebreak
Suggests no line break
\nolinebreak
\pagestyle{style}
Sets the page style (plain, empty, headings, fancy)
\pagestyle{fancy}
\thispagestyle{style}
Sets page style for current page only
\thispagestyle{empty}
\pagenumbering{style}
Sets page numbering style (arabic, roman, alph)
\pagenumbering{roman}
Document Hierarchy & Sectioning
Comprehensive syntax, arguments, options, and copyable snippets for document hierarchy & sectioning.
\part{title}
Top-level sectioning (books/reports)
\part{Introduction}
\chapter{title}
Chapter heading (report/book classes)
\chapter{Light Scattering Theory}
\section{title}
Section heading
Sectioning Hierarchy: \part (-1) → \chapter (0) → \section (1) → \subsection (2) → \subsubsection (3) → \paragraph (4) → \subparagraph (5). Automatically increments numbering, updates running headers, and registers in the Table of Contents. Use \section[Short Title]{Full Title} for compact TOC entries.
\section{Methodology}
\subsection{title}
Subsection heading
\subsection{Sample Preparation}
\subsubsection{title}
Sub-subsection heading
\subsubsection{Calibration}
\paragraph{title}
Paragraph-level heading
\paragraph{Note.}
\subparagraph{title}
Sub-paragraph-level heading
\subparagraph{Remark.}
\section*{title}
Unnumbered section heading
Unnumbered Section: Suppresses section numbering and omits the heading from the Table of Contents by default (ideal for Acknowledgments, Forewords, or References).
\section*{Acknowledgments}
\appendix
Switches sectioning to appendix numbering
\appendix
\tableofcontents
Generates table of contents
\tableofcontents
\listoffigures
Generates list of figures
\listoffigures
\listoftables
Generates list of tables
\listoftables
\addcontentsline{file}{unit}{text}
Manually adds an entry to a TOC-like list
\addcontentsline{toc}{section}{References}
\addtocontents{file}{text}
Adds text directly to a TOC-like file
\addtocontents{toc}{\protect\newpage}