Jump to content

LaTeX/Presentations

From Wikibooks, open books for an open world
Clipboard

To do:
* Add other packages for creating presentations.

  • Working with columns
  • Navigation — see here


LaTeX

Getting Started
  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics
  5. How to get help

Common Elements

  1. Document Structure
  2. Text Formatting
  3. Paragraph Formatting
  4. Colors
  5. Fonts
  6. List Structures
  7. Special Characters
  8. Internationalization
  9. Rotations
  10. Tables
  11. Title creation
  12. Page Layout
  13. Customizing Page Headers and Footers‎
  14. Importing Graphics
  15. Floats, Figures and Captions
  16. Footnotes and Margin Notes
  17. Hyperlinks
  18. Labels and Cross-referencing
  19. Initials

Mechanics

  1. Errors and Warnings
  2. Lengths
  3. Counters
  4. Boxes
  5. Rules and Struts

Technical Text

  1. Mathematics
  2. Advanced Mathematics
  3. Theorems
  4. Chemical Graphics
  5. Algorithms
  6. Source Code Listings
  7. Linguistics

Special Pages

  1. Indexing
  2. Glossary
  3. Bibliography Management
  4. More Bibliographies

Special Documents

  1. Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
  2. Letters
  3. Presentations
  4. Teacher's Corner
  5. Curriculum Vitae
  6. Academic Journals (MLA, APA, etc.)

Creating Graphics

  1. Introducing Procedural Graphics
  2. MetaPost
  3. Picture
  4. PGF/TikZ
  5. PSTricks
  6. Xy-pic
  7. Creating 3D graphics

Programming

  1. Macros
  2. Plain TeX
  3. Creating Packages
  4. Creating Package Documentation
  5. Themes

Miscellaneous

  1. Modular Documents
  2. Collaborative Writing of LaTeX Documents
  3. Export To Other Formats

Help and Recommendations

  1. FAQ
  2. Tips and Tricks

Appendices

  1. Authors
  2. Links
  3. Package Reference
  4. Sample LaTeX documents
  5. Index
  6. Command Glossary

edit this boxedit the TOC

LaTeX can be used for creating presentations. There are several packages for the task, such as- Powerdot, Prosper , Seminar, etc, however, the Beamer package is the most widely used.

It should be noted that Latex produces the presentation as a PDF which can be viewed in fullscreen mode with some pdf reader (e.g. Okular, Evince or Adobe Reader). If you want to navigate in your presentation, you can use the almost invisible links in the bottom right corner without leaving the fullscreen mode.

The Beamer package

[edit | edit source]

The beamer package is provided with most LaTeX distributions, but is also available from CTAN. If you use MikTeX, all you have to do is to include the beamer package and let LaTeX download all wanted packages automatically. The documentation explains the features in great detail. You can also have a look at the PracTex article Beamer by Example.[1]

The beamer package also loads many useful packages including xcolors, hyperref, etc. An introductory example and its output are shown below.

\documentclass[10pt]{beamer}
% Add extra packages here
\title{Presentation on XXX topic}
\author{AAA}
\begin{document}
   \maketitle
	\begin{frame}
		\frametitle{This is the first slide}
		Here you can put any text/equation etc. 
		$a^2 + b^2 = c^2$.		
	\end{frame}
	\begin{frame}
		\frametitle{This is the second slide}
		\framesubtitle{A bit more information about this}
		Some random text.		
	\end{frame}
\end{document}
An example for simple beamer presentation.

In above code, the Beamer package is loaded by the \documentclass{beamer} command in the header. The usual header information may then be specified. In Beamer presentation a frame is an equivalent term for the slide (used in MS office). A frame is defined using the environment \begin{frame} ...... \end{frame}. The \frametitle{} command specifies the title for each slide. The frame title and subtitle can also be passed with the environment as following.

\begin{frame}{Title of frame}{subtitle of frame}
...
\end{frame}

The usual environments (itemize, enumerate, equation, etc.) may be used. Inside frames, you can use environments like block, theorem, proof, ... Also, \maketitle is possible to create the Title page, if title and author are set.

Title page and author information

[edit | edit source]

The title page is the first page where one may insert following information

  • Title and subtitle (optional)- Use\title and \subtitle commands, or use \title[short title (optional)]{Long title}{subtitle (optional)}
  • Author(s) name- Use the \author{} command.
  • Institute name- Use the \institute command. Note the use of \inst{1} and \inst{2} commands to associate the authors with their respective institutes.
  • Date and Place of presentation- It can be inserted using the \date[short date(optional)]{Long date} command.
  • Logo of Institute, etc.

It should be noted that the information within square braces, i.e., [ ] is optional.

