LaTeX Beamer Slide Examples

July 16th, 2009

It is straightforward to insert slides into a LaTeX beamer presentation and in this post we will create two slides to illustrate how this is done.

The presentation itself can be divided into sections using the normal LaTeX commands like \section or \subsection etc. With the default theme this is not so obvious, but when we make use of other themes then the section can be display in the header and/or using slides to introduce each section of the presentation.

In many presentations different parts of the slide will be revealed one at a time. The simplest way to make use of this in beamer is using the \pause command. For example,

Given a response variable Y and an explanatory variable X, the
formula for the model based on these two variables is:
Y_{i} = \beta_{0} + \beta_{1} X_{i} + \epsilon_{i}
and we assume that the $\epsilon_{i}$ are independent random

would produce three slides in our pdf document. Flicking through these three slides gives the illusion of the material being uncovered. If you are using the list environment then the \item command can be altered to indicate what slides the element should appear on. For example, \item<2-> requests that the item appears on the second and all subsequent slides. If this was changed to \item<2-3> then the item would stay for the third slide but none of the subsequent slides.

The verbatim package and environment is useful but to make use of it we need to invoke the fragile option when creating our slide. For example,

\begin{frame}[fragile]{Linear Regression Model}

Another useful environment is the block environment which creates a box in which some material is presented and has a title. So we could put our verbatim text of a function inside a block environment with the following code:

\begin{block}{Function Code}
int addTwo(int x, int y)
    int result;
    result = x + y;
    return (result);

This would produce the following document and the lack of theme means that the arrangement is not so obvious. The themes change colours and other attributes which can be used to make parts of the presentation stand out.

Comments are closed.