Chapter 3 – Adjusting Fonts

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[paper=a4,oneside,fontsize=12pt,
  parskip=full]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\pagestyle{empty}
\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 bullet 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}

\documentclass[paper=a4,oneside,fontsize=12pt,
  parskip=full]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\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 bullet 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}

\documentclass[paper=a4,oneside,fontsize=12pt,
  parskip=full]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[libertine,cmintegrals,cmbraces,vvarbb]{newtxmath}
\usepackage[scaled=0.95]{inconsolata}
\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 bullet 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}

\documentclass[paper=a4,oneside,fontsize=12pt,
  parskip=full]{scrartcl}
\usepackage[sc,osf]{mathpazo}
\usepackage[T1,small,euler-digits]{eulervm}
\usepackage[scaled=0.86]{berasans}
\usepackage[scaled=0.84]{beramono}
\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 bullet 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}

\documentclass{article}
\newcommand{\zapf}{\fontfamily{pzc}\selectfont}
\newenvironment{zapfenv}{\fontfamily{pzc}\selectfont}{}
\begin{document}
Normal text

{\zapf Zapf Chancery\par}

Normal text

\begin{zapfenv}
Zapf Chancery
\end{zapfenv}

Normal text
\end{document}

\documentclass{article}
\newcommand{\setfont}[1]{\fontfamily{#1}\selectfont}
\newenvironment{fontenv}[1]{\fontfamily{#1}\selectfont}{}
\begin{document}
Normal text

{\setfont{pzc} Zapf Chancery\par}

Normal text

\begin{fontenv}{pzc}
Zapf Chancery
\end{fontenv}

Normal text
\end{document}

\documentclass{scrbook}
\newcommand{\zapf}{\fontfamily{pzc}\selectfont}
\setkomafont{chapter}{\normalcolor\zapf\Huge}
\begin{document}
\chapter{The Heading}
Normal text
\end{document}

\documentclass[border=10pt]{standalone}
\DeclareFontFamily{U}{matha}{\hyphenchar\font45}
\DeclareFontShape{U}{matha}{m}{n}{
      <5> <6> <7> <8> <9> <10> gen * matha
      <10.95> matha10 <12> <14.4> <17.28> <20.74> <24.88> matha12
      }{}
\DeclareSymbolFont{matha}{U}{matha}{m}{n}
\DeclareMathSymbol{\leq}{3}{matha}{"A4}
\DeclareMathSymbol{\nleq}{3}{matha}{"A6}
\begin{document}
If $A \leq B$, then $B \nleq A$.
\end{document}

\documentclass{article}
\usepackage{bm}
\bmdefine{\bX}{X}
\bmdefine{\bi}{i}
\bmdefine{\bMinus}{-}
\bmdefine{\bSum}{\sum}
\bmdefine{\bLeft}{(}
\bmdefine{\bRight}{)}
\pagestyle{empty}
\begin{document}
\[ \sum_{i} ( - X_{i} ) \]
\[ \bSum_{\bi} \bLeft \bMinus \bX_{\bi} \bRight \]
\end{document}

\documentclass{article}
\usepackage{amsmath}
\newcommand{\bX}{\boldsymbol{X}}
\newcommand{\bi}{\boldsymbol{i}}
\newcommand{\bMinus}{\boldsymbol{-}}
\newcommand{\bSum}{\boldsymbol{\sum}}
\newcommand{\bLeft}{\boldsymbol{(}}
\newcommand{\bRight}{\boldsymbol{)}}
\pagestyle{empty}
\begin{document}
\[ \sum_{i} ( - X_{i} ) \]
\[ \bSum_{\bi} \bLeft \bMinus \bX_{\bi} \bRight \]
\end{document}

\documentclass{article}
\usepackage{sfmath}
\usepackage{sansmathaccent}
\pagestyle{empty}
\begin{document}
\[
  \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{sansmath}
\sansmath
\pagestyle{empty}
\begin{document}
\[
  \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{arev}
\pagestyle{empty}
\begin{document}
\[
  \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[sfmath,lighttext]{kpfonts}
\pagestyle{empty}
\begin{document}
\[
  \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{dsfont}
\begin{document}
\pagestyle{empty}
\[
  \mathds{N} \subset \mathds{Z} \subset
  \mathds{Q} \subset \mathds{R} \subset \mathds{C}
\]
\end{document}

\documentclass{article}
\input{glyphtounicode}
\pdfgentounicode=1
\begin{document}
floating figures
\end{document}

\documentclass{article}
\usepackage{microtype}
\DisableLigatures[f]{encoding = *, family = * }
\begin{document}
floating figures
\end{document}

\documentclass{scrbook}
\usepackage[pdftex,outline]{contour}
%\contourlength{1.5pt}% Thickness of copies
%\contournumber{25}% How many copies
\newcommand{\chapterfont}[1]{\contour{black}{\textcolor{yellow}{#1}}}
\setkomafont{chapter}{\Huge\chapterfont}
\begin{document}
\chapter*{Introduction}
\thispagestyle{empty}
Text follows.
\end{document}

Go to next chapter.