# Chapter 2 – Tuning the Text

Here are the Code examples of 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).

\documentclass{book}
\usepackage[a6paper]{geometry}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{lettrine}
\begin{document}
\lettrine{O}{nce upon a time}, professional writer used
a mechanical machine called a typewriter. It commonly
printed fixed-width characters. Emphasizing was done by
writing all capitals, and by underlining.
\end{document}

\documentclass{article}
\usepackage{fmtcount}
\begin{document}
\section{Introduction}
This document should have \numberstringnum{32}
pages, now we are on page \numberstring{page}
in the \ordinalstring{section} section.
\end{document}

\documentclass{article}
\usepackage{moreenum}
\begin{document}
\begin{enumerate}[label=\Nthwords*]
\item live
\item long
\item prosper
\end{enumerate}
\end{document} 

\documentclass{article}
\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage{tcolorbox}
\pagestyle{empty}
\begin{document}
\begin{tcolorbox}
\blindtext
\end{tcolorbox}
\end{document}
\begin{tcolorbox}[title=\textbf{Examples},
colback=blue!5!white,colframe=blue!75!white]
The text below consists of pangrams.
\tcblower
\blindtext[3]
\end{tcolorbox}
\tcbset{colframe=green!50!black,colback=white,
colupper=green!30!black,fonttitle=\bfseries, center title,
nobeforeafter, tcbox raise base}
Normal text \tcbox{Boxed text}
\tcbox[left=0pt,right=0pt,top=0.5ex,bottom=0pt,boxsep=0pt,
toptitle=0.5ex,bottomtitle=0.5ex,title=Sample table]{
\begin{tabular}[t]{rl}
Number & 100 \\
Sum    & 350
\end{tabular}}
\end{document}

\documentclass[paper=a4,oneside,fontsize=12pt,
parskip=full]{scrartcl}
\usepackage{showframe}
\pagestyle{empty}
\begin{document}
\tableofcontents
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 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$:
$$\label{eq:integral} \int_a^b f(x)\,\mathrm{d}x \approx (b-a) \sum_{i=0}^n w_i f(x_i)$$
\end{document}

\documentclass[paper=a4,oneside,fontsize=12pt,
parskip=full]{scrartcl}
\usepackage[a4paper,bindingoffset=5mm,showframe]{geometry}
\geometry{showframe}
\begin{document}
\tableofcontents
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 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$:
$$\label{eq:integral} \int_a^b f(x)\,\mathrm{d}x \approx (b-a) \sum_{i=0}^n w_i f(x_i)$$
\end{document}

\documentclass[paper=a4,oneside,fontsize=12pt,
parskip=full]{scrartcl}
\usepackage{layout}
\begin{document}
\layout
\tableofcontents
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 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$:
$$\label{eq:integral} \int_a^b f(x)\,\mathrm{d}x \approx (b-a) \sum_{i=0}^n w_i f(x_i)$$
\end{document}

\documentclass[paper=a4,oneside,fontsize=12pt,
parskip=full]{scrartcl}% compile with LuaLaTeX
\usepackage{lua-visual-debug}
\pagestyle{empty}
\begin{document}
\tableofcontents
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 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$:
$$\label{eq:integral} \int_a^b f(x)\,\mathrm{d}x \approx (b-a) \sum_{i=0}^n w_i f(x_i)$$
\end{document}

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{microtype}
\usepackage[fontsize=10pt,baseline=12pt]{grid}
\begin{document}
\twocolumn
\section*{Two columns}
\blindtext[3]
\begin{figure}
\centering
\fbox{\makebox(50,50){}}
\caption{A dummy figure}
\end{figure}
\begin{gridenv}
$$\sum_n f(n)$$
\end{gridenv}
Text
\end{document}

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{microtype}
\begin{document}
\twocolumn
\section*{Two columns}
\blindtext[3]
\begin{figure}
\centering
\fbox{\makebox(50,50){}}
\caption{A dummy figure}
\end{figure}
$$\sum_n f(n)$$
Text
\end{document}

\documentclass{article}% compile until last test is stable
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{microtype}
\usepackage[fontsize=10pt,baseline=12pt]{grid}
\usepackage{gridset}
\usepackage{amsmath}
\begin{document}
\twocolumn
\section*{Two columns}
\blindtext[3]
\begin{figure}
\centering
\fbox{\makebox(50,50){}}
\caption{A dummy figure}
\end{figure}
\begin{align}
y &= \sum_{n=1}^3 f(n) \\
&= f(1) + f(2) + f(3)
\end{align}
\par\vskipnextgrid\noindent
Text
\end{document}

\documentclass[a5paper]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{showframe}
\usepackage{eso-pic}
\usepackage{picture}
\pagestyle{empty}
\begin{document}
\setlength{\unitlength}{1cm}%
\put(2.5,2){Test document}%
\put(\paperwidth-2cm,2cm){\llap{\thepage}}%
}
\AtPageLowerLeft{Page bottom left}%
\AtPageUpperLeft{\raisebox{-\height}{Page top left}}%
\AtTextUpperLeft{\raisebox{-\height}{%
\color{red}Text area top left}}%
}
\AtPageCenter{\rotatebox{15}{\makebox[0pt]{%
\Huge\bfseries\color{red}Confidential}}}%
}
\lipsum
\end{document}

\documentclass{article}
\usepackage{blindtext}
\usepackage{shapepar}
\pagestyle{empty}
\begin{document}
\shapepar{\heartshape}\blindtext[2]
\end{document}

\documentclass{article}
\usepackage{blindtext}
\usepackage{shapepar}
\pagestyle{empty}
\begin{document}
\cutout{l} (5ex,2\baselineskip) \setlength{\cutoutsep}{8pt}
\shapepar{\circleshape} a few words of text\par
\blindtext
\end{document}

\documentclass{article}
\usepackage{lipsum}
\usepackage{pullquote}
\newcommand{\myquote}{%
\parbox{4cm}{
\hrule\vspace{1ex}
\textit{I can’t go to a restaurant and order food
because I keep looking at the fonts on the menu.}

\hfill Knuth, Donald (2002)%
\vspace{1ex}
\hrule
}%
}
\pagestyle{empty}
\begin{document}
\begin{pullquote}{object=\myquote}
\lipsum[1]
\end{pullquote}
\end{document}

\documentclass{article}
\usepackage{lipsum}
\usepackage{pullquote}
\usepackage{tikz}
\newcommand{\mylogo}{%
\begin{tikzpicture}
\node[shape=circle,draw=gray!40,line width=3pt,
fill={gray!15},font=\Huge] {\TeX};
\end{tikzpicture}%
}
\pagestyle{empty}
\begin{document}
\begin{pullquote}{shape=circular,object=\mylogo}
\lipsum[1]
\end{pullquote}
\end{document}

Go to next chapter.