Update issue file.
[Worg.git] / org-tutorials / org-beamer / tutorial.org
blob427f76f8e5219209142c172284e7999a8183394a
1 #+TITLE:     Writing Beamer presentations in org-mode
2 #+AUTHOR:    Eric S Fraga
3 #+EMAIL:     e.fraga@ucl.ac.uk
4 #+DATE:      2010.04.12 10:42:43
5 #+DESCRIPTION: 
6 #+KEYWORDS: 
7 #+LANGUAGE:  en
8 #+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
9 #+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
10 #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
11 #+EXPORT_SELECT_TAGS: export
12 #+EXPORT_EXCLUDE_TAGS: noexport
13 #+LINK_UP:   
14 #+LINK_HOME: 
17 * Introduction
19 Beamer is a LaTeX package for writing presentations.  This documents
20 presents a simple introduction to preparing beamer presentations using
21 [[http://orgmode.org/][org-mode]] in Emacs.
23 This documents assumes that the reader is already acquainted with org-mode
24 itself and with *exporting* org-mode documents to LaTeX.  There are tutorials
25 and references available for both org-mode itself, for
26 [[http://orgmode.org/manual/Exporting.html#Exporting][LaTeX exporting]], and
27 for
28 [[http://orgmode.org/manual/Beamer-class-export.html#Beamer-class-export][Beamer
29 Class Export]].  The document also assumes that the reader understands the
30 notation for
31 [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Commands.html#Commands][Emacs
32 keybindings]].
34 * First steps
35 *** The export template
36 Starting with an empty file called =presentation.org= [fn:2: [[file:presentation.org][A
37 previously created example presentation]] is available.], say, the first
38 step is to insert the default org export template (=C-c C-e t= with
39 the default keybindings).  This will generate something that looks
40 like this (some specific entries will vary):
42 #+BEGIN_Example
43 ,#+TITLE:     Writing Beamer presentations in org-mode
44 ,#+AUTHOR:    Eric S Fraga
45 ,#+EMAIL:     e.fraga@ucl.ac.uk
46 ,#+DATE:      2010-03-30 Tue
47 ,#+DESCRIPTION: 
48 ,#+KEYWORDS: 
49 ,#+LANGUAGE:  en
50 ,#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
51 ,#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
52 ,#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
53 ,#+EXPORT_SELECT_TAGS: export
54 ,#+EXPORT_EXCLUDE_TAGS: noexport
55 ,#+LINK_UP:   
56 ,#+LINK_HOME: 
57 #+END_Example
59 In this default template, you will want to modify, at the very least,
60 the title, as I have done, as this will be used as the title of your
61 presentation.  It will often be useful to modify some of the LaTeX
62 export options, most commonly the =toc= option for generating a table
63 of contents.  For this document, and the [[file:presentation.org][associated sample
64 presentation]], I have left all options as they are by default according
65 to the template.
66 *** Beamer specific settings
67 As well as the general options provided by the template, there are
68 Beamer specific options.  The following options are what I use:
70 #+BEGIN_Example
71 ,#+startup: beamer
72 ,#+LaTeX_CLASS: beamer
73 ,#+LaTeX_CLASS_OPTIONS: [bigger]
74 #+END_Example
76 The first line enables the Beamer specific commands for org-mode (more
77 on this below); the next two tell the LaTeX exporter to use the
78 Beamer class and to use the larger font settings[fn:1: I am a firm
79 believer in using the largest font possible to encourage less text on
80 slides.  This is obviously a personal view.].  
82 The following line specifies how org headlines translate to the Beamer
83 document structure.
84 *** Outline levels for frames (slides)
85 #+BEGIN_Example
86 ,#+BEAMER_FRAME_LEVEL: 2
87 #+END_Example
89 A Beamer presentation consists of a series of slides, called /frames/
90 in Beamer.  If the option shown above has a value of 1, each top level
91 headline will be translated into a frame.  Beamer, however, also makes
92 use of LaTeX sectioning to group frames.  If this appeals, setting
93 the option to a value of 2 tells org to export second level headlines
94 as frames with top level headlines translating to sections.
95 *** Column view for slide and block customisation
96 The final line that is useful to specify to set up the presentation is
98 #+BEGIN_Example
99 ,#+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra)
100 #+END_Example
102 The purposes of this line is to specify the format for the special
103 interface that org-mode provides to control the layout of individual
104 slides.  More on this below.
106 Once all of the above has been set up, you are ready to write your
107 presentation.
109 * The slides
111 Each slide, or /frame/ in Beamer terminology, consists of a title and
112 the content.  The title will be derived from the outline headline text
113 and the content will simply be the content that follows that
114 headline.  A few example slides are presented below.  These will only
115 cover the basic needs; for more complex examples and possible
116 customisations, I refer you to the [[http://orgmode.org/worg/org-tutorials/org-beamer.php][detailed manual]].
118 *** A simple slide
119 The simplest slide will consist of a title and some text.  For instance,
121 #+BEGIN_Example
122 ,* Introduction
123 ,** Overview
124 - org-mode template
125 - beamer structure
126 - beamer settings
127 #+END_Example
129 defines a new section, /Introduction/, which has a slide with title
130 /Overview/ and a three item list.  The result of this with the
131 settings defined above, mostly default settings, will generate a slide
132 that looks like this:
134 #+caption: Simple slide exported from org to LaTeX using beamer
135 [[file:../../images/org-beamer/a-simple-slide.png]]
137 *** A more complex slide using blocks
139 Beamer has the concept of block, a set of text that is logically
140 together but apart from the rest of the text there may be in a slide.
141 How blocks are presented will depend on the Beamer theme used
142 ([[*Customisation][customisation in general]] and [[*Beamer%20theme][choosing the theme specifically]] are
143 described below).
145 There are many types of blocks.  The following
147 #+BEGIN_Example
148 ,** A more complex slide
149 This slide illustrates the use of Beamer blocks.  The following text,
150 with its own headline, is displayed in a block:
151 ,*** Org mode increases productivity                               :B_theorem:
152     :PROPERTIES:
153     :BEAMER_env: theorem
154     :END:
155     - org mode means not having to remember LaTeX commands.
156     - it is based on ascii text which is inherently portable.
157     - Emacs!
159     \hfill \(\qed\)
160 #+END_Example
162 creates a slide that has a title (the headline text), a couple of
163 sentences in paragraph format and then a /theorem/ block (in which I
164 prove that org increases productivity).  The theorem proof is a list
165 of points followed a bit of LaTeX code at the end to draw a fancy
166 /end of proof/ symbol right adjusted.
168 You will see that there is an org properties /drawer/ that tells org
169 that the text under this headline is a block and it also specifies the
170 type of block.  You do not have to enter this text directly yourself;
171 org-mode has a special beamer sub-mode which provides an easy to use
172 method for specifying block types (and columns as well, as we shall
173 [[*Column%20view%20for%20slide%20and%20block%20customisation][see in the next section]]).
175 To specify the type of block, you can type =C-c C-b=.  This brings up
176 a keyboard driven menu in which you type a single letter to select the
177 option you wish to apply to this headline.  For the above example, I
178 typed =C-c C-b t=.  The options selected in this manner are also shown
179 as /tags/ on the headline.  However, note that the tag is for display
180 only and has no direct effect on the presentation.  You cannot change
181 the behaviour by changing the tag; it is the property that controls
182 the behaviour.
184 ***** Slides with columns
186 The previous section introduced the special access keys (=C-c C-b=)
187 for defining blocks.  This same interface allows you to define
188 columns.  A headline, as the text that follows it, can be in a block,
189 in a column, or both simutaneously.  The =|= option will define a
190 column.  The following
192 #+BEGIN_Example
193 ,** Two columns
195 ,*** A block                                           :B_ignoreheading:BMCOL:
196     :PROPERTIES:
197     :BEAMER_env: ignoreheading
198     :BEAMER_col: 0.4
199     :END:
200     - this slide consists of two columns
201     - the first (left) column has no heading and consists of text
202     - the second (right) column has an image and is enclosed in an
203       @example@ block
205 ,*** A screenshot                                            :BMCOL:B_example:
206     :PROPERTIES:
207     :BEAMER_col: 0.6
208     :BEAMER_env: example
209     :END:
210 ,    #+ATTR_LATEX: width=\textwidth
211     [[file://../../images/org-beamer/a-simple-slide.png]]
212 #+END_Example
214 defines a two column slide.  As the text in the slide says, the left
215 column is a list and the right one is an image.  The left column's
216 headline text is ignored, specified by =C-c C-b i= which tells org to
217 *ignore* the headline text completely.  The column on the right
218 however is placed with an /example/ block (whose appearance will
219 depend on the Beamer theme).
221 The columns also have widths.  By default, these widths are the
222 proportion of the page width to use so I have specified 40% for the
223 left column and 60% for the right one.
225 The image in the right column is inserted by simply specifying a link
226 to the image file with not descriptive text.  I have added an
227 attribute to the image to tell LaTeX to scale the image to the full
228 width of the column.
230 * Customisation
232 Org has a very large number of customisable aspects.  Although
233 daunting at first, most options have defaults that are suitable for
234 most people using org initially.  The same applies to the Beamer
235 export support.  However, there are some options which many will soon
236 wish to change.
238 *** Beamer theme
240 Beamer has a large number of themes and I simply refer the reader to
241 the manual or the Web to find what themes are available and what they
242 look like.  When you have chosen a theme, you can tell org to use it
243 but inserting some direct LaTeX code into the /preamble/ of the
244 document, the material that comes before the first headline.  For
245 instance, adding this line
246 #+BEGIN_Example
247 ,#+latex_header: \mode<beamer>{\usetheme{Madrid}}
248 #+END_Example
249 to the preamble after the beamer font size
250 option described above will produce a presentation that looks very
251 different from the default (with no other changes required!):
253 #+caption: Two column slide with the Madrid Beamer theme
254 [[file:../../images/org-beamer/two-column-slide-madrid-style.png]]
256 *** Table of contents
258 The default =toc:t= option generated by the [[*The%20export%20template][export template command]]
259 (=C-c C-e t=) indicates that a table of contents will be generated.
260 This will create a slide immediately after the title slide which will
261 have the list of sections in the beamer document.  Please note that if
262 you want this type of functionality, you will have to specify the
263 =BEAMER-FRAME-LEVEL= to be 2 instead of 1 [[*Outline%20levels%20for%20frames%20slides][as indicated above]].
265 Furthermore, if you have decided to use sections, it is possible to
266 have Beamer automatically place a table of contents slide before the
267 start of each section with the new section highlighted.  This is
268 achieved by inserting the following LaTeX code, again in the
269 preamble:
270 #+BEGIN_Example
271 ,#+latex_header: \AtBeginSection[]{\begin{frame}<beamer>\frametitle{Topic}\tableofcontents[currentsection]\end{frame}}
272 #+END_Example
274 *** Column view for slide and block customisation
276 In [[*Column%20view%20for%20slide%20and%20block%20customisation][an early section of this document]], I described a magical
277 incantation!  This incantation defines the format for viewing org
278 property information in column mode.  This mode allows you to easily
279 adjust the values of the properties for any headline in your
280 document.  This image shows the type of information you can see at a
281 glance in this mode:
283 #+caption: Column view of presentation showing special block environments and column widths.
284 [[file:../../images/org-beamer/column-view.png]]
286 We can see the various blocks that have been defined as well as any
287 columns (implicit by the presence of a column width).  By moving to
288 any of these column entries displayed, values can be added, deleted or
289 changed easily.  Please read [[http://orgmode.org/worg/org-tutorials/org-beamer.php][the full org Beamer manual]] for details.