A Blog Less Ordinary

The blog of Dave Ingram

Creating a presentation with LaTeX and powerdot

A few days ago, I gave a talk at PHP London about using OAuth with PHP. I started out building it in OpenOffice, but quickly found the process annoying, especially considering that I wanted to export to PDF with progressive disclosure on some slides. After putting the skeleton of the talk together, I decided to move to something else instead.

I’ve had some experience with the LaTeX document typesetting system before, having used it quite a lot during university for my final project‘s reports and presentation. I used the beamer package before, but this time I found its styles too restrictive. The three major presentation packages that I’m aware of are prosper (which I believe is quite old now),�beamer, and powerdot. After some investigation (looking primarily at features and visual styles), I settled for powerdot. I will explain the basics of putting a presentation together in the rest of this post, but be warned: it assumes some basic familiarity with LaTeX, and I don’t explain everything!

Starting out

The first steps when creating a slideshow are different to a regular document. In standard LaTeX, you open the document and just start writing, adding part, chapter and section headings as necessary. Creating a presentation is necessarily different. Here is a skeleton presentation:

% Presentation metadata
\title{My First Powerdot Presentation}
\author{Joe Bloggs}
\date{8th November 2010}


  % title slide

  % section: title takes up full slide
  \section{First section}

  % text slide:
  \begin{slide}{Slide Title}
     �\item This is an item
      \item This is also an item
      \item Finally, a third item in my list


Doesn’t look too bad, right? The presentation is contained within the document, and each slide is contained within a slide environment. The \section command now builds a standalone slide, as does the initial \maketitle.

Almost anything that you can include in a normal document can be used on a slide, including tables and images, and tricks like using \vspace{\stretch{1}} at the beginning and end of the slide to vertically centre the content.

Progressive disclosure

Powerdot allows you to show only parts of a slide to your audience at a time, to emphasise each point (for example), or to better illustrate the flow through a diagram. This can be accomplished in two ways: the simple \pause command, or the more complex and more powerful \onslide.

The simple \pause command takes no arguments, and simply stops anything in the slide after that command from appearing, as if content display had been “paused” at that point. It is important to note that everything following the command is typeset, in order to work out the space it would have taken up. This ensures that your slide content doesn’t shift around as you go through.

\begin{slide}{Progressive Disclosure}
    \item This is my first item
    \item This is the second item, after which we wait \pause
    \item The third item appears on the page following the second \pause
    \item And this fourth and final item appears on the page after the third

Note that the command can be used multiple times, and it will work just as you might expect. If you want to do something more complex (such as displaying things out of order, displaying something over multiple frames, or scoping a change to a subset of the frames) you will need to use \onslide.

This command is much more powerful, and takes two arguments: the frames on which the contents should be displayed, and the contents themselves. The example above could be rewritten:

\begin{slide}{Progressive Disclosure}
    \item This is my first item
    \item This is the second item, after which we wait
    \onslide{2-}{\item The third item appears on the page following the second}
    \onslide{3-}{\item And this fourth and final item appears on the page after the third}

But we could also (in theory) choose to do something more bizarre:

\begin{slide}{Progressive Disclosure}
    \onslide{4-}{\item This is my first item, and the last to appear}
    \onslide{3-}{\item This is the second item, although technically the third}
    \onslide{2-}{\item The third item appears on the page following the fourth}
    \item This fourth and final item is actually the first that is visible

The \onslide command has three variations. The first version, as shown above, allocates space for items that have not yet been displayed. If you add a star to the command before its arguments (\onslide*) then no space will be allocated. In the example above, this means that the new bullet points would appear to push the existing items downwards. If you add a plus to the command (\onslide+) then the contents will always be typeset, but a different colour will be used for the item on the specified slide(s).

I have found \onslide* to be particularly useful for progressive disclosure of diagrams, where not displaying an item at all can be very important.

Graphics and diagrams

It is important to remember that LaTeX itself will only accept graphics in EPS format via the \includegraphics command from the graphicx package. pdfTeX will allow other formats if used directly (including PNG) but something like pstricks may then become unusable. For my presentation, I used a combination of pstricks diagrams and included EPS images.

Building diagrams in pstricks gave me a major advantage that I had not foreseen: the ability to define and then re-use a picture. I used this to good effect with the diagram of the OAuth “dance”, showing the data flow between the User, Consumer, and Provider. When it came to the code samples for the implementation, I kept a miniature of this diagram on each slide to remind the viewer which stages of the dance were covered by the code on the current slide. This would not have been possible to do with OpenOffice (as far as I’m aware), and it saved me a great deal of time when I made changes to the original diagram.

If you have never used pstricks, then I highly recommend it. Although it may seem weird to specify co-ordinates in a text file rather than drawing the image graphically, it is extremely powerful and I found that I soon got used to it. It is worth remembering that some programs, like Inkscape, can actually save a vector image as a set of pstricks macros.

Code samples

Something that’s often important when building a technical presentation is including one or more code samples. It’s usually nice if they are syntax-highlighted in one way or another, to make it easier to read at a glance. By the way, it is generally advised that code samples in a presentation should be dark-coloured text on a light background rather than the other way round.

When it comes to using code samples in powerdot presentations, there are two things to be aware of. Firstly, choosing the typesetting package. I have always used the listings package for code samples. It has support for a large number of languages (as well as defining your own), and it is very configurable. You can even define short-cut environments for re-using options if you are working on a multiple-language presentation, for example.

The second thing to remember when adding listings to the presentation is that you need to inform the powerdot package that a slide has special “verbatim” content. This is done with an optional argument to the slide, method. This has three possible values (normal, direct, and file), but I have only found the first two to work reliably.

If the slide contains verbatim content, you must use either the direct or file rendering method, otherwise you will get an error. The file method can easily get confused (in my experience) and so I used direct. The downside is that you cannot use the \pause or \onslide commands in a direct-rendered slide; they will be silently ignored.

\begin{slide}[method=direct]{Hello World in C}
    #include <stdio.h>

    int main(int c, char **v) {
      fprintf(stdout, "Hello, world!\n");
      return 0;

Choosing and customising your style

The visual style of your presentation can make a difference to how it is received. Dark text on a very light background is usually considered to be the most readable. The powerdot package has a number of built-in styles (pp. 21-25), and I eventually settled on a modified version of paintings with the Charon palette. Creating your own style is not difficult, and you have a large amount of control over how it looks. I won’t go into it here, as it is already well covered by the manual.

And finally…

This is all very much a work in progress. This post was based upon my first experience of writing a presentation in LaTeX with powerdot. As time goes on, I hope to build upon and standardise a visual style for both personal and company presentations. I am also prepared to send the LaTeX sources of my OAuth presentation to anyone who is interested, so please let me know either in the comments below or contact me by email or Twitter.

For me, the biggest advantage of LaTeX is that content comes first — it’s much easier to write a presentation without obsessing over how it looks until the very end. The better-defined your visual style, the less you have to worry about the design, and the more time you can spend making your presentation great!

2 Responses to Creating a presentation with LaTeX and powerdot

M. T. Franco says: December 22, 2011 at 18:53

It’s a good article. I used to work with Prosper and now I find that powerdot is simpler. Thank you.

Pingback: Curso no convencional de LaTeX: también podemos presentar | Onda Hostil

Leave a Reply

Your email address will not be published. Required fields are marked *




GitHub Google+ Twitter