Chapter 1 – Exploring various document classes

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 them again.

The code pages here are partially based on the First Edition of the book and are currently being edited to match the code of the Second Edition with all the additional examples. It is not complete yet since the focus was on the book production until days ago; please visit again soon!

Writing a short text

\documentclass[paper=a4,oneside,fontsize=11pt,
  parskip=full]{scrartcl}
\begin{document}
\tableofcontents
\addsec{Introduction}
This document will be our starting point for simple
documents. It is suitable for a single page or up to
a couple of dozen pages.

The text will be divided into sections.
\section{The first section}
This first text will contain
\begin{itemize}
\item a table of contents,
\item a bulleted list,
\item headings and some text and math in section,
\item referencing such as to section \ref{sec:maths} and
      equation (\ref{eq:integral}).
\end{itemize}
We can use this document as a template for filling in
our own content.
\section{Some maths}
\label{sec:maths}
When we write a scientific or technical document, we usually
include math formulas. To get a brief glimpse of the look of
maths, we will look at an integral approximation of a function
$f(x)$ as a sum with weights $w_i$:
\begin{equation}
  \label{eq:integral}
  \int_a^b f(x)\,\mathrm{d}x \approx (b-a)
  \sum_{i=0}^n w_i f(x_i)
\end{equation}
\end{document}

Developing a thesis

The book section is explaining using the ClassicThesis template and not writing own code.

Here you can open the template directly in Overleaf, with CTAN as the source: classicthesis.zip

Designing a book

\documentclass[fontsize=11pt,paper=a5,pagesize=auto]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{blindtext}
\frenchspacing
\begin{document}
\title{The Book}
\subtitle{Some more to know}
\author{The Author}
\date{}
\maketitle
\tableofcontents 
\part{First portion}
\chapter{The beginning}
Some introductional text comes here.
\section{A first section}
Dummy text will follow.
\blindtext
\section{Another section}
\Blindtext
\appendix
\part{Appendix}
\chapter{An addendum}
\section{Section within the appendix}
\blindtext
\end{document}

Title page

\documentclass[fontsize=11pt,paper=a5,pagesize=auto]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{blindtext}
\frenchspacing
\begin{document}
\begin{titlepage}
  \vspace*{1cm}
  {\huge\raggedright The Book\par}
  \noindent\hrulefill\par
  {\LARGE\raggedleft The Author\par}
  \vfill
  {\Large\raggedleft Institute\par}
\end{titlepage}
\tableofcontents 
\part{First portion}
\chapter{The beginning}
Some introductional text comes here.
\section{A first section}
Dummy text will follow.
\blindtext
\section{Another section}
\Blindtext
\appendix
\part{Appendix}
\chapter{An addendum}
\section{Section within the appendix}
\blindtext
\end{document}

A book with the memoir class

\documentclass[11pt,a5paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{blindtext}
\frenchspacing
\begin{document}
\title{The Book}
\author{The Author}
\date{}
\begin{titlingpage}
  \maketitle
\end{titlingpage}
\tableofcontents 
\part{First portion}
\chapter{The beginning}
Some introductional text comes here.
\section{A first section}
Dummy text will follow.
\blindtext
\section{Another section}
\Blindtext
\appendix
\part{Appendix}
\chapter{An addendum}
\section{Section within the appendix}
\blindtext
\end{document}

Creating a presentation

\documentclass{beamer}
\usetheme{Warsaw}
\begin{document}
\title{Talk on the Subject}
\subtitle{What this is about}
\author{Author Name}
\institute{University of X}
\date{January 24, 2024}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}
\section{Introduction}
\subsection{A subsection}
\begin{frame}{Very Informative Title}
  \begin{itemize}
    \item First thing to say.
    \item There is more.
    \item Another short point.
  \end{itemize}
\end{frame}
\begin{frame}{Another Title With Uppercased Words}
  Text
  \begin{alertblock}{A highlighted block}
    Some important information put into a block.
  \end{alertblock}
\end{frame}
\subsection{Another subsection}
\begin{frame}{Informative Title}
  \begin{exampleblock}{An example}
    An example within a block.
  \end{exampleblock}
  Explanation follows.
