Introduction

LaTeX has long been my main typesetting environment. This post has some handy dandy codes that I daily use for Beamer class.

Beamer presentations can quickly get overly large compilation times and generate large PDF outputs. In Compressed PDFs, I describe several methods to optimize these processes.

My Beamer Template

\documentclass[ignorenonframetext]{beamer}
\include{preamble}

\title[]{}
\date{} 

\begin{document}
\frame{\maketitle}
%\begin{frame}{Contents}
%\tableofcontents	
%\end{frame}

\end{document}

preamble.tex is in the root folder, which has the following code:

%%% or uncomment this for the article version
% \documentclass[11pt]{article} \usepackage{beamerarticle}  

%%% or uncomment this for handouts
%\documentclass[handout,ignorenonframetext]{beamer}


\mode<article>
{
  \usepackage{fullpage} 
  \usepackage{pgf}
  \usepackage{hyperref}
  \setjobnamebeamerversion{example.beamer}
}

\mode<presentation> 
{
  \beamertemplatenavigationsymbolsempty % remove navigation symbols
  \usecolortheme{seagull} % default, albatross, seagull , crane, beaver, beetle, seahorse, wolverine
  \usefonttheme{serif} % serif, structureitalicserif, structurebold 
}

\mode<handout>
{
%%% In handout mode give the individual pages a light grey background
\setbeamercolor{background canvas}{bg=black!5}
%%% Put more than one frame on each page to save paper.
\usepackage{pgfpages} 
\pgfpagesuselayout{4 on 1}[letterpaper,border shrink=3mm, landscape]
% \pgfpagesuselayout{2 on 1}[letterpaper,border shrink=5mm, portrait]
% \setbeameroption{show notes}
}

\setbeamertemplate{footline}[frame number] % slide number at the bottom

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{siunitx} % Format scientific units
\usepackage{chemformula} % Format Chemical Formulae
\usepackage{tabularx} % Make complex tables

\author[]{Murat Kahveci, Ph.D.}
\subject{}
\institute[Loyola University Chicago]{
  Department of Chemistry \& Biochemistry\\
  Loyola University Chicago}

%\titlegraphic{\includegraphics[height=1cm]{./figures/luc.png}}

% symbols of equations and their definitions
% USAGE
% \whereInEq{ symbol(units) & definition \\}
\newcommand{\whereInEq}[1]{
\noindent where \quad
{\footnotesize
\begin{tabularx}{.8\textwidth} {
  | r 
   >{\raggedright\arraybackslash}X }
	#1
\end{tabularx}
\bigskip
}
}

Common Commands

New Frame

With bullet points.

\frame{ 
  \frametitle{}

  \begin{itemize}
  \item
  \end{itemize}

}

Equations

I prefer align which requires \usepackage{amsmath} in preamble and allows multiple lines of equations:

\begin{align}
\end{align}

Chem formula and equations. \usepackage{chemformula} in preamble:

\ch{}

To write the units in more elegant way:

\si
\SI{}{}

\si or \SI command dependencies in preamble:

\usepackage{siunitx}
\sisetup{load-configurations = abbreviations, binary-units = true}
\DeclareSIUnit\px{px}

Figures

\begin{figure}[hbt]
  \centering
  \frame{\includegraphics[width=0.65\textwidth]{./figures/}}
%  \caption{}
%  \label{fig:}
\end{figure}

Tables

Simple table:

\begin{table}[hbt]
  \begin{tabular}{l|cc}
    & & \\
    \hline
    & & \\
    & &
  \end{tabular}
  \caption{}
\end{table}

Complex table is easier with the tabularx package. Invoke \usepackage{tabularx} and \usepackage{booktabs} in preamble.

\begin{frame}{}
\begin{table}[]
	\begin{tabularx}{\linewidth}{l>{\raggedright}X}
		\toprule
		\textbf{Option}			& \textbf{Description} \tabularnewline
		\midrule
		 & newpxtext and newpxtext fonts will be used (pdfLaTeX) \tabularnewline
		 & Vertically align columns\tabularnewline
		\bottomrule
	\end{tabularx}
	\label{tbl:}
\end{table}
\end{frame}

Title Page

%Title page
\title[About Beamer] %optional
{About the Beamer class in presentation making}

\subtitle{A short story}

\author[Arthur, Doe] % (optional)
{A.~B.~Arthur\inst{1} \and J.~Doe\inst{2}}

\institute[VFU] % (optional)
{
  \inst{1}%
  Faculty of Physics\\
  Very Famous University
  \and
  \inst{2}%
  Faculty of Chemistry\\
  Very Famous University
}

\date[VLC 2014] % (optional)
{Very Large Conference, April 2014}

\logo{\includegraphics[height=1.5cm]{lion-logo.jpg}}

Make Title Page

\frame{\titlepage}

Table of Contents

TOC after the title page:

\begin{frame}
\frametitle{Table of Contents}
\tableofcontents
\end{frame}

TOC is placed at the beginning of each section; current section is highlighted:

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}

Visibility of Text

\begin{frame}
\frametitle{Sample frame title}
\begin{itemize}
    \item<1-> Text visible on slide 1
    \item<2-> Text visible on slide 2
    \item<3-> Text visible on slides 3
    \item<4-> Text visible on slide 4
\end{itemize}
\end{frame}

\pause Command

\begin{frame}
In this slide \pause

the text will be partially visible \pause

And finally everything will be there
\end{frame}

Text Highlighting

Text highlighting can be achieved in several ways.

\begin{frame}
\frametitle{Sample frame title}

In this slide, some important text will be
\alert{highlighted} because it's important.
Please, don't abuse it.

\begin{block}{Remark}
Sample text
\end{block}

\begin{alertblock}{Important theorem}
Sample text in red box
\end{alertblock}

\begin{examples}
Sample text in green box. The title of the block is ``Examples".
\end{examples}
\end{frame}

Make Two-Column Slide

\begin{frame}
\frametitle{}
\begin{columns}
    \column{0.5\textwidth}
    \column{0.5\textwidth}
\end{columns}
\end{frame}