Table of Contents
I have seen enough people going up on stage, logging in to their gmail account to open up their PowerPoint or Google slides, only to find out that opening it up on lecture hall computer completely messes things up. You need to learn latex beamer, it will save you a lot of headache, and it is not even that hard. By the end of this tutorial, you will be able to understand how to create this template slides.
Installation
On Debian based distros, install the full version with the following command.
sudo apt install texlive-full
This will install 8GB of packages! Or you may install only the most useful packages.
sudo apt install biber texlive texlive-science \
texlive-bibtex-extra texlive-latex-extra \
texlive-pictures texlive-publishers \
texlive-fonts-extra
For other distros, you will need to look up the package name.
Your first latex slides
\documentclass[aspectratio=169]{beamer}
\usetheme{Madrid}
\title{Presentation Title}
\author{Your Name}
\institute{Your Institute}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}
Here, copy your first latex slides, paste it in a file named beamer.tex. Madrid is just a theme I like, you may find different themes here. Then run the following command.
pdflatex beamer.tex
A file called beamer.pdf will be generated. To remove the footer and the icons, add the following code to the preamble
\setbeamertemplate{footline}{}
\setbeamertemplate{navigation symbols}{}
This is the most basic setup with latex beamer. Each pages are enclosed by the \begin{frame} and \end{frame} tag, like the title page. Now, add the following code to create another page.
Multilingual support
Let’s kick this off with multilingual support, if you only understand English, I am sorry for you bro, just skip to next section. You will need to install a Unicode supported typesetting engine, and a language pack. I am going to show how to add Chinese characters as an example.
sudo apt install texlive-xetex texlive-lang-chinese
Add the following code to the preamble.
\usepackage{xeCJK}
\setCJKmainfont{Droid Sans Fallback}
To find the available fonts on your system, run the following command.
fc-list :lang=zh
Then, you will be able to add Chinese characters anywhere!
\begin{frame}{Multilingual support 支持多種語言}
在 beamer 展示其他語言很容易啊。
It's easy to show other languages in beamer.
\end{frame}
To compile it to pdf, you will need to use xetex. Run the following command.
xelatex beamer.tex
If you are using Chinese characters to proceed, replace all of pdflatex command by xelatex in the reset of the tutorial.
Lists
\begin{frame}{Lists}
\begin{itemize}
\item Point 1
\item Point 2
\item Point 3
\end{itemize}
\begin{enumerate}
\item Number 1
\item Number 2
\item Number 3
\end{enumerate}
\end{frame}
You may specify the title of the page at the end of \begin{frame}. Create bullet points with itemize, and numbered list with enumerate.
Maths equations
\begin{frame}{Maths equations}
\begin{block}{Important equation}
$$ \int_1^e \frac{\mathrm{d}x}{x} = 1 $$
\end{block}
\begin{alertblock}{Even more important equation}
$$ e = \sum_{n=0}^\infty \frac{1}{n!} = 1 + \frac{1}{1} + \frac{1}{1 \cdot 2} + \frac{1}{1 \cdot 2 \cdot 3} + \cdots $$
\end{alertblock}
\end{frame}
In latex beamer, writing mathematics equations is automatically supported. You can just copy your equations from latex report to here! Enclose the equation with block or alertblock to make it looks important.
Pictures
\begin{frame}{Pictures}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{./latex.jpeg}
\caption{LaTeX logo}
\end{figure}
\begin{figure}
\centering
\includegraphics[trim={1.5cm 3cm 3cm 1.2cm}, clip, width=0.5\textwidth]{./latex.jpeg}
\caption{Cropped LaTeX logo}
\end{figure}
\end{frame}
To add a picture, use the above template and change the relative path of the picture. It is also useful to crop the picture in place, adding trim={1.5cm 3cm 3cm 1.2cm}, clip can crop the image, where the arguments specify cropping from left, bottom, right, and top respectively.
Reference
To add references, create a file called citation.bib, and paste the bibtex citation in it, it can usually be found on google scholar under cite. Here is a sample.
@article{dummy,
title={A Study on Generic Topics Drives Significant Findings},
author={Doe, John and Smith, Jane and Others, Anonymous},
journal={Journal of Generic Research},
pages={1--10},
year={2024},
publisher={Generic Publishing Group}
}
Then add the following code to the preamble.
\usepackage[backend=biber, style=vancouver]{biblatex}
\addbibresource{citation.bib}
Add the following frame as the last slide.
\begin{frame}{References}
\printbibliography
\end{frame}
Lastly, cite this in the slides. Here is an example.
\item Point 1 \cite{dummy}
To render the references in the slides, run the following command to generate beamer.aux which allows you to inject references to it.
pdflatex beamer.tex
Then, run the following command to generate beamer.bbl.
biber beamer
Run pdflatex beamer.tex 2 more times to first generate the references page, and then the inline citation. Once you have beamer.aux, you will only need to first run biber beamer and then pdflatex beamer.tex to compile it.
Full sample
\documentclass[aspectratio=169]{beamer}
\usetheme{Madrid}
\setbeamertemplate{footline}{}
\setbeamertemplate{navigation symbols}{}
\usepackage[backend=biber, style=vancouver]{biblatex}
\addbibresource{citation.bib}
\title{Presentation Title}
\author{Your Name}
\institute{Your Institute}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{Lists}
\begin{itemize}
\item Point 1 \cite{dummy}
\item Point 2
\item Point 3
\end{itemize}
\begin{enumerate}
\item Number 1
\item Number 2
\item Number 3
\end{enumerate}
\end{frame}
\begin{frame}{Maths equations}
\begin{block}{Important equation}
$$ \int_1^e \frac{\mathrm{d}x}{x} = 1 $$
\end{block}
\begin{alertblock}{Even more important equation}
$$ e = \sum_{n=0}^\infty \frac{1}{n!} = 1 + \frac{1}{1} + \frac{1}{1 \cdot 2} + \frac{1}{1 \cdot 2 \cdot 3} + \cdots $$
\end{alertblock}
\end{frame}
\begin{frame}{Pictures}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{./latex.jpeg}
\caption{LaTeX logo}
\end{figure}
\begin{figure}
\centering
\includegraphics[trim={1.5cm 3cm 3cm 1.2cm}, clip, width=0.5\textwidth]{./latex.jpeg}
\caption{Cropped LaTeX logo}
\end{figure}
\end{frame}
\begin{frame}{References}
\printbibliography
\end{frame}
\end{document}