\documentclass{beamer}
\title[Crisis] {The Economics of Financial Crisis}{Evidence from India}
\author[Author, Anders] {F.~Author\inst{1} \and S.~Anders\inst{2}}
\institute[Universities Here and There] { 
    \inst{1} Institute of Computer Science\newline  University Here  	
    \and
    \inst{2} Institute of Theoretical Philosophy\newline University There}
\date[KPT 2004] {Conference on Presentation Techniques, 2004}
\subject{Computer Science}

\begin{document}
     \maketitle
      % place your frames here. 
\end{document}
The title page for a simple beamer class (without theme type or theme color)

It is important to include the \maketitle command in the document (as in above code) to create the title frame. The commands \maketitle and \titlepage are equivalent.

Table of Contents

[edit | edit source]

The table of contents, with the current section highlighted, is displayed by:

\begin{frame}
\frametitle{Table of Contents}
\tableofcontents[currentsection]
\end{frame}

This can be done automatically at the beginning of each section using the following code in the preamble:

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}

Or for subsections:

\AtBeginSubsection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection,currentsubsection]
  \end{frame}
}

Sections and subsections

[edit | edit source]

As in all other LaTeX files, it is possible to structure the document using

\section[Section]{My section}
\subsection[Subsection]{My subsection}
\subsubsection[Subsubsection]{My subsubsection}

Those commands have to be put before and between frames. They will modify the table of contents with the argument in brackets. The optional argument will be shown in the headline navigation on the slide, depending on the theme used. You can use \sectionpage macro to generate a separator slide for a declared section, for example

\begin{frame}\sectionpage\end{frame}

References (Beamer)

[edit | edit source]

The following example shows a manually made references slide containing two entries:

\begin{frame}[allowframebreaks]
  \frametitle<presentation>{Further Reading}    
  \begin{thebibliography}{10}    
  \beamertemplatebookbibitems
  \bibitem{Autor1990}
    A.~Autor.
    \newblock {\em Introduction to Giving Presentations}.
    \newblock Klein-Verlag, 1990.
  \beamertemplatearticlebibitems
  \bibitem{Jemand2000}
    S.~Jemand.
    \newblock On this and that.
    \newblock {\em Journal of This and That}, 2(1):50--100, 2000.
  \end{thebibliography}
\end{frame}

As the reference list grows, the reference slide will divide into two slides and so on, through use of the allowframebreaks option. Individual items can be cited after adding an 'optional' label to the relevant bibitem stanza. The citation call is simply \cite. Beamer also supports limited customization of the way references are presented (see the manual).

The different types of referenced work are indicated with a little symbol (e.g. a book, an article, etc.). The symbol is set with the commands beamertemplatebookbibitems and beamertemplatearticlebibitems . It is also possible to use setbeamertemplate directly, like so


\begin{frame}[allowframebreaks]
  \frametitle<presentation>{Further Reading}    
  \begin{thebibliography}{10}    
  \setbeamertemplate{bibliography item}[book]
  \bibitem{Autor1990}
    A.~Autor.
    \newblock {\em Introduction to Giving Presentations}.
    \newblock Klein-Verlag, 1990.
  \setbeamertemplate{bibliography item}[article]
  \bibitem{Jemand2000}
    S.~Jemand.
    \newblock On this and that.
    \newblock {\em Journal of This and That}, 2(1):50--100, 2000.
  \end{thebibliography}
\end{frame}

Other possible types of bibliography items, besides book and article , include e.g. online , triangle and text . It is also possible to have user defined bibliography items by including a graphic.

If one wants to have full references appear as foot notes, use the \footfullcite from the biblatex package. For example, it is possible to use

\documentclass[10pt,handout,english]{beamer}
\usepackage[english]{babel}
\usepackage[backend=biber,style=numeric-comp,sorting=none]{biblatex}
\addbibresource{biblio.bib}

\begin{frame}
 \frametitle{Title}
 A reference~\footfullcite{ref_bib}, with ref_bib an item of the .bib file.
\end{frame}

Themes

[edit | edit source]

Beamer offers two ways for define the themes- 1) Use built-in themes, 2) Use user-defined themes.

The Built-in solution
[edit | edit source]

Beamer has several built-in themes which can be used by specifying their "Name" and their "color" in the preamble. This Theme Matrix contains the various theme and color combinations included with Beamer. For more customizing options, have a look to the official documentation included in your distribution of beamer, particularly the part Change the way it looks.

\usetheme{Warsaw}
\usecolortheme{beaver}

