Zwillingssterns Weltenwald
Published on Zwillingssterns Weltenwald (http://www.xn--drachentrnen-ocb.de)

Startseite > Recipes for presentations with beamer latex using emacs org-mode

Recipes for presentations with beamer latex using emacs org-mode

I wrote some recipes for creating the kinds of slides I need with emacs org-mode export to beamer latex.

Update: Read ox-beamer [1] to see how to adapt this to work with the new export engine in org-mode 0.8.

PDF recipes [2] The recipes as PDF (21 slides, 247 KiB) [2]

org-mode file [3] The org-mode sources (12.2 KiB) [3]

Below is an html export of the org-mode file. Naturally it does not look as impressive as the real slides, but it captures all the sources, so I think it has some value.

Note: To be able to use the simple block-creation commands, you need to add #+startup: beamer to the header of your file or explicitely activate org-beamer with M-x org-beamer-mode.

«I love your presentation»:

PS: I hereby allow use of these slides under any of the licenses used by worg [4] and/or the emacs wiki [5].

Table of Contents

  • 1 Introduction
    • 1.1 Usage
      • 1.1.1 (configure your emacs, see Basic Configuration at the end)
      • 1.1.2 C-f <file which ends in .org>
      • 1.1.3 Insert heading:
      • 1.1.4 M-x org-export-as-pdf
    • 1.2 org-mode + beamer = love
      • 1.2.1 Code
      • 1.2.2 Simple block
    • 1.3 Two columns - in commands
      • 1.3.1 Commands
      • 1.3.2 Result
  • 2 Recipes
    • 2.1 Four blocks - code
    • 2.2 Four blocks - result
      • 2.2.1 Column 1
      • 2.2.2 One
      • 2.2.3 Three
      • 2.2.4 Column 2
      • 2.2.5 Two
      • 2.2.6 Four
    • 2.3 Four nice blocks - commands
    • 2.4 Four nice blocks - result
      • 2.4.1 :BMCOL:Bignoreheading:
      • 2.4.2 One
      • 2.4.3 Three
      • 2.4.4 :BMCOL:Bignoreheading:
      • 2.4.5 Two
      • 2.4.6 Four
    • 2.5 Top-aligned blocks
      • 2.5.1 Code
      • 2.5.2 Result
    • 2.6 Two columns with text underneath - code
      • 2.6.1 :Bcolumns:
      • 2.6.2 Underneath
    • 2.7 Nice quotes
      • 2.7.1 Code
      • 2.7.2 Result
    • 2.8 Math snippet
      • 2.8.1 Code
      • 2.8.2 Inline
      • 2.8.3 As equation
      • 2.8.4 Result
      • 2.8.5 Inline
      • 2.8.6 As equation
    • 2.9 \( \LaTeX \)
      • 2.9.1 Code
      • 2.9.2 Result
    • 2.10 Images with caption and label
      • 2.10.1 :Bcolumns:
      • 2.10.2 :Bignoreheading:
    • 2.11 Examples
      • 2.11.1 Code
      • 2.11.2 Result
  • 3 Basic Configuration
    • 3.1 Header
    • 3.2 .emacs config
    • 3.3 .emacs variables
    • 3.4 Required programs
      • 3.4.1 Emacs - (gnu.org/software/emacs)
      • 3.4.2 Beamer \( \LaTeX \) - (bitbucket.org/rivanvx/beamer)
      • 3.4.3 Pygments - (pygments.org)
  • 4 Thanks and license
    • 4.1 Thanks

1 Introduction

1.1 Usage

1.1.1 (configure your emacs, see Basic Configuration at the end)

1.1.2 C-f <file which ends in .org>

1.1.3 Insert heading:

Hello World

#+LaTeX_CLASS: beamer
#+BEAMER_FRAME_LEVEL: 2

* Hello
** Hello GNU
Nice to see you!

1.1.4 M-x org-export-as-pdf

done: Your first org-beamer presentation.

1.2 org-mode + beamer = love

1.2.1 Code    BMCOL

Recipes
#+LaTeX_CLASS: beamer
#+BEAMER_FRAME_LEVEL: 2
* Introduction
** org-mode + beamer =  love
*** Code :BMCOL:
    :PROPERTIES:
    :BEAMER_col: 0.7
    :END:
<example block>
*** Simple block  :BMCOL:B_block:
    :PROPERTIES:
    :BEAMER_col: 0.3
    :BEAMER_env: block
    :END:
it's that easy!

1.2.2 Simple block    BMCOL B_block

it's that easy!

1.3 Two columns - in commands

1.3.1 Commands    BMCOL B_block

** Two columns - in commands
*** Commands
C-c C-b | 0.7
C-c C-b b
C-n
<eTAB (write example) C-n C-n
*** Result
C-c C-b | 0.3
C-c C-b b
even easier - and faster!

1.3.2 Result    BMCOL B_block

even easier - and faster!

2 Recipes

2.1 Four blocks - code

*** Column 1 :B_ignoreheading:BMCOL:
    :PROPERTIES:
    :BEAMER_env: ignoreheading
    :BEAMER_col: 0.5
    :END:

*** One
*** Three                                                           

*** Column 2 :BMCOL:B_ignoreheading:
    :PROPERTIES:
    :BEAMER_col: 0.5
    :BEAMER_env: ignoreheading
    :END:

*** Two
*** Four

2.2 Four blocks - result

2.2.1 Column 1    B_ignoreheading BMCOL

2.2.2 One

2.2.3 Three

2.2.4 Column 2    BMCOL B_ignoreheading

2.2.5 Two

2.2.6 Four

2.3 Four nice blocks - commands

*** 
C-c C-b | 0.5 # column
C-c C-b i # ignore heading
*** One 
C-c C-b b # block
*** Three 
C-c C-b b
*** 
C-c C-b | 0.5
C-c C-b i
*** Two 
C-c C-b b
*** Four 
C-c C-b b

2.4 Four nice blocks - result

2.4.1    BMCOL B_ignoreheading

2.4.2 One    B_block

2.4.3 Three    B_block

2.4.4    BMCOL B_ignoreheading

2.4.5 Two    B_block

2.4.6 Four    B_block

2.5 Top-aligned blocks

2.5.1 Code    B_block BMCOL

*** Code                                                      :B_block:BMCOL:
    :PROPERTIES:
    :BEAMER_env: block
    :BEAMER_col: 0.5
    :BEAMER_envargs: C[t]
    :END:

*** Result                                                    :B_block:BMCOL:
    :PROPERTIES:
    :BEAMER_env: block
    :BEAMER_col: 0.5
    :END:
pretty nice!

2.5.2 Result    B_block BMCOL

pretty nice!

2.6 Two columns with text underneath - code

2.6.1    B_columns

  • Code    BMCOL

    \tiny

    ***  :B_columns:
        :PROPERTIES:
        :BEAMER_env: columns
        :END:
    
    **** Code :BMCOL:
        :PROPERTIES:
        :BEAMER_col: 0.6
        :END:
    
    **** Result :BMCOL:
        :PROPERTIES:
        :BEAMER_col: 0.4
        :END:
    
    *** Underneath :B_ignoreheading:
        :PROPERTIES:
        :BEAMER_env: ignoreheading
        :END:
    Much text underneath! Very Much.
    Maybe too much. The whole width!
    

    \normalsize


  • Result    BMCOL

2.6.2 Underneath    B_ignoreheading

Much text underneath! Very Much. Maybe too much. The whole width!

2.7 Nice quotes

2.7.1 Code    B_block BMCOL

#+begin_quote
Emacs org-mode is a 
great presentation tool - 
Fast to beautiful slides.
- Arne Babenhauserheide
#+end_quote

2.7.2 Result    B_block BMCOL

Emacs org-mode is a great presentation tool - Fast to beautiful slides.

  • Arne Babenhauserheide

2.8 Math snippet

2.8.1 Code    BMCOL B_block

2.8.2 Inline    B_block

\( 1 + 2 = 3 \) is clear

2.8.3 As equation    B_block

\[ 1 + 2 \cdot 3 = 7 \]

2.8.4 Result    BMCOL B_block

2.8.5 Inline    B_block

\( 1 + 2 = 3 \) is clear

2.8.6 As equation    B_block

\[ 1 + 2 \cdot 3 = 7 \]

2.9 \( \LaTeX \)

2.9.1 Code    BMCOL B_block

\( \LaTeX \) gives a space 
after math mode.

\LaTeX{} does it, too.

\LaTeX does not.

At the end of a sentence 
both work.
Try \LaTeX. Or try \LaTeX{}.

Only \( \LaTeX \) and \( \LaTeX{} \) 
also work with HTML export.

2.9.2 Result    BMCOL B_block

\( \LaTeX \) gives a space after math mode.

\LaTeX{} does it, too.

\LaTeX does not.

At the end of a sentence both work. Try \LaTeX. Or try \LaTeX{}.

Only \( \LaTeX \) and \( \LaTeX{} \) also work with HTML export.

2.10 Images with caption and label

2.10.1    B_columns

  • Code    B_block BMCOL
    #+caption: GNU Emacs icon
    #+label: fig:emacs-icon
    [[/usr/share/icons/hicolor/128x128/apps/emacs.png]]
    
    This is image (\ref{fig:emacs-icon})
    

  • Result    B_block BMCOL

    file:///usr/share/icons/hicolor/128x128/apps/emacs.png

    GNU Emacs icon

    This is image (emacs-icon)


2.10.2    B_ignoreheading

Autoscaled to the block width!

2.11 Examples

2.11.1 Code    BMCOL B_block

: #+bla: foo
: * Example Header

Gives an example, which does not interfere with regular org-mode parsing.

#+begin_example
content
#+end_example

Gives a simpler multiline example which can interfere.

2.11.2 Result    BMCOL B_block

#+bla: foo
* Example Header

Gives an example, which does not interfere with regular org-mode parsing.

content

Gives a simpler multiline example which can interfere.

3 Basic Configuration

3.1 Header

<Title>

#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
#+AUTHOR: <empty for none, if missing: inferred>
#+DATE: <empty for none, if missing: today>
#+BEAMER_FRAME_LEVEL: 2
#+TITLE: <causes <Title> to be regular content!>

3.2 .emacs config

Put these lines into your .emacs or in a file your .emacs pulls in - i.e. via (require 'mysettings) if the other file is named mysettings.el and ends in (provide 'mysettings).

(org-babel-do-load-languages ; babel, for executing 
 'org-babel-load-languages   ; code in org-mode.
 '((sh . t)
   (emacs-lisp . t)))

(require 'org-latex) ; latex export 
(add-to-list         ; with highlighting
  'org-export-latex-packages-alist '("" "minted"))
(add-to-list 
  'org-export-latex-packages-alist '("" "color"))
(setq org-export-latex-listings 'minted)

3.3 .emacs variables

You can easily set these via M-x customize-variable.

(custom-set-variables ; in ~/.emacs, only one instance 
 '(org-export-latex-classes (quote ; in the init file!
    (("beamer" "\\documentclass{beamer}" 
        org-beamer-sectioning))))
 '(org-latex-to-pdf-process (quote 
    ((concat "pdflatex -interaction nonstopmode" 
             "-shell-escape -output-directory %o %f") 
     "bibtex $(basename %b)" 
     (concat "pdflatex -interaction nonstopmode" 
             "-shell-escape -output-directory %o %f")
     (concat "pdflatex -interaction nonstopmode" 
             "-shell-escape -output-directory %o %f")))))

(concat "…" "…") is used here to get nice, short lines. Use the concatenated string instead ("pdflatex…%f").

3.4 Required programs

3.4.1 Emacs - (gnu.org/software/emacs [6])

To get org-mode and edit .org files effortlessly.

emerge emacs

3.4.2 Beamer \( \LaTeX \) - (bitbucket.org/rivanvx/beamer [7])