\end{frame}
\section{Summary}
\begin{frame}{Summary}
  \begin{itemize}
    \item Our \alert{main point}
    \item The \alert{second main point}
  \end{itemize}
  \vfill
  \begin{block}{Outlook}
    Further ideas here.
  \end{block}
\end{frame}
\end{document}

Using short titles and names

\documentclass{beamer}
\usetheme{Warsaw}
\begin{document}
\title[Short title]{Long Informative Title}
\author[Shortened name]{Author’s Complete Name}
\date[2015/06/24]{Conference on X at Y, June 24, 2015}
\institute{University of X}
\date{June 24, 2015}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}
\section{Introduction}
\subsection{A subsection}
\begin{frame}{Very Informative Title}
  \begin{itemize}
    \item First thing to say.
    \item There is more.
    \item Another short point.
  \end{itemize}
\end{frame}
\begin{frame}{Another Title With Uppercased Words}
  Text
  \begin{alertblock}{A highlighted block}
    Some important information put into a block.
  \end{alertblock}
\end{frame}
\subsection{Another subsection}
\begin{frame}{Informative Title}
  \begin{exampleblock}{An example}
    An example within a block.
  \end{exampleblock}
  Explanation follows.
\end{frame}
\section{Summary}
\begin{frame}{Summary}
  \begin{itemize}
    \item Our \alert{main point}
    \item The \alert{second main point}
  \end{itemize}
  \vfill
  \begin{block}{Outlook}
    Further ideas here.
  \end{block}
\end{frame}
\end{document}

Uncovering information piecewise

\documentclass[demo]{beamer}% demo option for dummy graphics
\usetheme{Warsaw}
\begin{document}
\title[Short title]{Long Informative Title}
\author[Shortened name]{Author’s Complete Name}
\date[2015/06/24]{Conference on X at Y, June 24, 2015}
\institute{University of X}
\date{June 24, 2015}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}
\section{Introduction}
\subsection{A subsection}
\begin{frame}{Very Informative Title}
  \begin{itemize}
    \item First thing to say.
    \item There is more.
    \item Another short point.
  \end{itemize}
  Text\pause\ more text\pause\ \includegraphics{filename}
  \uncover<3->{Surprise!}
\end{frame}
\end{document}

Splitting frames into columns

\documentclass[demo]{beamer}% demo option for dummy graphic
\usetheme{Warsaw}
\begin{document}
\begin{frame}
  Some text which can use whole frame width
  \begin{columns}[t]
    \begin{column}{5cm}
      Sample text in\\
      two lines
    \end{column}
    \begin{column}[T]{4cm}
      \includegraphics[width=3cm]{filename}
    \end{column}
  \end{columns}
\end{frame}
\end{document}

Showing an outline for each section

\documentclass{beamer}
\usetheme{Warsaw}
\AtBeginSection{
  \begin{frame}{Outline}
    \tableofcontents[currentsection]
  \end{frame}}
\begin{document}
\title{Talk on the Subject}
\subtitle{What this is about}
\author{Author Name}
\institute{University of X}
\date{June 24, 2015}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}
\section{Introduction}
\subsection{A subsection}
\begin{frame}{Very Informative Title}
  \begin{itemize}
    \item First thing to say.
    \item There is more.
    \item Another short point.
  \end{itemize}
\end{frame}
\begin{frame}{Another Title With Uppercased Words}
  Text
  \begin{alertblock}{A highlighted block}
    Some important information put into a block.
  \end{alertblock}
\end{frame}
\subsection{Another subsection}
\begin{frame}{Informative Title}
  \begin{exampleblock}{An example}
    An example within a block.
  \end{exampleblock}
  Explanation follows.
\end{frame}
\section{Summary}
\begin{frame}{Summary}
  \begin{itemize}
    \item Our \alert{main point}
    \item The \alert{second main point}
  \end{itemize}
  \vfill
  \begin{block}{Outlook}
    Further ideas here.
  \end{block}
\end{frame}
\end{document}

Removing navigation symbols

\documentclass{beamer}
\usetheme{Warsaw}
\setbeamertemplate{navigation symbols}{}
\begin{document}
\title{Talk on the Subject}
\subtitle{What this is about}
\author{Author Name}
\institute{University of X}
\date{June 24, 2015}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}
\section{Introduction}
\subsection{A subsection}
\begin{frame}{Very Informative Title}
  \begin{itemize}
    \item First thing to say.
    \item There is more.
    \item Another short point.
  \end{itemize}