The full list of themes is:

  • AnnArbor
  • Antibes
  • Bergen
  • Berkeley
  • Berlin
  • CambridgeUS
  • Copenhagen
  • Darmstadt
  • Dresden
  • Frankfurt
  • Goettingen
  • Hannover
  • Ilmenau
  • JuanLesPins
  • Luebeck
  • Madrid
  • Malmoe
  • Marburg
  • Montpellier
  • PaloAlto
  • Pittsburgh
  • Rochester
  • Singapore
  • Szeged
  • Warsaw
  • boxes
  • default

The full list of color themes is:

  • default
  • albatross
  • beaver
  • beetle
  • crane
  • dolphin
  • dove
  • fly
  • lily
  • orchid
  • rose
  • seagull
  • seahorse
  • whale
  • wolverine
User-defined themes
[edit | edit source]

First you can specify the outertheme, which defines the head and the footline of each slide.

\useoutertheme{infolines} 
\useinnertheme{rectangles}

Here is a list of all available outer and inner themes:

List of Outer themes List of Inner themes
infolines shadow smoothbars split rectangles inmargin
miniframes sidebar smoothtree tree circles rounded

You can define the color of every element:

\setbeamercolor{alerted text}{fg=orange}
\setbeamercolor{background canvas}{bg=white}
\setbeamercolor{block body alerted}{bg=normal text.bg!90!black}
\setbeamercolor{block body}{bg=normal text.bg!90!black}
\setbeamercolor{block body example}{bg=normal text.bg!90!black}
\setbeamercolor{block title alerted}{use={normal text,alerted text},fg=alerted text.fg!75!normal text.fg,bg=normal text.bg!75!black}
\setbeamercolor{block title}{bg=blue}
\setbeamercolor{block title example}{use={normal text,example text},fg=example text.fg!75!normal text.fg,bg=normal text.bg!75!black}
\setbeamercolor{fine separation line}{}
\setbeamercolor{frametitle}{fg=brown}
\setbeamercolor{item projected}{fg=black}
\setbeamercolor{normal text}{bg=black,fg=yellow}
\setbeamercolor{palette sidebar primary}{use=normal text,fg=normal text.fg}
\setbeamercolor{palette sidebar quaternary}{use=structure,fg=structure.fg}
\setbeamercolor{palette sidebar secondary}{use=structure,fg=structure.fg}
\setbeamercolor{palette sidebar tertiary}{use=normal text,fg=normal text.fg}
\setbeamercolor{section in sidebar}{fg=brown}
\setbeamercolor{section in sidebar shaded}{fg=grey}
\setbeamercolor{separation line}{}
\setbeamercolor{sidebar}{bg=red}
\setbeamercolor{sidebar}{parent=palette primary}
\setbeamercolor{structure}{bg=black, fg=green}
\setbeamercolor{subsection in sidebar}{fg=brown}
\setbeamercolor{subsection in sidebar shaded}{fg=grey}
\setbeamercolor{title}{fg=brown}
\setbeamercolor{titlelike}{fg=brown}

Colors can be defined as usual:

\definecolor{chocolate}{RGB}{33,33,33}

Block styles can also be defined:

\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamertemplate{background canvas}[vertical shading][bottom=white,top=structure.fg!25]
\setbeamertemplate{sidebar canvas left}[horizontal shading][left=white!40!black,right=black]

You can also suppress the navigation symbols:

\beamertemplatenavigationsymbolsempty

Fonts

[edit | edit source]

You may also change the fonts for particular elements. If you wanted the title of the presentation as rendered by \begin{frame}[plain]\titlepage\end{frame} to occur in a serif font instead of the default sanserif, you would use:

\setbeamerfont{title}{family=\rmfamily}

You could take this a step further if you are using OpenType fonts with Xe(La)TeX and specify a serif font with increased size and oldstyle proportional alternate number glyphs:

\setbeamerfont{title}{family=\rmfamily\addfontfeatures{Scale=1.18, Numbers={Lining, Proportional}}}
Math Fonts
[edit | edit source]

The default settings for beamer use a different set of math fonts than one would expect from creating a simple math article. One quick fix for this is to use

\usefonttheme[onlymath]{serif}

Frames Options

[edit | edit source]

The options to a frame can be passed as following

\begin{frame}[option1,option2,...,option N]{Title of the frame}
% ...
\end{frame}

Some of the useful options and their description is following.

  • plain : This option removes all the formatting from your slide and thus give you extra space to accommodate a large figure or a large table.
  • shrink: If you want to include lots of text on a slide use the shrink option.
  • allowframebreaks : option will auto-create new frames if there is too much content to be displayed on one.
  • fragile: Before using any verbatim environment (like listings), you should pass the option fragile to the frame environment, as verbatim environments need to be typeset differently. Usually, the form fragile=singleslide is usable (for details see the manual). Note that the fragile option may not be used with \frame commands since it expects to encounter a \end{frame}, which should be alone on a single line.
\begin{frame}[fragile]
\frametitle{Source code}

\begin{lstlisting}[caption=First C example]
int main()
{
    printf("Hello World!");
    return 0;
}
\end{lstlisting}
\end{frame}
[edit | edit source]

Internal and external hyperlinks can be used in beamer to assist navigation. Clean looking buttons can also be added.


Clipboard

To do:

  • add information about hyperref
  • add information about beamerbutton and friends


By default the beamer class adds navigation buttons in the bottom right corner. To remove them one can place

\beamertemplatenavigationsymbolsempty

in the preamble.

Animations

[edit | edit source]

It is possible to make figure and text to appear and disappear using the commands such as \pause, \uncover, \only and \itemize<a-b>. Text or figures after these commands will display after one of the following events (which may vary between PDF viewers): pressing space, return or page down on the keyboard, or using the mouse to scroll down or click the next slide button. A short explanation of each command is as follows and refer to chapter 9 of the Beamer manual for more details..

The \pause statement can be used as following to provide a break. I.e. the text after the command will be displayed on next event (button click/ key press/etc.)

\begin{frame}
\frametitle{Some background}
We start our discussion with some concepts.
\pause
The first concept we introduce originates with Erd\H os.
\end{frame}

The \uncover command specifies the appearance explicitly; \only works the same but without reserving space when hidden.

\begin{frame}
\frametitle{Some background}
\only<1>{To be replaced.}
\uncover<2-3>{Only visible on slides two and three.}
\uncover<4->{Can be seen afterwards until the end.}
\end{frame}

The \item command specifies appearance and disappearance of text by using <a-b> where a and b are the numbers of the events the item is to be displayed for (inclusive). For example:

\begin{itemize}
  \item This one is always shown
  \item<1-> The first time (i.e. as soon as the slide loads)
  \item<2-> The second time
  \item<1-> Also the first time
  \only<1-1> {This one is shown at the first time, but it will hide soon (on the next event after the slide loads).}
\end{itemize}

A simpler approach for revealing one item per click is to use \begin{itemize}[<+->].

