Skip to content

Instantly share code, notes, and snippets.

@stefankablowski
Last active January 15, 2020 16:15
Show Gist options
  • Save stefankablowski/cc3efbca016d6667e34da0bd622bfe2f to your computer and use it in GitHub Desktop.
Save stefankablowski/cc3efbca016d6667e34da0bd622bfe2f to your computer and use it in GitHub Desktop.
Create a simple Presentation with LateX Beamer

Create a simple Presentation with LateX Beamer - A collection of essential commands

Setup

To declare your .tex file as a beamer presentation, put this at the top of your file:

\documentclass{beamer}

If you are german, also use this package:

\documentclass{beamer}

After that wrap your frames inside a document:

\begin{document}
    % frames go here
\end{document}

Note: Create comments with %

Create Frames

Frames are the building blocks of your presentation. Frames are like pages of a book. If you want some content to show up step by step, that can be done with Slides(will be covered later in the document). For now just put your content on different frames.

\begin{frame}
    I am inside a frame
\end{frame}

A title for your frame will appear on top. Put this inside your frame:

\frametitle{The african elephant}

Title Frame

Set some basic information about your presentation (outside your document):

\title{The african elephant}
\subtitle{in its natural surrounding}
\author{E. Phant}
\institute{University of Savanna}
\date{\today}

Then put this as the first frame inside your document (your own frames will follow):

\maketitle

Basic Layouting

You can combine centering and columns as you wish. Most desired Layouts can be achieved like so.

Columns

Create multiple columns. You can define the width as shown below:

\begin{columns}
    \column{.4\textwidth}
        I am the small column on the left.
    \column{.6\textwidth}
        I am the wide column on the right.
\end{columns}

Add Options like so:

\begin{columns}[option]
    ...
\end{columns}

Options may be:

  • b will align the bottom lines of the columns vertically
  • c will center the columns vertically relative to each other (default)
  • onlytextwidth works like totalwidth=\textwidth
  • t first lines of the columns will be aligned
  • T like t, try it
  • totalwidth=<enter your fav width here> columns do not occupy the whole page

Center elements

\begin{center}
    I am so (self-)centered.
\end{center}

For single lines use \centering

Include Images/Graphics

You can use PNG, JPG and PDF in your presentation. At the top of your document use the graphicx package.

\usepackage{graphicx}

Then include your graphics file. Adjust the width (or height) inside the square brackets. Note to not put a file ending in your path.

\includegraphics[width=0.5\textwidth]{./Images/myFile}

A good practice is to put your graphics inside a figure. You can also add a caption above or below \begin{figure}[h] \includegraphics[width=0.5\textwidth]{./Images/myFile} \caption{This image describes the meaning of life} \end{figure}

Floats

In order to control where the compiler will place your figure, you have multiple options: Put the option in the square bracket:

\begin{figure}[h]
Option Description
h Here: Place at the same point where it is in the LateX source code
t Top of the page
b Bottom of the page
p (Extra) page for floats

Note that these are only suggestions for the compiler, it might decide different

Vector Graphics

If you want to include self-made vectorized graphics you have two options:

  • use InkScape and research how to include SVG (good way)
  • create them with draw.io and save them like so: File -> Export -> Advanced -> PDF (quick and dirty, but works fine)

Use Templates

You can find all available Themes here Include one of them like this:

\usetheme{Singapore}

Most of them look really outdated. If you are looking for a modern Theme, you can use Metropolis

\usetheme{metropolis}

Text formatting and styling

Paragraphs

You can write text almost anywhere in your document! To start a new paragraph, leave a line blank in your document. Alternatively you can write \par at the end the line that you want to follow up with a break.

I am paragraph number one\par
I am paragraph number two

This will achieve the same as

I am paragraph number one

I am paragraph number two

Emphasis

Italicize Text

\textit{My Italic Text}

Bold Text

\textbf{My Bold Text}

Coloring

Include this at the top of your document to get access to some basic colors:

\usepackage{xcolor}

Paint your text:

\textcolor{blue}{I am blue... hick}

Paint the background of your text:

\colorbox{black}{Arggh..It's so dark behind me!}

Paint some text with color:

\fcolorbox{blue}{white}{I have a colored Box around me. Cool!}

If you want more advanced colors, you can use (additionally):

\usepackage{xcolor-material}
See Basic Colors! - white - black - cyan - green - yellow - orange - magenta - violet - red - purple - blue - brown - darkgray - gray - lightgray

You can find the full reference for xcolor here.

This will give you access to a huge color palette. For example just use the google colors:

  • GoogleBlue
  • GoogleRed
  • GoogleGreen
  • GoogleYellow

Material Colors

I listed the Material colors here. To get different shades, just add a number between 50 and 900. For example: MaterialRed300

See Material Colors!
- MaterialRed
- MaterialPink
- MaterialPurple
- MaterialDeepOrange
- MaterialBlue
- MaterialIndigo
- MaterialLightBlue
- MaterialCyan
- MaterialTeal
- MaterialGreen
- MaterialLightGreen
- MaterialLime
- MaterialYellow
- MaterialAmber
- MaterialOrange
- MaterialDeepOrange
- MaterialBrown
- MaterialGrey
- MaterialBlueGrey

You can find the full reference here.

Collections

Unordered List

\begin{itemize}
    \item Butter
    \item Bread
    \item Cheese
\end{itemize}

Ordered List

\begin{enumerate}
    \item Introduction
    \item Main Part
    \item Conclusion
\end{enumerate}

Math

If your presentation requires the use of formulas, you are good to go with the following two packages:

\usepackage{amsfonts}
\usepackage{amsmath}

Equations

Everything inside the brackets is in math mode and will be italicized in your compiled document.

\begin{equation}
    a^{2} + b^{2} = c^{2}
\end{equation}

Inline Math

Wrap your math inside dollar signs($).

$5 + 10 = 10$

Special Symbols

If you want to use special characters like π or ϵ, just type them with a backslash (\) in front. To capitalize e.g. greek letters, just capitalize the first letter. Make sure to always wrap these math symbols inside $. The compiler will throw errors whenever he finds such symbols outside math mode.

My favourite character is $\Epsilon$ and my second favourite $\epsilon$

Slides

Let text and images appear step by step with slides. A frame will be divided in as many slides as you wish. And what's best about this: you dont need to maintain the number of slides. You can define: I want my element to appear on slides 3 and 4. The LateX compiler will take care of the rest. How cool is that?

You can take any element inside a frame and wrap it into one of the commands listed below.

The basic syntax to determine when an element should be visible:

  • <1> Show on slide 1
  • <1-> Show on slide 1 until the end of the frame.
  • <1-5> Show on slides 1 to 5
  • <-5> Show until slide 5

This syntax is compatible with many LateX commands you already know, e.g. items inside an enumerate

Command Description Behaviour when disabled
\pause Throw this somewhere in your presentation and you will get a second slide consumes space
\item<-2>Content Content appears on slide one and two consumes space
\onslide<1->{Content} Content will be dislpayed all the time consumes space
\only<1>{Content} This will only appear on first slide consumes no space
\visible<5>{Content} Content will appear on slide 5 consumes space
\invisible<5>{Content} Content will appear never except on slide 5 consumes space
\textbf<5>{Content} Content will be bold on slide 5 consumes space

More in-depth guide can be found here.


Further reading

I hope this guide helped and saved you a little bit of research. Good luck with your presentation - Stefan.

If you wonder how i created the LateX syntax highlighting: use TeX as keyword for your language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment