Chapter 11 – Developing Large Documents

Here are the Code examples of this chapter. You can compile them online right on this web page by pressing the Typeset / Compile button. You can also edit them for testing, and compile again.

For a better view with the online compiler, I sometimes use \documentclass[border=10pt]{standalone} instead of \documentclass{article}. Instead of having a big letter/A4 page, the standalone class crops the paper to see just the visible text without an empty rest of a page.

Any question about a code example? Post it on LaTeX.org, I will answer. As forum admin I read every single question there. (profile link).

Splitting the input

Preamble file:

% !TEX none
\usepackage{lmodern} 
\usepackage{microtype} 
\usepackage{natbib} 
\usepackage{tocbibind} 
\usepackage{amsmath} 
\usepackage{amsthm} 
\newtheorem{thm}{Theorem}[chapter] 
\newtheorem{lem}[thm]{Lemma} 
\theoremstyle{definition} 
\newtheorem{dfn}[thm]{Definition}

Chapter 1:

% !TEX none
\chapter{Equations}
\section{Quadratic equations}
\begin{dfn}
  A quadratic equation is an equation of the form
  \begin{equation}
    \label{quad}
    ax^2 + bx + c = 0
  \end{equation}
  where \( a, b \) and \( c \) are constants and \( a \neq 0 \).
\end{dfn}

Chapter 2:

% !TEX none
\chapter{Equation Systems}
\section{Linear Systems}
...
\section{Non-linear Systems}
...

Main document:

\documentclass{book}
\input{preamble}
\begin{document}
\tableofcontents
\include{chapter1}
\include{chapter2}
\end{document}

figure

Figure 11.1


Creating front and back matter

Dedication file:

\chapter{Dedication}
This book is dedicated to one of the greatest mathematicians of
all time: Carl Friedrich Gauss. Without him, this book wouldn't
have been possible.

Proofs file:

% !TEX none
\chapter{Proofs}
...

Main document:

% !TEX bibtex document
\documentclass{book}
\input{preamble}
\input{example}% only here on the website to create the example.bib file
\begin{document}
\frontmatter
\include{dedication}
\tableofcontents
\listoftables
\listoffigures
\mainmatter
\include{chapter1}
\include{chapter2}
\backmatter
\include{proofs}
\nocite{*}
\bibliographystyle{plainnat}
\bibliography{example}
\end{document}

figure

Figure 11.3


Designing a title page

Title file:

% !TEX none
\begin{titlepage}
  \raggedleft
  {\Large The Author\\[1in]}
  {\large The Big Book of\\}
  {\Huge\scshape Equations\\[.2in]}
  {\large Packed with hundreds of examples and solutions\\}
  \vfill
  {\itshape 2011, Publishing company}
\end{titlepage}

Main document:

% !TEX bibtex document
\documentclass{book}
\usepackage[a5paper]{geometry}% could go to the preamble instead
\input{preamble}
\input{example}% only here on the website to create the example.bib file
\begin{document}
\frontmatter
\include{title}
\include{dedication}
\tableofcontents
\listoftables
\listoffigures
\mainmatter
\include{chapter1}
\include{chapter2}
\backmatter
\include{proofs}
\nocite{*}
\bibliographystyle{plainnat}
\bibliography{example}
\end{document}

figure

Figure 11.4



Working with templates

\documentclass[fontsize=12pt, paper=a4]{scrlttr2}
\usepackage[utf8]{inputenc}
\setkomavar{fromname}{My name} % your name
\setkomavar{fromaddress}{Street, City}
\setkomavar{signature}{Name} % printed after the \closing
\setkomavar{subject}{Invoice 1/2021} % subject of the letter
\setkomavar{place}{Place}
\setkomavar{date}{January 1, 2021 }
\begin{document}
\begin{letter}{Customer Name\\ Street No. X \\ City \\ Zipcode}
  \opening{To whom it may concern} % eg. Hello
  Text follows \ldots
  \bigskip
  \closing{With kind regards} %eg. Regards
\end{letter}
\end{document}

figure

Figure 11.5



Working with dummy text / blind text

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\begin{abstract}
\blindtext
\end{abstract}
\Blinddocument
\end{document}

figure

Figure 11.6



This code is available on Github. It is licensed under the MIT License, a short and simple permissive license with conditions only requiring preservation of copyright and license notices.

Go to next chapter.