Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Code in LaTex Beamer

Published on

Updated on

I commonly use the listings package 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:


% Beamer Packages

% Code Rendering Packages

% Begin Slidedeck
\begin{frame}[fragile]{Code Example}
    int x = 5;
Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :