New posts

This commit is contained in:
Brandon Rozek 2022-01-26 23:42:57 -05:00
parent 59861d3bb9
commit f78540d68e
3 changed files with 325 additions and 0 deletions

View file

@ -0,0 +1,35 @@
---
title: "Code in LaTex Beamer"
date: 2022-01-26T23:11:37-05:00
draft: false
tags: ["LaTex"]
math: false
---
I commonly use the [`listings` package](/blog/latexcode/) to showcase code in my LaTex documents. I tried doing the same in my Beamer slidedecks and I ran into an issue where the LaTex source code failed to compile. After digging around, I figured out its because every slide or frame that includes code (or any verbatim environment) needs to be marked as `fragile`. A minimal example is presented below:
```latex
\documentclass{beamer}
\usepackage[utf8]{inputenc}
% Beamer Packages
\usepackage{harvard}
\usetheme{Copenhagen}
% Code Rendering Packages
\usepackage{listings}
\lstset{
language=Java,
columns=flexible,
}
% Begin Slidedeck
\begin{document}
\begin{frame}[fragile]{Code Example}
\begin{lstlisting}
int x = 5;
\end{lstlisting}
\end{frame}
\end{document}
```

View file

@ -0,0 +1,42 @@
---
title: "Multi-Column slides in Beamer"
date: 2022-01-26T23:29:31-05:00
draft: false
tags: ["LaTex"]
math: false
---
When creating slides in LaTex Beamer, it can be frustrating to not have the easy ability to drag text boxes around. Luckily, creating a multi-column layout in Beamer is not difficult! Below is an example of a two column slide layout, where the left side is a bulleted list, and the right side is an image:
```latex
\documentclass{beamer}
\usepackage[utf8]{inputenc}
% Beamer Packages
\usepackage{harvard}
\usetheme{Copenhagen}
\begin{document}
\begin{frame}{About Me}
\begin{columns}
% Column 1
\column{.5\linewidth}
\begin{itemize}
\item Enjoy going on short hikes.
\item Forgetful at times and writes blog posts to jog my memory.
\end{itemize}
% Column 2
\column{.5\linewidth}
\centering
\includegraphics[width=4cm]{images/avatar.jpg}
\end{columns}
\end{frame}
\end{document}
```
![](/files/images/202201262338.svg)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 565 KiB