# LaTeX package stmaryrd doesn't work together with org-mode beamer template

This page gives some templates to let you make beamer presentations in org-mode. But if I use some symbols from the stmaryrd package, they won't get rendered if I export to pdf using org-mode.

The following is the templates from 2.1 (Beamer specific settings) and 2.2 (Outline levels for frames (slides)) of that page at the time of writing, importing the stmaryrd package (#+LATEX_HEADER: \usepackage{stmaryrd}), some sample text and a formula using some stmaryrd symbols (llbracket, \rrbracket).

#+TITLE:     Writing Beamer presentations in org-mode
#+AUTHOR:    Eric S Fraga
#+EMAIL:     e.fraga@ucl.ac.uk
#+DATE:      2010-03-30 Tue
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE:  en

#+LATEX_HEADER: \usepackage{stmaryrd}

#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:
#+LINK_HOME:

#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]

* Introduction

Some text here

A formula:

$\llbracket 234 \rrbracket$


Exporting this to a pdf file doesn't work, in the sense that the symbols \llbracket and \rrbracket won't be rendered. The same goes for exporting to a tex file, and then using pdflatex to compile the tex file to pdf; this is one of the error messages I get:

! Undefined control sequence.
.73 $\llbracket 234 \rrbracket$


But if this line in the org-file is commented out:

#+LaTeX_CLASS: beamer


The symbols are rendered. But then the pdf file doesn't look like a beamer presentation any more (which is not a surprise). Similarly, if I export to tex, and then comment out this line in the tex file:

\mode<{{{beamermode}}}>


The symbols are rendered correctly. I get a lot of errors when compiling the tex file, and the resulting pdf is not that nice, but at least the symbols are rendered.

Does the stmaryrd package work in a non-beamer org file? Yes; the following document can be compiled to pdf correctly:

#+LATEX_HEADER: \usepackage{stmaryrd}

This is rendered: \llbracket


.emacs setup: This is the setup for beamer that I am using in my .emacs file. It was taken from this blog post. The code adds the beamer class to the org-latex-classes variable.

(add-to-list 'org-latex-classes
;; beamer class, for presentations
'("beamer"
"\\documentclass[11pt]{beamer}\n
\\mode<{{{beamermode}}}>\n
\\usetheme{{{{beamertheme}}}}\n
\\usecolortheme{{{{beamercolortheme}}}}\n
\\beamertemplateballitem\n
\\setbeameroption{show notes}
\\usepackage[utf8]{inputenc}\n
\\usepackage[T1]{fontenc}\n
\\usepackage{hyperref}\n
\\usepackage{color}
\\usepackage{listings}
\\lstset{numbers=none,language=[ISO]C++,tabsize=4,
frame=single,
basicstyle=\\small,
showspaces=false,showstringspaces=false,
showtabs=false,
keywordstyle=\\color{blue}\\bfseries,
commentstyle=\\color{red},
}\n
\\usepackage{verbatim}\n
\\institute{{{{beamerinstitute}}}}\n
\\subject{{{{beamersubject}}}}\n"

("\\section{%s}" . "\\section*{%s}")

("\\begin{frame}[fragile]\\frametitle{%s}"
"\\end{frame}"
"\\begin{frame}[fragile]\\frametitle{%s}"
"\\end{frame}")))

• I had never used org-mode. But there are serious problems in your .tex. (I) You should fill in the blanks in \mode<{{{beamermode}}}>, \usetheme{{{{beamertheme}}}} and \usecolortheme{{{{beamercolortheme}}}}. And (II) presentation materials should be placed in frame environment. Without frame it does look weird. – Symbol 1 Jan 12 '15 at 8:36

## 1 Answer

For my .emacs beamer setup code, I replaced the code described in the question with the following code, as found on this webpage at the time of writing.

(require 'ox-latex)
(add-to-list 'org-latex-classes
'("beamer"
"\\documentclass$presentation$\{beamer\}"
("\\section\{%s\}" . "\\section*\{%s\}")
("\\subsection\{%s\}" . "\\subsection*\{%s\}")
("\\subsubsection\{%s\}" . "\\subsubsection*\{%s\}")))


The aforementioned website seems more up-to-date than the blog post that I was initially using. From what I've found, it seems to be the way to set up Beamer for org-mode, right now.

As for the template for the beamer presentation, I used the interactive function org-beamer-insert-options-template, choosing the "global" option, to generate a template.

Now, using the stmaryrd package in a beamer presentation works fine:

...
#+LATEX_HEADER: \usepackage{stmaryrd}

This is rendered: \llbracket
...