Skip to content

Part 1 | Part 2 | Part 3 | Part 4 | Part 5

Author: Josh Cassidy (August 2013)

This five-part series of articles uses a combination of video and textual descriptions to teach the basics of creating a presentation using the LaTeX beamer package. These tutorials were first published on the original ShareLateX blog site during August 2013; consequently, today's editor interface (Overleaf) has changed considerably due to the development of ShareLaTeX and the subsequent merger of ShareLaTeX and Overleaf. However, much of the content is still relevant and teaches you some basic LaTeX—skills and expertise that will apply across all platforms.

In the previous post we looked at adding some basic content into our presentation. In this post we're going to look at adding some other types of content.


One of the ways beamer lets us display information on slides is using 'blocks'. To do this we use the block environment:

\begin{block}{Block Title}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua.

At the end of the \begin{block} command we simply enter the block's title in curly brackets. Then whatever we enter in between the \begin{block} and \end{block} commands, forms the content of the block. This is what it looks like:


There are quite a few variations of the block environment that help us produce blocks for different purposes. The first is the alertblock>/code> environment which is similar to the block environment except its colour is red instead of blue:

\begin{alertblock}{Block Title}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua.


Then there's the definition environment which produces a standard blue block but with the title already specified as Definition:

A prime number is a number that...


Next there's the example environment which produces a green block with the title Example.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua.


There is also a group of blocks that are especially useful for presenting mathematics; for example, the theorem environment, the corollary environment and the proof environment:

$ a^2 + b^2 = c^2$
$ x + y = y + x  $
$\omega +\phi = \epsilon $


The theorem and corollary environments automatically put their content in italics. These two also allow us to add extra content to the block title in parenthesis by adding text into square brackets at the end of the \begin{...} command. It's worth mentioning at this point that beamer automatically loads the amsmath package so you can add more complicated mathematics straight away.


Now let's talk about adding code into slides. This is particularly important for any computer science related presentation. To do this we use the semiverbatim environment. In order to use this environment on a frame, we need to add the fragile option into the \begin{frame} command. Now whatever text we enter in the environment will appear as written, except for the backslash, open curly bracket and close curly bracket characters, which will continue to behave as they normally would in LaTeX; therefore, if we want to print some code which includes these characters we need to add an extra backslash before each of them. Here's an example printing the code we used for the title slide:

\frametitle{Including Code}


Hyperlinks and buttons

Finally, I want to discuss adding hyperlinks to our presentation. Before we can create any hyperlinks we need to tag the frames we want to link to using the \label command; for example, we'll add a label to the contents frame, the columns frame and the pictures frame:


Then we use the \hyperlink command to insert a link:

\hyperlink{contents}{click here}

In the first set of curly brackets we enter the label of the target frame and in the second set we add the text that we want to be clickable. Now if we compile the document you'll see the text is now a clickable link.

Beamer also allows us to use buttons. To do this we simply add a button command into the second set of curly brackets. For example, we'll swap the "click here" text for the \beamerbutton command and enter in curly brackets the text we want to appear on the button:

\hyperlink{contents}{\beamerbutton{contents page}}

Here are some other button commands we can use:

\hyperlink{columns}{\beamergotobutton{columns page}}
\hyperlink{pictures}{\beamerskipbutton{pictures page}}
\hyperlink{pictures}{\beamerreturnbutton{pictures page}}

The beamer "go to" button, the beamer "skip" button and the beamer "return" button:


This concludes our second discussion on adding content to our presentation. In the next post we'll look at animating our presentations.

All articles in this series

Please do keep in touch with us via Facebook, Twitter or via e-mail on our contact us page.

Overleaf guides

LaTeX Basics


Figures and tables

References and Citations


Document structure





Field specific

Class files

Advanced TeX/LaTeX