Chapter 12 – Enhancing Your Documents Further

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).

Combined document from chapter 11, plus hyperref

\documentclass{book}
%
% preamble
\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}
\usepackage{hyperref}
%
% document body
\begin{document}
\tableofcontents
%
% dedication
\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.
%
% chapter 1
\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
\chapter{Equation Systems}
\section{Linear Systems}
...
\section{Non-linear Systems}
...
\end{document}


Using math formulas and special symbols in bookmarks

\documentclass{article}
\usepackage{bm}
\usepackage[colorlinks=true,psdextra,unicode]{hyperref}
\begin{document}
\pdfbookmark[1]{\contentsname}{toc}
\tableofcontents
\pdfbookmark[1]{Abstract}{abstract}
\begin{abstract}
\centering
Sample sections follow.
\end{abstract}
\section{The equation \texorpdfstring{$\bm{y=x^2}$}{y=x\texttwosuperior}}
\section{\texorpdfstring{$\bm{\gamma}$}{\textgamma} radiation}
\section[\texorpdfstring{Let $\int\sim\sum$ for
  $n\rightarrow\infty$}
  {Let \int\sim\sum\ for n\rightarrow\infty}]
  {Let $\bm{\int\sim\sum}$ for $\bm{n\rightarrow\infty}$}
\end{document}


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.