11
votes

I am following this tutorial, and I am getting this error, when I try to export the presentation to latex:

No definition for class `beamer' in `org-export-latex-classes'

Note:
I installed emacs from the repository in Ubuntu. And following are the related packages that are available in my system:

emacs-snapshot
emacs-snapshot-bin-common
emacs-snapshot-common
emacsen-common
latex-beamer
latex-xcolor
preview-latex-style
texlive-latex-base
texlive-latex-extra
texlive-latex-recommended

Am I missing anything? Do I have to configure other things?

3
Can you post the output of M-x org-version as well as specify how you installed it? I'm thinking you need org-beamer.el and am not sure if the org-mode that comes with emacs has it. When I do $ locate org-beamer the only hits I get for org-beamer.el are in my git clone of the current version or org-mode.Hendy
As a heads up, it looks like in version 8 they majorly over-hauled the way exports are handled and it does not (yet) include sensible defaults for beamer. The code export code is now all is ox-*.tacaswell

3 Answers

15
votes

I found I had to run M-x org-beamer-export-to-pdf to get it to work.

10
votes

Yes., you should define beamer class in org-latex-export-classes. an example how to define is in this blog post

3
votes

Edit: updating for 2022 and to make reproducibility more straightforward

The original answer is below, untouched since ~2011. I still think the top upvoted answer and accepted answer aren't necessary in 2022, and org-mode is notoriously hard to troubleshoot without walking through fundamentals:

  • .emacs and other config files
  • the exact .org file used

In trying to recreate the worg tutorial cited, I think it no longer works as-is. Note that the manual cites a different example now.

In any case, here is a github repo I created with the following to help any others who find this:

  • a min-config (with no custom org-latex-classes definition for beamer as the accepted answer suggests
  • a modified beamer_test.org that exports for me using the min-config; some minor tweaks were necessary
  • the pdf and org file with _ref in the name; when users export, they can compare their generated pdf and tex files (the ones in the downloaded repo will be overwritten) to these references to study differences and better identify issues

Hopefully this better removes confusion for any stumbling on this question.

Final note: I believe my answer below was potentially wrong always, or became wrong at some point in the past 10yrs, as it should be C-c C-e l and P for the final option (beamer pdf), not p (regular latex pdf). I don't remember org-mode that far back to know if p ever worked given the #+latex_class: beamer setting or not.

Edit 2 as ceochronos points out in the comments, my answer was probably always wrong anyway, as I left out the lower case L in the export options C-c C-e p vs. C-c C-e l p. Then again, C-c C-e is an interactive menu with no p option, so hopefully it didn't mess with the minds of too many folks over the years!


The accepted answer shouldn't be necessary anymore. There is a built in function for Beamer export. See this tutorial for details. In essence, just put the following at the top of an org file (before any headlines):

#+startup: beamer
#+LaTeX_CLASS: beamer
#+BEAMER_FRAME_LEVEL: 2

First option brings in some beamer specific options, second makes sure export to LaTeX uses the beamer class, third option means top level headlines are sections, second levels are slides. Change value to 1 for just every top headline being a slide.

Then export with C-c C-e p.