\end{frame}
\begin{frame}{Another Title With Uppercased Words}
  Text
  \begin{alertblock}{A highlighted block}
    Some important information put into a block.
  \end{alertblock}
\end{frame}
\subsection{Another subsection}
\begin{frame}{Informative Title}
  \begin{exampleblock}{An example}
    An example within a block.
  \end{exampleblock}
  Explanation follows.
\end{frame}
\section{Summary}
\begin{frame}{Summary}
  \begin{itemize}
    \item Our \alert{main point}
    \item The \alert{second main point}
  \end{itemize}
  \vfill
  \begin{block}{Outlook}
    Further ideas here.
  \end{block}
\end{frame}
\end{document}

Changing the font

\documentclass{beamer}
\usetheme{Warsaw}
\usefonttheme{serif}
\begin{document}
\title{Talk on the Subject}
\subtitle{What this is about}
\author{Author Name}
\institute{University of X}
\date{June 24, 2015}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}
\section{Introduction}
\subsection{A subsection}
\begin{frame}{Very Informative Title}
  \begin{itemize}
    \item First thing to say.
    \item There is more.
    \item Another short point.
  \end{itemize}
\end{frame}
\begin{frame}{Another Title With Uppercased Words}
  Text
  \begin{alertblock}{A highlighted block}
    Some important information put into a block.
  \end{alertblock}
\end{frame}
\subsection{Another subsection}
\begin{frame}{Informative Title}
  \begin{exampleblock}{An example}
    An example within a block.
  \end{exampleblock}
  Explanation follows.
\end{frame}
\section{Summary}
\begin{frame}{Summary}
  \begin{itemize}
    \item Our \alert{main point}
    \item The \alert{second main point}
  \end{itemize}
  \vfill
  \begin{block}{Outlook}
    Further ideas here.
  \end{block}
\end{frame}
\end{document}

Providing a handout

\documentclass[handout]{beamer}
\usetheme{Warsaw}
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper,
  border shrink=5mm,landscape]
\begin{document}
\title{Talk on the Subject}
\subtitle{What this is about}
\author{Author Name}
\institute{University of X}
\date{June 24, 2015}
\begin{frame}
  \titlepage
\end{frame}
\begin{frame}{Outline}
  \tableofcontents[pausesections]
\end{frame}
\section{Introduction}
\subsection{A subsection}
\begin{frame}{Very Informative Title}
  \begin{itemize}
    \item First thing to say.
    \item There is more.
    \item Another short point.
  \end{itemize}
\end{frame}
\begin{frame}{Another Title With Uppercased Words}
  Text
  \begin{alertblock}{A highlighted block}
    Some important information put into a block.
  \end{alertblock}
\end{frame}
\subsection{Another subsection}
\begin{frame}{Informative Title}
  \begin{exampleblock}{An example}
    An example within a block.
  \end{exampleblock}
  Explanation follows.
\end{frame}
\section{Summary}
\begin{frame}{Summary}
  \begin{itemize}
    \item Our \alert{main point}
    \item The \alert{second main point}
  \end{itemize}
  \vfill
  \begin{block}{Outlook}
    Further ideas here.
  \end{block}
\end{frame}
\end{document}

Designing a CV

\documentclass[11pt,a4paper,sans]{moderncv}% demo option for dummy photo
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\name{John}{Doe}
\title{CV title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\email{john@doe.org}
\homepage{www.johndoe.com}
\photo[64pt][0.4pt]{ctanlion.pdf}
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}
  {General description\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a)
  \item Sub-achievement (b)
  \end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}
  {Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}
\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{Language 2}{Skill level}{Comment}
\end{document}

Writing a letter

\documentclass[fromalign=right,addrfield=true,
  foldmarks=true]{scrlttr2}
\setkomavar{fromname}{Thomas Smith}
\setkomavar{fromaddress}{123 Blvd \\ City, CC 12345}
\date{\today}
\begin{document}
\begin{letter}{Agency \\ 5th Avenue \\ Capital City, CC 12345}
\opening{Dear Sir or Madam,}
the actual content of the letter follows.
\closing{Yours sincerely}
\end{letter} 
\end{document}