To create the presentation.

emerge dev-tex/latex-beamer app-text/texlive

3.4.3 Pygments - (pygments.org [8])

To color the source code (with minted).

emerge dev-python/pygments

4 Thanks and license

4.1 Thanks

Thanks go to the writers of emacs and org-mode, and for this guide in particular to the authors of the org-beamer tutorial on worg [9].

Thank you for your great work!

This presentation is licensed under the GPL [10] (v3 or later) with the additional permission to distribute it without the sources and the copy of the GPL if you give a link to those.1

Footnotes:

1 : \tiny As additional permission under GNU GPL version 3 section 7, you may distribute these works without the copy of the GNU GPL normally required by section 4, provided you include a license notice and a URL through which recipients can access the Corresponding Source and the copy of the GNU GPL.\normalsize

AnhangGröße
emacs-org-beamer-recipes-thumnail.png [11]8.92 KB
emacs-org-beamer-recipes-thumnail-org.png [12]20.61 KB
2012-08-08-Mi-recipes-for-beamer-latex-presentation-using-emacs-org-mode.pdf [2]247.11 KB
2012-08-08-Mi-recipes-for-beamer-latex-presentation-using-emacs-org-mode.org [3]12.18 KB
Werke von Arne Babenhauserheide. Lizensiert, wo nichts anderes steht, unter der GPLv3 or later und weiteren freien Lizenzen.

Diese Seite nutzt Cookies. Und Bilder. Manchmal auch Text. Eins davon muss ich wohl erwähnen — sagen die meisten anderen, und ich habe grade keine Zeit, Rechtstexte dazu zu lesen…


Source URL: http://www.xn--drachentrnen-ocb.de/light/english/politics-and-free-software/recipes-presentations-beamer-latex-using-emacs-org-mode

Links:
[1] http://orgmode.org/worg/exporters/beamer/ox-beamer.html
[2] http://www.xn--drachentrnen-ocb.de/files/2012-08-08-Mi-recipes-for-beamer-latex-presentation-using-emacs-org-mode_1.pdf
[3] http://www.xn--drachentrnen-ocb.de/files/2012-08-08-Mi-recipes-for-beamer-latex-presentation-using-emacs-org-mode_1.org
[4] http://orgmode.org/worg/
[5] http://emacswiki.org
[6] http://gnu.org/software/emacs
[7] https://bitbucket.org/rivanvx/beamer
[8] http://pygments.org
[9] http://orgmode.org/worg/org-tutorials/org-beamer/tutorial.html
[10] http://gnu.org/licenses/gpl.html
[11] http://www.xn--drachentrnen-ocb.de/files/emacs-org-beamer-recipes-thumnail.png
[12] http://www.xn--drachentrnen-ocb.de/files/emacs-org-beamer-recipes-thumnail-org.png