Browse Source

org-beamer tutorial: added babel example with Octave code

Eric S Fraga 9 years ago
parent
commit
d8dc1a8ebf
2 changed files with 101 additions and 10 deletions
  1. 36 0
      org-tutorials/org-beamer/presentation.org
  2. 65 10
      org-tutorials/org-beamer/tutorial.org

+ 36 - 0
org-tutorials/org-beamer/presentation.org

@@ -74,6 +74,42 @@ with its own headline, is displayed in a block:
     #+ATTR_LATEX: width=\textwidth
     [[file:../../images/org-beamer/a-simple-slide.png]]
 
+** Babel
+   :PROPERTIES:
+   :BEAMER_envargs: [t]
+   :END:
+*** Octave code						      :BMCOL:B_block:
+    :PROPERTIES:
+    :BEAMER_col: 0.45
+    :BEAMER_env: block
+    :END:
+#+srcname: octaveexample
+#+begin_src octave :results output :exports both
+A = [1 2 ; 3 4]
+b = [1; 1];
+x = A\b
+#+end_src
+
+*** The output						      :BMCOL:B_block:
+    :PROPERTIES:
+    :BEAMER_col: 0.4
+    :BEAMER_env: block
+    :BEAMER_envargs: <2->
+    :END:
+
+#+results: octaveexample
+#+begin_example
+A =
+
+   1   2
+   3   4
+
+x =
+
+  -1
+   1
+
+#+end_example
 
 * Conclusions
 

+ 65 - 10
org-tutorials/org-beamer/tutorial.org

@@ -13,6 +13,7 @@
 #+LINK_UP:   
 #+LINK_HOME: 
 
+#+startup: oddeven
 
 * Introduction
 
@@ -32,7 +33,7 @@ notation for
 keybindings]].
 
 * First steps
-*** The export template
+** The export template
 Starting with an empty file called =presentation.org= [1], say, the
 first step is to insert the default org export template (=C-c C-e t=
 with the default keybindings). This will generate something that looks
@@ -62,7 +63,7 @@ export options, most commonly the =toc= option for generating a table
 of contents.  For this document, and the [[file:presentation.org][associated sample
 presentation]], I have left all options as they are by default according
 to the template.
-*** Beamer specific settings
+** Beamer specific settings
 As well as the general options provided by the template, there are
 Beamer specific options.  The following options are what I use:
 
@@ -78,7 +79,7 @@ Beamer class and to use the larger font settings[2].
 
 The following line specifies how org headlines translate to the Beamer
 document structure.
-*** Outline levels for frames (slides)
+** Outline levels for frames (slides)
 #+BEGIN_Example
 ,#+BEAMER_FRAME_LEVEL: 2
 #+END_Example
@@ -89,7 +90,7 @@ headline will be translated into a frame.  Beamer, however, also makes
 use of LaTeX sectioning to group frames.  If this appeals, setting
 the option to a value of 2 tells org to export second level headlines
 as frames with top level headlines translating to sections.
-*** Column view for slide and block customisation
+** Column view for slide and block customisation
 The final line that is useful to specify to set up the presentation is
 
 #+BEGIN_Example
@@ -112,7 +113,7 @@ headline.  A few example slides are presented below.  These will only
 cover the basic needs; for more complex examples and possible
 customisations, I refer you to the [[http://orgmode.org/worg/org-tutorials/org-beamer.php][detailed manual]].
 
-*** A simple slide
+** A simple slide
 The simplest slide will consist of a title and some text.  For instance,
 
 #+BEGIN_Example
@@ -131,7 +132,7 @@ that looks like this:
 #+caption: Simple slide exported from org to LaTeX using beamer
 [[file:../../images/org-beamer/a-simple-slide.png]]
 
-*** A more complex slide using blocks
+** A more complex slide using blocks
 
 Beamer has the concept of block, a set of text that is logically
 together but apart from the rest of the text there may be in a slide.
@@ -178,7 +179,7 @@ only and has no direct effect on the presentation.  You cannot change
 the behaviour by changing the tag; it is the property that controls
 the behaviour.
 
-***** Slides with columns
+** Slides with columns
 
 The previous section introduced the special access keys (=C-c C-b=)
 for defining blocks.  This same interface allows you to define
@@ -224,6 +225,60 @@ to the image file with not descriptive text.  I have added an
 attribute to the image to tell LaTeX to scale the image to the full
 width of the column.
 
+** Using Babel
+One of my main uses for Beamer is the preparation of slides for
+teaching.  I happen to teach [[http://www.octave.org/][Octave]] to engineering students.  Org
+provides the [[http://orgmode.org/worg/org-contrib/babel/index.php][Babel]] framework for embedding code within org
+files.  For teaching, this is an excellent tool for presenting codes
+and the results of evaluating those codes.
+
+For instance, the following code:
+#+begin_example
+,** Babel
+   :PROPERTIES:
+   :BEAMER_envargs: [t]
+   :END:
+,*** Octave code						      :BMCOL:B_block:
+    :PROPERTIES:
+    :BEAMER_col: 0.45
+    :BEAMER_env: block
+    :END:
+,#+srcname: octaveexample
+,#+begin_src octave :results output :exports both
+A = [1 2 ; 3 4]
+b = [1; 1];
+x = A\b
+,#+end_src
+
+,*** The output						      :BMCOL:B_block:
+    :PROPERTIES:
+    :BEAMER_col: 0.4
+    :BEAMER_env: block
+    :BEAMER_envargs: <2->
+    :END:
+
+,#+results: octaveexample
+,#+begin_example
+A =
+
+   1   2
+   3   4
+
+x =
+
+  -1
+   1
+
+,#+end_example
+
+#+end_example
+
+will generate a slide with two blocks with a pause between the display
+of each of the two blocks:
+
+#+caption: The use of babel for code display and execution
+[[file:../..//images/org-beamer/babel-octave.png]]
+
 * Customisation
 
 Org has a very large number of customisable aspects.  Although
@@ -232,7 +287,7 @@ most people using org initially.  The same applies to the Beamer
 export support.  However, there are some options which many will soon
 wish to change.
 
-*** Beamer theme
+** Beamer theme
 
 Beamer has a large number of themes and I simply refer the reader to
 the manual or the Web to find what themes are available and what they
@@ -250,7 +305,7 @@ different from the default (with no other changes required!):
 #+caption: Two column slide with the Madrid Beamer theme
 [[file:../../images/org-beamer/two-column-slide-madrid-style.png]]
 
-*** Table of contents
+** Table of contents
 
 The default =toc:t= option generated by the [[*The%20export%20template][export template command]]
 (=C-c C-e t=) indicates that a table of contents will be generated.
@@ -268,7 +323,7 @@ preamble:
 ,#+latex_header: \AtBeginSection[]{\begin{frame}<beamer>\frametitle{Topic}\tableofcontents[currentsection]\end{frame}}
 #+END_Example
 
-*** Column view for slide and block customisation
+** Column view for slide and block customisation
 
 In [[*Column%20view%20for%20slide%20and%20block%20customisation][an early section of this document]], I described a magical
 incantation!  This incantation defines the format for viewing org