\documentclass[fromalign=right,addrfield=true,
  foldmarks=true,parskip=full]{scrlttr2}
\setkomavar{fromname}{Thomas Smith}
\setkomavar{fromaddress}{123 Blvd \\ City, CC 12345}
\setkomavar*{enclseparator}{Attached}
\setkomavar{signature}{Thomas}
\renewcommand{\raggedsignature}{\raggedright}
\date{\today}
\begin{document}
\begin{letter}{Agency \\ 5th Avenue \\ Capital City, CC 12345}
\opening{Dear Sir or Madam,}
the actual content of the letter follows.
\closing{Yours sincerely}
\encl{Curriculum vitae, certificates}
\end{letter} 
\end{document}

Producing a leaflet

CTAN lion source: https://ctan.org/lion/files

CTAN lion in PDF format: ctanlion.pdf

\documentclass[10pt,notumble]{leaflet}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{microtype}
\pagenumbering{gobble}
\begin{document}
\title{\textbf{\TeX\ Live Install Party}}
\author{\Large\textbf{Your \TeX\ team}}
\date{\textbf{August 11, City Hall Cellar}}
\maketitle
\begin{center}
\includegraphics[width=\linewidth]{ctanlion.pdf}
\end{center}
We'd like to welcome you to our famous yearly \TeX\ install party!
Bring your laptop and have free cold soft drinks while we assist you in
installing the latest \TeX\ version on your computer.

We will provide
\begin{itemize}
\item a fast internet connection fow downloading,
\item media such as DVDs and USB sticks with the latest \TeX\,
\item \TeX\ books for bying with a discount,
\item chat with \TeX\ experts.
\end{itemize}
\clearpage
Fill in text for page 2 (on the back side)
\clearpage
Fill in text for page 3 (on the back side)
\clearpage
Fill in text for page 4 (on the back side)
\clearpage
\section{Schedule}
\begin{tabular}{@{}rl@{}}
6 pm    & Welcome \\
7:30 pm & Live install presentation \\
8 pm    & Book authors available for talks and signing \\
9:30 pm & Bar closing
\end{tabular}

From 6pm to 10pm: install support
and free \TeX\ copies on DVD on our welcome desk. 
\section{Accomodation}
Hotel, Meals, Travel information here
\section{Sponsors}
Information about our local \TeX\ user group
and Open Source projects sponsor
\clearpage
\section{Contact}
Names, Phone numbers, email addresses
\end{document}

\documentclass[10pt,notumble,nofoldmark]{leaflet}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{microtype}
\pagenumbering{gobble}
\CutLine{3}
\usepackage{xcolor}
\renewcommand{\sectfont}{\large\sffamily\bfseries\color{blue}}
\begin{document}
\title{\textbf{\TeX\ Live Install Party}}
\author{\Large\textbf{Your \TeX\ team}}
\date{\textbf{August 11, City Hall Cellar}}
\maketitle
\begin{center}
\includegraphics[width=\linewidth]{ctanlion.pdf}
\end{center}
We'd like to welcome you to our famous yearly \TeX\ install party!
Bring your laptop and have free cold soft drinks while we assist you in
installing the latest \TeX\ version on your computer.

We will provide
\begin{itemize}
\item a fast internet connection fow downloading,
\item media such as DVDs and USB sticks with the latest \TeX\,
\item \TeX\ books for bying with a discount,
\item chat with \TeX\ experts.
\end{itemize}
\clearpage
Fill in text for page 2 (on the back side)
\clearpage
Fill in text for page 3 (on the back side)
\clearpage
Fill in text for page 4 (on the back side)
\clearpage
\section{Schedule}
\begin{tabular}{@{}rl@{}}
6 pm    & Welcome \\
7:30 pm & Live install presentation \\
8 pm    & Book authors available for talks and signing \\
9:30 pm & Bar closing
\end{tabular}

From 6pm to 10pm: install support
and free \TeX\ copies on DVD on our welcome desk. 
\section{Accomodation}
Hotel, Meals, Travel information here
\section{Sponsors}
Information about our local \TeX\ user group
and Open Source projects sponsor
\clearpage
\section{Contact}
Names, Phone numbers, email addresses
\end{document}

Go to next chapter.