\begin{frame}
	\frametitle{`Hidden higher-order concepts?'}
	\begin{itemize}[<+->]
	\item The truths of arithmetic which are independent of PA in some 
	sense themselves `{contain} essentially {\color{blue}{hidden higher-order}},
	 or infinitary, concepts'???
	\item `Truths in the language of arithmetic which \ldots
	\item	That suggests stronger version of Isaacson's thesis. 
	\end{itemize}
\end{frame}

In all these cases, pressing page up, scrolling up, or clicking the previous slide button in the navigation bar will backtrack through the sequence.

Above command uncovers the item and they are visible only on/after the specified frame numbers. One may also use the \setbeamercovered{transparent}command to see the uncovered items, which are shown with little opacity. This means if the visible text is in black then the uncovered text will be in gray. One may use \setbeamercovered{invisible} to revert this setting.

Similar option is also available for formatting the text. for example if you want the text to be of specific style then you may use \style<3->{Text}command. For example one may use \alert<3->{Some text.}which will show the specified text in the respective formatting for specified slides. Similarly one may use

\textbf, \textit, \textsl, \textrm, \textsf, \textcolor, \structure etc. commands.

Same is true for theorem, corollary, and proof environments. An example is given below.

\begin{theorem}<2->[Famous identity] 
$ e^i -1 = 0$
\end{theorem}

For the tables one must add \onslide slide command before placing the new line (i.e., \\) .

Test 1 & repeat & 14.5 & 656 \onslide<3-> \\

Handout mode

[edit | edit source]

In beamer class, the default mode is presentation which makes the slides. However, you can work in a different mode that is called handout by setting this option when calling the class:

\documentclass[12pt,handout]{beamer}

This mode is useful to see each slide only one time with all its stuff on it, making any \itemize[<+->] environments visible all at once (for instance, printable version). Nevertheless, this makes an issue when working with the only command, because its purpose is to have only some text or figures at a time and not all of them together.

If you want to solve this, you can add a statement to specify precisely the behavior when dealing with only commands in handout mode. Suppose you have a code like this

\only<1>{\includegraphics{pic1}}
\only<2>{\includegraphics{pic2}}

These pictures being completely different, you want them both in the handout, but they cannot be both on the same slide since they are large. The solution is to add the handout statement to have the following:

\only<1| handout:1>{\includegraphics{pic1}}
\only<2| handout:2>{\includegraphics{pic2}}

This will ensure the handout will make a slide for each picture.

Now imagine you still have your two pictures with the only statements, but the second one show the first one plus some other graphs and you don't need the first one to appear in the handout. You can thus precise the handout mode not to include some only commands by:

\only<1| handout:0>{\includegraphics{pic1}}
\only<2>{\includegraphics{pic2.eps}}

The command can also be used to hide frames, e.g.

\begin{frame}<handout:0>

or even, if you have written a frame that you don't want anymore but maybe you will need it later, you can write

\begin{frame}<0| handout:0>

and this will hide your slide in both modes.

A last word about the handout mode is about the notes. Actually, the full syntax for a frame is

\begin{frame}
...
\end{frame}
\note{...}
\note{...}
...

and you can write your notes about a frame in the field note (many of them if needed). Using this, you can add an option

\setbeameroption{show only notes}

or

\setbeameroption{show notes}

The first one is useful when you make a presentation to have only the notes you need, while the second one could be given to those who have followed your presentation or those who missed it, for them to have both the slides with what you said.

Columns

[edit | edit source]

Columns environment divides a slide (vertically) into columns. Example

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

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

Example of columns in Beamer

Blocks

[edit | edit source]

Enclosing text in the block environment creates a distinct, headed block of text (a blank heading can be used). This allows to visually distinguish parts of a slide easily. There are three basic types of block. Their formatting depends on the theme being used.

\begin{frame}

   \begin{block}{This is a Block}
      This is important information
   \end{block}

   \begin{alertblock}{This is an Alert block}
   This is an important alert
   \end{alertblock}

   \begin{exampleblock}{This is an Example block}
   This is an example 
   \end{exampleblock}

\end{frame}

Ejemplo de bloques en una presentación con Beamer

PDF options

[edit | edit source]

You can specify the default options of your PDF.[2]

\hypersetup{pdfstartview={Fit}} % fits the presentation to the window when first displayed

Numbering slides

[edit | edit source]

It is possible to number slides using this snippet:

\insertframenumber/\inserttotalframenumber

However, this poses two problems for some presentation authors: the title slide is numbered as the first one, and the appendix or so-called "backup" (aka appendix, reserve) slides are included in the total count despite them not being intended to be public until a "hard" question is asked.[3] This is where two features come in:

  • Ability to exclude certain frames from being numbered. For instance, this may be used at the title slide to avoid counting it:
\begin{frame}[noframenumbering]
content...
\end{frame}
  • This stuff works around the problem of counting the backup frames:
\documentclass[12pt,handout]{beamer}

\usetheme{CambridgeUS}
\setbeamertemplate{page number in head/foot}[appendixframenumber]

\begin{document}
	
\begin{frame}
content
\end{frame}

\appendix

\begin{frame}
content...
\end{frame}

\end{document}

The Powerdot package

[edit | edit source]

The powerdot package is an alternative to beamer. It is available from CTAN. The documentation explains the features in great detail.

The powerdot package is loaded by calling the powerdot class:

\documentclass{powerdot}

The usual header information may then be specified.

Inside the usual document environment, multiple slide environments specify the content to be put on each slide.

\begin{document}
  \begin{slide}{This is the first slide}
    %Content goes here
  \end{slide}
  \begin{slide}{This is the second slide}
    %More content goes here
  \end{slide}
% etc
\end{document}

Simple presentations

[edit | edit source]

The beamer class is very powerful and provides lots of features. For a very simple presentation, a class based on article can be used.

\documentclass[paper=160mm:90mm,fontsize=10pt,DIV=16]{scrartcl}
\usepackage{lmodern}
\pagestyle{empty}
\renewcommand{\familydefault}{\sfdefault}
\newenvironment{slide}[1]{\clearpage
	{\LARGE\bfseries#1\par}\vspace{\baselineskip}
}{}
\usepackage{enumitem}
\setlist{noitemsep}
\title{XeTaL}
\author{Carl Capybara}
\begin{document}
\maketitle
\begin{slide}{slide title}
	This is just some text
	\begin{itemize}
		\item Wombat
		\item Capybara
		\item Mara
	\end{itemize}
\end{slide}
\begin{slide}{Wombat  title}
	This is just some different text
\end{slide}
\end{document}

Beamer based themes/examples

[edit | edit source]

Some of the nice examples of the presentation are available below

References

[edit | edit source]
  1. Andrew Mertz and William Slough, Beamer by Example
  2. Other possible values are defined in the hyperref manual
  3. Appendix Slides in Beamer: Controlling frame numbers
[edit | edit source]


Previous: Letters Index Next: Teacher's Corner