Emacs ,org, beamer - No definition for class `beamer' in `org-export-latex-classes'
Asked Answered
W

4

11

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?

Warner answered 14/7, 2011 at 10:14 Comment(2)
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.Kiangsi
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-*.Donothingism
B
10

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

Bohs answered 14/7, 2011 at 10:44 Comment(1)
Update: The variable in question is now org-latex-classes.Datary
D
17

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

Dreamy answered 26/8, 2016 at 17:22 Comment(2)
Thanks! This also worked for me but took an oddly long time to make the pdf.Seamus
This is the only one of the answers that worked with my installation.Pages
B
10

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

Bohs answered 14/7, 2011 at 10:44 Comment(1)
Update: The variable in question is now org-latex-classes.Datary
K
4

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.

Kiangsi answered 1/11, 2011 at 21:1 Comment(4)
The tutorial you suggest is the same one that the OP was following. I am doing the same and the export function returns the same error for me as for the OP.Marlysmarmaduke
@SabreWolfy: whoops! Sorry to have missed that. I'll comment above for more info.Kiangsi
As of org-mode 9.4 C-c C-e p doesn't workBumboat
@Bumboat in 2022 (or maybe always), it should be C-c C-e l P. (that's a lower case L, not a 1). It looks like I at least missed the l, and possibly should have always used P, not p. Then again, org might have used to work with p given the #+latex_class: beamer option. In any case, look at the updated answer and check out my repo with a fully reproducible config and file you can test.Kiangsi
R
0

Only exporting to PDF worked after I've exported to a TeX file first with org-beamer-export-to-latex

Risky answered 16/11, 2022 at 4:40 Comment(1)
I am glad that I wrote this somewhere, even though the answer is not upvoted, here I am after a year and a half fixing my own problems.Risky

© 2022 - 2024 — McMap. All rights reserved.