Beamer Presentations

From Micro and Nano Mechanics Group
Jump to navigation Jump to search

Beamer is a LaTeX package to make slide presentations similar to those made by PowerPoint but with all the power of LaTeX typesetting, equations, and graphics.

Beamer workflow is similar to that of a LaTeX article, pdflatex -> preview -> edit -> pdflatex.

Slides with Tables

Adding tables to slides is no different that for other LaTeX documents (see tutorial). The only difference is that we want to have extra control over the table format and size.

For example we may (or may not) want to add light alternating colors to the rows in a table to make it easier for the eye follow them; this is achieved with \rowcolors command.

\documentclass[
  ...
  xcolor=table]{beamer}
...
\begin{frame}
\begin{center}
  \rowcolors{1}{blue!20}{blue!5}
  \begin{tabular}{|l|c|}
    \hline
    J.\ S.\ Bach   & 1685--1750 \\
    W.\ A.\ Mozart & 1756--1791 \\
    L.\ Beethoven  & 1770--1827 \\
   \hline
  \end{tabular}
\end{center}
\end{frame}

Slides with Columns

In article mode we can usually get two columns by using the twocolumn package or environment. In a slide we need to have more control over the layout.

A frame (slide) with two columns is obtained by doing

\begin{frame}
\frametitle{Two Column Output}
  \begin{columns}[c]
  \column{1.5in}
    First column \\
    First column
  \column{1.5in}
    Second column with a graphics \\
    \framebox{\includegraphics[width=1.5in]{p2005}}
  \end{columns}
\end{frame}

This is the most direct way, although you need to calculate the width of the column and break the columns explicitly (text doesn't flow from one column to the other).

An alternative is to use the multicol package, which allows text to flow and calculates column widths by dividing the available width in equal parts.

\usepackage{multicol}
\setlength{columnsep}{0pt} %white space btwn cols, optional
\setlength{\columnseprule}{0.2mm} %add line btwn cols, optional
...
\begin{frame}
  \begin{multicols}{2}
    First column\\
    First column

    \columnbreak %force column break (optional)

    Second column\\
    Second column
  \end{multicols}
\end{frame}

The drawback is that we loose control over the exact column width (for example if we want different widths).

Include Graphics from Papers

Including graphics is no different than we normally do for LaTeX documents. However when making slide, frequently we want to add pictures from existing articles (journal papers). The PowerPoint side of our brain tell us that we must convert the page with the graphics to an image, then crop the image, convert it into some intermediate format, save it somewhere, and then include in the Beamer document.

The good news is that it much simpler than that. We can use the options of the includegraphics command to just include a particular portion of a particular page.

For example to add a slide with a graphics near the top of page 2 we issue the commands.

\begin{frame}{Part of PDF}
	\includegraphics[page=2,trim=0 565 0 80,clip=true,height=3cm]{paper.pdf}
\end{frame}

The trim values could be set by trial and error, an image near the bottom of the page probably has these other values: trim=0 80 0 500. In general trim=left bottom right top. No need to use another program to crop the image.

Convert particular slides into images

The presentation is in PDF format, sometimes we may want to have particular slides in PDF or other image format.

If for example we want to extract page 3 of the PDF presentation (in PDF format), we can use

pdftk presentation.pdf cat 3 output page03.pdf

Unfortunately, pdftk is not available everywhere. Alternatively we can use Ghostscript,

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=3 -dLastPage=3 -sOutputFile=page03.pdf presentation.pdf

To obtain (raster) images we can use the Imagemagik convert tool,

convert -density 1024 -resize 1024 -quality 90 wiki.pdf[3] wiki3.pdf

which creates a full screen resolution of the page. If we want thumbnails instead we can use:

convert presentation.pdf[3] page03.png

Also, all pages can be converted at once with the command

convert presentaition.pdf page.png

the files pages-1.png, pages-2.png, etc will be created.