开发者

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

I am following开发者_如何学Go 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?


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


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