Beamer Manual

Building a Presentation

13 Graphics

In the following, the advantages and disadvantages of different possible ways of creating graphics for beamer presentations are discussed. Much of the information presented in the following is not really special to beamer, but applies to any other document class as well.

13.1 Including External Graphic Files Versus Inlines Graphics

There are two principal ways of creating -documents that include graphics: Either the graphic resides in an external file that is included or the graphic is inlined, which means that -file contains a bunch of commands like “draw a red line from here to there.” In the following, the advantages and disadvantages of these two approaches are discussed.

You can use an external program, like xfig, GIMP or Inkscape, to create a graphic. These programs have an option to export graphic files in a format that can then be inserted into the presentation.

The main advantage is:

  • • You can use a powerful program to create a high-quality graphic.

The main disadvantages are:

  • • You have to worry about many files. Typically there are at least two for each presentation, namely the program’s graphic data file and the exported graphic file in a format that can be read by .

  • • Changing the graphic using the program does not automatically change the graphic in the presentation. Rather, you must reexport the graphic and rerun .

  • • It may be difficult to get the line width, fonts, and font sizes right.

  • • Creating formulas as part of graphics is often difficult or impossible.

You can use all the standard commands for inserting graphics, like \includegraphics. Also, the pgf package offers commands for including graphics. Either will work fine in most situations, so choose whichever you like. Like \pgfdeclareimage, \includegraphics also includes an image only once in a .pdf file, even if it used several times (as a matter of fact, the graphics package is even a bit smarter about this than pgf). However, currently only pgf offers the ability to include images that are partly transparent.

At the end of this section you will find notes on how to include specific graphic formats like .eps or .jpg.

The commands \includegraphics, \pgfuseimage, and \pgfimage are overlay-specification-aware in beamer. If the overlay specification does not apply, the command has no effect. This is useful for creating a simple animation where each picture of the animation resides in a different file:


A different way of creating graphics is to insert graphic drawing commands directly into your file. There are numerous packages that help you do this. They have various degrees of sophistication. Inlining graphics suffers from none of the disadvantages mentioned above for including external graphic files, but the main disadvantage is that it is often hard to use these packages. In some sense, you “program” your graphics, which requires a bit of practice.

When choosing a graphic package, there are a few things to keep in mind:

  • • Many packages produce poor quality graphics. This is especially true of the standard picture environment of .

  • • Powerful packages that produce high-quality graphics often do not work together with pdflatex, lualatex or xelatex.

  • • The most powerful and easiest-to-use package around, namely pstricks, does not work together with pdflatex, lualatex or xelatex and this is a fundamental problem. Due to the fundamental differences between pdf and PostScript, it is not possible to write a “pdflatex back-end for pstricks.” (Situation with lualatex and xelatex is very similar.) Regardless, pst-pdf, xetex-pstricks and pdftricks package can help here and simplify things from user’s perspective.

There are three possible solutions to the above problem, each with it’s own advantages and disadvantages.

  • • Use the pgf package. It produces high-quality graphics and works together with pdflatex, lualatex, xelatex and also with normal latex. It is not as powerful as pstricks (as pointed out above, this is because of rather fundamental reasons) and not as easy to use, but it should be sufficient in most cases.

  • • Use luamplib package and lualatex. It provides you with an environment using which you can type MetaPost code directly in your document.

  • • Use pstricks and stick to latex and dvips or use some of the workarounds mentioned above.

13.2 Including Graphic Files Ending .eps or .ps

External graphic files ending with the extension .eps (Encapsulated PostScript) or .ps (PostScript) can be included if you use latex and dvips, but not when using pdflatex. This is true both for the normal graphics package and for pgf. When using pgf, do not add the extension .eps. When using graphics, do add the extension.

If you have a .eps graphic and wish to use pdflatex, you can use the program ps2pdf to convert the graphic to a .pdf file. Some modern distributions enable write18 which allows pdflatex to do that automatically. Note, however, that it is often a better idea to directly generate a .pdf if the program that produced the .eps supports this.

13.3 Including Graphic Files Ending .pdf, .jpg, .jpeg or .png

The four formats .pdf, .jpg, .jpeg, and .png can only be included by pdflatex. As before, do not add these extension when using pgf, but do add them when using graphics. If your graphic file has any of these formats and you wish/must use latex and dvips, you have to convert your graphic to .eps first.

13.4 Including Graphic Files Ending .mps

A graphic file ending .mps (MetaPost PostScript) is a special kind of Encapsulated PostScript file. Files in this format are produced by the MetaPost program. As you know, is a program that converts simple plain text into beautifully typeset documents. The MetaPost program is similar, only it converts simple plain text into beautiful graphics.

The MetaPost program converts a plain text file ending .mp into an .mps file (although for some unfathomable reason the extension is not added). The .mp file must contain text written in the MetaFont programming language. Since .mps files are actually also .eps files, you can use the normal \includegraphics command to include them.

However, as a special bonus, you can also include such a file when using pdflatex. Normally, pdflatex cannot handle .eps files, but the .mps files produced by MetaPost have such a simple and special structure that this is possible. The graphics package implements some filters to convert such PostScript output to pdf on-the-fly. For this to work, the file should end .mps instead of .eps. The following command can be used to make the graphics package just assume the extension .mps for any file it knows nothing about (like files ending with .1, which is what MetaPost loves to produce):


This special feature currently only works with the graphics package, not with pgf.

13.5 Including Graphic Files Ending .mmp

The format .mmp (Multi-MetaPost) is actually not a format that can be included directly in a -file. Rather, like a .mp file, it first has to be converted using the MetaPost program. The crucial difference between .mp and .mmp is that in the latter multiple graphics can reside in a single .mmp file (actually, multiple graphics can also reside in a .mp file, but by convention such a file is called .mmp). When running MetaPost on a .mmp file, it will create not a single encapsulated PostScript file, but several, ending .0, .1, .2, and so on. The idea is that .0 might contain a main graphic and the following pictures contain overlay material that should be incrementally added to this graphic.

To include the series of resulting files, you can use the command \multiinclude from the mpmulti or from the xmpmulti package. How this program works is explained in Section 14.1.3.