Beamer Presentations: Difference between revisions

From Micro and Nano Mechanics Group
Jump to navigation Jump to search
 
(18 intermediate revisions by the same user not shown)
Line 3: Line 3:
Beamer workflow is similar to that of a LaTeX article, pdflatex -> preview -> edit -> pdflatex.
Beamer workflow is similar to that of a LaTeX article, pdflatex -> preview -> edit -> pdflatex.


= Themes and Slide Layout =
= Themes and Slide Layout [<code>\usetheme</code>] =


There are a few dozen of themes and themes details that allow to produce millons of possible themes and slide layout. For the moment lets keep it simple, this theme is a classic and beautiful in my opinion:
There are a few dozen of themes and themes details that allow to produce millons of possible themes and slide layout. For the moment lets keep it simple, this theme is a classic and beautiful in my opinion:
Line 26: Line 26:
}
}


= Slides with Tables =
= Slides with (Colored) Tables [<code>xcolor=table</code>] =


Adding tables to slides is no different that for other LaTeX documents (see [http://www.vision.ime.usp.br/~jmena/misc/latex/tables_with_latex.pdf tutorial]). The only difference is that we want to have extra control over the table format and size.
Adding tables to slides is no different that for other LaTeX documents (see [http://www.vision.ime.usp.br/~jmena/misc/latex/tables_with_latex.pdf tutorial]). The only difference is that we want to have extra control over the table format and size.
Line 49: Line 49:
\end{frame}
\end{frame}


= Slides with (mostly) Figures [<code>subfigure</code>] =
= Arranging figures =


LaTeX and subsequently Beamer, are not very good at arranging figures. Some slides in a presentation are only composed by figures, or even some small text that 'follows' the figures.
LaTeX and subsequently Beamer, are not very good at arranging figures by default. Some slides in a presentation are only composed by figures, or even some small text that 'follows' the figures.
The best way to handle multiple figures in one slide is to use the subfigure package. This package even allows to associate a small text (caption) to each figure.
The best way to handle multiple figures in one slide is to use the subfigure package. This package even allows to associate a small text (caption) to each figure. New rows can be created by forcing with the newline command (<code>\\</code>).


\usepackage{subfigure}
...
\begin{frame}
\begin{frame}
...
...
\renewcommand{\thesubfigure}{} %supress numbering
\renewcommand{\thesubfigure}{} %supress numbering
\begin{figure}
\begin{figure}
\begin{center}
\subfigure[Magnetic Confinement]{
\subfigure[Magnetic Confinement]{
\includegraphics[width=0.3\textwidth]{graphics/ITERmachineCutaway.jpg}
\includegraphics[width=0.3\textwidth]{graphics/ITERmachineCutaway.jpg}
Line 74: Line 75:
[[File:Subfigure.png]]
[[File:Subfigure.png]]


If only one figure is needed (with no special text), this is enough
= Slides with Columns =
\begin{frame}{Title}{Subtitle}
\includegraphics[width=\textwidth]{file.png}
\end{frame}

= Slides with Columns [<code>columns/multicols</code>]=


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.
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.
Line 118: Line 124:
The drawback is that we loose control over the exact column width (for example if we want different widths).
The drawback is that we loose control over the exact column width (for example if we want different widths).


= Include Graphics from Papers =
= Include Graphics from Papers [<code>[page=p,trim=l b r t,clip=true]{...}</code>] =


Including graphics is no different than we normally do for LaTeX documents.
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).
However when making slide, frequently we want to add pictures from existing articles (journal papers). We can use the options of the includegraphics command to
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.
just include a particular portion of a particular page.


Line 136: Line 139:
trim=0 80 0 500. In general trim=left bottom right top. No need to use another program to crop the image.
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 =
= Convert Slides to Images [<code>convert -resize 1024</code>] =


The output presentation is obviously in PDF format, sometimes we may want to have particular slides in PDF or other image format.
The output presentation is obviously in PDF format, sometimes we may want to have particular slides in PDF or other image format.
Line 152: Line 155:
$ convert -density 1024 -resize 1024 -quality 90 wiki.pdf[3] wiki3.pdf
$ 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:
which creates a full screen resolution of the page. If we want thumbnails (like those included in this tutorial) instead we can use:


$ convert presentation.pdf[3] page03.png
$ convert presentation.pdf[3] page03.png
(pages start at 0).

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

$convert presentaition.pdf page.png
$convert presentaition.pdf page.png

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


= Presenting Equations =
= Presenting (Colored) Equations [<code>{\color{red}x}</code>] =


There's only one thing more annoying that an equation in a presentation and that is an equation that is impossible to read in a presentation. To ease the reading of equation in your presentation, first of all make it small, second present it as a conceptual picture.
Equations in presentation are annoying. There's only one thing more annoying and that is an equation that is difficult to read. To ease the reading of equation in your presentation, first of all make it small (there is not much space in a slide anyway), second present it as a conceptual picture.


Pictures have colors and so should equations in a presentation. This capability of adding colors is a feature of LaTeX (not beamer) but it is a feauture that makes a lot of sense to use in a Beamer presentation. Here it is an example that uses colors to emphasize in a particular term and dims unimportant unit factors:
Pictures have colors and so should equations in a presentation. This capability of adding colors is a feature of LaTeX (not Beamer) but it is a feauture that makes a lot of sense to use in a presentation. Here it is an example that uses colors to emphasize in a particular term and dims unimportant unit factors:


${\cal \hat H} = \frac{[p-{\color{red}{\color{red!50}e}\bf A(p)}]^2}{2{\color{gray}m}} + V(r)$
${\cal \hat H} = \frac{[p-{\color{red}{\color{red!50}e}\bf A(p)}]^2}{2{\color{gray}m}} + V(r)$

Latest revision as of 09:07, 1 June 2010

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.

Themes and Slide Layout [\usetheme]

There are a few dozen of themes and themes details that allow to produce millons of possible themes and slide layout. For the moment lets keep it simple, this theme is a classic and beautiful in my opinion:

\usetheme{Madrid}

To have more control over what is shown in the layout add the following optinal code

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{
	\leavevmode%
	\hbox{%
		\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
			\usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)
		\end{beamercolorbox}%
		\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
			\usebeamerfont{title in head/foot}\insertshorttitle
			\hfill \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
		\end{beamercolorbox}%
	}%
     \vskip0pt%
}

Slides with (Colored) Tables [xcolor=table]

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 (mostly) Figures [subfigure]

LaTeX and subsequently Beamer, are not very good at arranging figures by default. Some slides in a presentation are only composed by figures, or even some small text that 'follows' the figures. The best way to handle multiple figures in one slide is to use the subfigure package. This package even allows to associate a small text (caption) to each figure. New rows can be created by forcing with the newline command (\\).

\usepackage{subfigure}
...
\begin{frame}
... 
	\renewcommand{\thesubfigure}{} %supress numbering 
	\begin{figure}
		\subfigure[Magnetic Confinement]{
			\includegraphics[width=0.3\textwidth]{graphics/ITERmachineCutaway.jpg}
		}
		\subfigure[Blanket]{
			\includegraphics[width=0.3\textwidth]{graphics/blanket_1.jpg}
		}
		\subfigure[Divertor]{
			\includegraphics[width=0.3\textwidth]{graphics/divertor_1.jpg}
		}
	%\caption{no need for caption in presentation}
	\end{figure}
\end{frame}

Subfigure.png

If only one figure is needed (with no special text), this is enough

\begin{frame}{Title}{Subtitle}
	\includegraphics[width=\textwidth]{file.png}
\end{frame}

Slides with Columns [columns/multicols]

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}

Custom two column.png

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}
Automatic two column.png

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

Include Graphics from Papers [[page=p,trim=l b r t,clip=true]{...}]

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). 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 Slides to Images [convert -resize 1024]

The output presentation is obviously 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 program 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 Imagemagick 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 (like those included in this tutorial) instead we can use:

$ convert presentation.pdf[3] page03.png

(pages start at 0). 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.

Presenting (Colored) Equations [{\color{red}x}]

Equations in presentation are annoying. There's only one thing more annoying and that is an equation that is difficult to read. To ease the reading of equation in your presentation, first of all make it small (there is not much space in a slide anyway), second present it as a conceptual picture.

Pictures have colors and so should equations in a presentation. This capability of adding colors is a feature of LaTeX (not Beamer) but it is a feauture that makes a lot of sense to use in a presentation. Here it is an example that uses colors to emphasize in a particular term and dims unimportant unit factors:

${\cal \hat H} = \frac{[p-{\color{red}{\color{red!50}e}\bf A(p)}]^2}{2{\color{gray}m}} + V(r)$

Color names available are blue, green, red, cyan, magenta, yellow, black, gray, white, darkgray, lightgray, brown, lime, olive, orange, pink, purple, teal, violet. Additional colors can be added by blending (red!33!blue) or fading (red!33) or by including the other LaTeX packages.