Pages

26 thg 2, 2011

Install Beamer for Miktex in Linux

HAPPYMUTANT.COM
Making LaTeX Beamer Presentations

If you want to create overhead presentations (á la Powerpoint) with LaTeX, you can do so by using Beamer class, which creates surprisingly professional and sophisticated documents that you can then display using any pdf viewer (e.g., such as Adobe Acrobat). The advantage of using LaTeX over a program like Powerpoint is that it doesn't require expensive software for either creating or displaying your presentation; it thus makes the presentation truly "portable". And, if you already have the basics of LaTeX down, learning the basics of creating a beamer presentation does not take much effort.

getting beamer class

You can download beamer class by either downloading the package from its webpage, or better yet, if you have Ubuntu (or Debian), just apt-get latex-beamer (which will also install it for you as well).
If you download the beamer package from the website, installation will be a bit more complicated. Follow the instructions included in the package. (Or look elsewhere for instructions on how to install LaTeX classes. It's really as easy as putting a few files in places where LaTeX knows where to look: the trick is figuring out where LaTeX looks for them. I may put up a tutorial on hand-installing LaTeX classes in the future.)

the basic document structure

Beamer class is quite feature-rich, and it's 200+ page manual may be a little intimidating. However, creating a basic presentation really requires doing only two things:
Declaring beamer class in your LaTeX preamble, and
Enclosing each "slide" in a special "frame" environment.
You will probably also want to include the date, title, author, etc., of your presentation. These can all be included in a separate title slide, created with the \titlepage command. You may also want to include titles for your frames (which are displayed in large font at the top of the slide) with the \frametitle command. Thus, a basic beamer document will look something like the following:
\documentclass{beamer}
\title{Here is my Title}
\author{Christina Huggins}
\date{July 15th, 2005}

\begin{document}

\begin{frame}
\frametitle{Optional Title for My Slide}
Here is one slide.
\end{frame}

\begin{frame}
Here is another slide.
\end{frame}

\end{document}
Note that beamer class is meant to be compiled using pdflatex to easily create a pdf presentation.
Knowing this basic document structure, you can create quite a decent presentation. At this point, I only use these presentations for my teaching lectures, and I have not the need for anything terribly fancy. However, I've found a few of the additional features to be quite useful, so I've included them below.

themes

While the default presentation looks quite clean and professional, you may want to play with the style of your presentation with themes. Beamer comes prepackaged with quite a few complete themes, (as well as what I call "sub-themes": color themes, or themes that only apply to the "outer" or "inner" part of the slide frames). The manual explains the differing themes in a bit of detail, and you can explore these different themes on your own. Once you find a theme you like (I like Boadilla), you can just declare it in the preamble like so: \usetheme{ThemeName}.

columns & blocks

There are two handy environments for structuring your slide: "blocks", which divide your slide (horizontally) into headed sections, and "columns" which divides your slide (vertically) into columns.

Columns
example
\begin{frame}
\begin{columns}[c] % the "c" option specifies center vertical alignment
\column{.5\textwidth} % column designated by a command
Contents of the first column
\column{.5\textwidth}
Contents split \\ into two lines
\end{columns}
\end{frame}

\begin{frame}
\begin{columns}[t] % contents are top vertically aligned
\begin{column}[5cm] % each column can also be its own environment
Contents of first column \\ split into two lines
\end{column}
\begin{column}[T]{5cm} % alternative top-align that's better for graphics
\includegraphics[height=3cm]{graphic.png}
\end{column}
\end{columns}
\end{frame}
See resulting pdf.
blocks

example
\begin{frame}
\begin{block}{Block Heading}
Enlosing text in the ``block'' environment creates a distinct, headed block of text.
\end{block}
\begin{block}{Second Block Heading}
This lets you visually distinguish parts of your slide easily.
\end{block}
\end{frame}
See resulting pdf.

revealing things incrementally

There may be times during your presentation when you want to reveal things on a slide piecemeal (e.g., you reveal a list one item at a time).
The most straightfoward way to do this is via the "pause" command. If you want more sophisticated reveals (e.g., you want the first and last item on a list to be revealed at the same time), then you would use other methods. But, "pause" works perfectly for my purposes.
example
\begin{frame}
Since I may want to focus on one item at a time in my presentation,
\begin{itemize}
\item I want to reveal only the first item on my list initially,
\pause
\item then the second item,
\pause
\item then the third,
\pause
\item and so on...
\end{itemize}
\end{frame}
See resulting pdf.

making accompanying documents

There are several ways to create notes, handouts, or other accompanying documents for your presentation. My preferred way of doing this (since I like to include a lot of extra commentary and notes for reference later) is to use article mode. That is, I can create an article, load the package "beamerarticle", and LaTeX will render all of the beamer commands and environments within article mode.
Anything within the frames will be printed in the article; anything outside the frames will also be printed in the article (but you can specify that this text be ignored in beamer mode). So, in short, you can create your beamer presentation and and an accompanying document that includes both the beamer text and extra notes.
The most efficient way to do this is the following:
Create your main .tex file (including both the text for your presentation and the notes in between). Leave off the document class declaration (let's call it name.tex).
Create another file, name.beamer.tex, the content of which is the following:
\documentclass[ignorenonframetext]{beamer}
\input{name.tex}
Create a third file, name.article.tex, the content of which is the following:
\documentclass{article}
\usepackage{beamerarticle}
\input{name.tex}
Then, run pdflatex on both name.beamer.tex and name.article.tex to get your presentation and accompanying document, respectively. To demonstrate an extended example of this, I included below both the main .tex file, and the resulting beamer presentation and article that I rendered from it (I'm not including the beamer.tex and article.tex files, since they really are just as simple as the examples above). example
Main .tex file
Beamer pdf
Article pdf
Note: If you use Vim, and its LaTeX suite, check out my Vim beamer templates.
main LaTeX page
other LaTeX how-to's
getting beamer
document structure
themes
columns & blocks
revealing incrementally
accompanying docs

Source: http://happymutant.com/latex/misce/beamer.php