Beamer is a LaTeX module that allows you to create presentation slides in a similar manner to creating LaTeX documents. Here we will show you how to use it to create presentations inside Emacs. Tip: Download our Emacs keyboard shortcuts cheatsheet to increase your productivity.
How does Beamer work?
Beamer is an extension of the LaTeX document system that allows you to create a customizable slides module. One key difference between Beamer and the default LaTeX is that it uses frames instead of sections. A Beamer frame is a document page that you can change the content and its geometry. For example, it is easy for Beamer to use an entirely different theme between multiple frames. This approach allows Beamer to be both flexible and portable.
Using Beamer in Emacs
One of the easiest ways to use Beamer in Emacs is through Org Mode. With that, installing Org Mode and LaTeX is incredibly easy. First, you need to install LaTeX through your distribution’s package repository. In Ubuntu, run the following command to install LaTeX: From there, Ubuntu will then download and install all the necessary packages to properly run the whole LaTeX suite in your computer. To install Org Mode in Emacs, press Alt + X, then type “package-install”. This will then bring up a prompt where you can type the package that you want to install. Type org. Doing that will then tell Emacs to download, compile then install the source code for Org to your Emacs installation.
Creating a Basic Presentation in Emacs
With LaTeX and Org mode installed, you can now create your first Beamer document. This template contains the recommended defaults for any Org document. For the most part, this template will be enough for a basic presentation. With that done, you can now start creating your first slide. Org uses the first two levels of the document to establish both the category and section of your presentation. Knowing that, consider the following example:
The first level serves as the category and title slide for the all the slides under it. This allows you to group the slides underneath it according to a particular theme. In this example, I labelled the first level as “Introduction”.The second level serves as a sub-category which you can use to further specify your slides. This is similar to the \section{} block on a regular LaTeX document.Lastly, the third level are the slides that will be displayed in the final Beamer output. This means that any content you write under this level will be displayed as text in your presentation.
Adding Bullets and Symbols to Slides
Aside from creating simple text slides, it is also possible to include bullet points and special symbols in your Beamer presentation. To add bullets in a Beamer slide, all you need to do is to create an Org bullet under a slide heading. Org will detect and convert it to its Beamer counterpart. For example, this is an excerpt for a Beamer slide with three bullet points: On the other hand, using special symbols in Beamer can be tricky. This is because you will need to provide their specific LaTeX control character. For example, to write the Greek symbol “α” you will need to write the code \alpha in your Org document. One way to deal with this issue is through Org Tab Completion. This is a built-in feature that provides helpful suggestions for the special characters that you can insert. To use this, all you need to do is to begin typing the name of a character and press Esc + Tab.
Adding Images to Slides in Emacs
Beamer also has native image support. All you need to do is to provide the file path of the image in double square brackets. The file path for these links can either be absolute or relative. For example, the following code creates two Beamer slides that displays two different images:
Adding Tables to Slides in Emacs
Aside from symbols and images, you can also insert tables in your presentation. Beamer uses the default LaTeX table syntax for the table’s content which it then converts to a printable line table. One issue with this approach is that the LaTeX table syntax can get incredibly complex. LaTeX allows you to change the very nature of how you create and format line tables. While this can be useful for advanced users, it can be an issue for beginners. Org Mode allows you to circumvent this requirement and create presentation-ready tables through its own table function. Further, creating an Org-style table is also incredibly easy. All you need to do is to type the pipe symbol (|) and press Tab. This will then automatically generate a single-column table where you can type the data that you want to present. From there, you can extend the columns and rows that you can use by typing beyond the current table and pressing Tab. Org will also readjust the table’s size to fit the new content. For example, this is a slide that has three columns: Once done, you can now convert this slide by going through Org’s Export Menu. From there, Org will then convert each table cell to its respective Beamer equivalent.
Changing the Default Beamer Theme in Emacs
By default, Beamer uses the “default” theme in all its slides. It is a generic blue-white theme that follows LaTeX’s design cues. While this will work for almost any type of presentation, some users might find this theme too formal and technical. To change the default theme in Beamer, add the #+LaTeX_HEADER: variable at the start of your document. Follow that with the name of the theme that you want to use. For example, this is a Beamer document that uses the Berlin theme: Image credit: Unsplash To change this behavior, all you need to do is to go to your document’s preamble and look for #+OPTIONS:. This is a special variable that determines how your Org document will look and behave. From there, you then need to find the H: parameter in the variable’s value list. This is what controls which headings are converted to slides in Beamer. The corresponding value will dictate the level of heading that Org will use for its slides. In order to use the higher level headings, you need to provide a value of either 1 or 2. One way to deal with this is by using a third-party LaTeX plugin such as multimedia. To start using it, you need to write the following line at the start of your document’s preamble: #+LATEX_HEADER: \usepackage{multimedia} From there, you can then use the following line of code to create a frame with a single video file attached to it: #+begin_latex\begin{frame} \movie[width=\textwidth,height=3cm]{Video Label}{samplemovie.mp4}\end{frame}#+end_latex sudo tlmgr install beamer Doing this will force the TeXLive installation to look and check whether Beamer is currently present in the system. From there, it will then either reinstall Beamer or get a new copy from the internet. Once done, you then need to reload Emacs to see if it now detects the Beamer installation.