浏览代码

Add support for BEAMER notes.

Carsten Dominik 15 年之前
父节点
当前提交
76b8cab651
共有 4 个文件被更改,包括 60 次插入27 次删除
  1. 17 9
      doc/org.texi
  2. 7 0
      lisp/ChangeLog
  3. 31 17
      lisp/org-beamer.el
  4. 5 1
      lisp/org-latex.el

+ 17 - 9
doc/org.texi

@@ -9587,13 +9587,13 @@ If you need references to a label created in this way, write
 @subsection Beamer class export
 @subsection Beamer class export
 
 
 The LaTeX class @file{beamer} allows to produce high quality presentations
 The LaTeX class @file{beamer} allows to produce high quality presentations
-using LaTeX can pdf processing.  Org-mode has special support for turning an
+using LaTeX and pdf processing.  Org-mode has special support for turning an
 Org-mode file or tree into a @file{beamer} presentation.
 Org-mode file or tree into a @file{beamer} presentation.
 
 
 When the LaTeX class for the current buffer (as set with @code{#+LaTeX_CLASS:
 When the LaTeX class for the current buffer (as set with @code{#+LaTeX_CLASS:
 beamer}) or subtree (set with a @code{LaTeX_CLASS} property) is
 beamer}) or subtree (set with a @code{LaTeX_CLASS} property) is
 @code{beamer}, a special export mode will turn the file or tree into a beamer
 @code{beamer}, a special export mode will turn the file or tree into a beamer
-presentation.  Any tree with not to deep level nesting should in principle be
+presentation.  Any tree with not-to-deep level nesting should in principle be
 exportable as a beamer presentation.  By default, the top-level entries (or
 exportable as a beamer presentation.  By default, the top-level entries (or
 the first level below the selected subtree heading) will be turned into
 the first level below the selected subtree heading) will be turned into
 frames, and the outline structure below this level will become itemize lists.
 frames, and the outline structure below this level will become itemize lists.
@@ -9627,11 +9627,10 @@ The width of a column that should start with this entry.  If this property is
 set, the entry will also get a @code{:BMCOL:} property to make this visible.
 set, the entry will also get a @code{:BMCOL:} property to make this visible.
 Also this tag is only a visual aid.  When his is a plain number, it will be
 Also this tag is only a visual aid.  When his is a plain number, it will be
 interpreted as a fraction of @code{\textwidth}.  Otherwise it will be assumed
 interpreted as a fraction of @code{\textwidth}.  Otherwise it will be assumed
-that you have specified the units, like @samp{3cm}.
-The first such property in a frame will start a @code{columns} environment to
-surround the columns.  This environment is closed when an entry has a
-@code{BEAMER_col} property with value 0, or automatically at the end of the
-frame.
+that you have specified the units, like @samp{3cm}.  The first such property
+in a frame will start a @code{columns} environment to surround the columns.
+This environment is closed when an entry has a @code{BEAMER_col} property
+with value 0 or 1, or automatically at the end of the frame.
 @item BEAMER_extra
 @item BEAMER_extra
 Additional commands that should be inserted after the environment has been
 Additional commands that should be inserted after the environment has been
 opened.  For example, when creating a frame, this can be used to specify
 opened.  For example, when creating a frame, this can be used to specify
@@ -9645,6 +9644,14 @@ specific code can be inserted using @code{#+BEAMER:} and
 backends, but with the difference that @code{#+LaTeX:} stuff will be included
 backends, but with the difference that @code{#+LaTeX:} stuff will be included
 in the presentation as well.
 in the presentation as well.
 
 
+Outline nodes with @code{BEAMER_env} property value @samp{note} or
+@samp{noteNH} will be formatted as beamer notes, i,e, they will be wrapped
+into @code{\note@{...@}}.  The former will include the heading as part of the
+note text, the latter will ignore the heading of that node.  To simplify note
+generation, it is actually enough to mark the note with a @emph{tag} (either
+@code{:B_note:} or @code{:B_noteNH:}) instead of creating the
+@code{BEAMER_env} property.
+
 You can turn on a special minor mode @code{org-beamer-mode} for editing
 You can turn on a special minor mode @code{org-beamer-mode} for editing
 support with
 support with
 
 
@@ -9664,7 +9671,7 @@ important parameters.  Make sure you are using a COLUMN format that is geared
 toward this special purpose.  The command @kbd{M-x
 toward this special purpose.  The command @kbd{M-x
 org-beamer-settings-template} does define such a format.
 org-beamer-settings-template} does define such a format.
 
 
-Here is a simple) example Org document that is intended for beamer export.
+Here is a simple example Org document that is intended for beamer export.
 
 
 @smallexample
 @smallexample
 #+LaTeX_CLASS: beamer
 #+LaTeX_CLASS: beamer
@@ -9692,8 +9699,9 @@ Here is a simple) example Org document that is intended for beamer export.
     :BEAMER_envargs: <2->
     :BEAMER_envargs: <2->
     :END:
     :END:
     for contributing to the discussion
     for contributing to the discussion
+**** This will be formatted as a beamer note                  :B_note:
 ** Frame 2 \\ where we will not use columns
 ** Frame 2 \\ where we will not use columns
-*** Request                                                         :B_block:
+*** Request                                                   :B_block:
     Please test this stuff!
     Please test this stuff!
 @end smallexample
 @end smallexample
 
 

+ 7 - 0
lisp/ChangeLog

@@ -1,5 +1,12 @@
 2010-01-05  Carsten Dominik  <carsten.dominik@gmail.com>
 2010-01-05  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
+	* org-beamer.el (org-beamer-environments-default): Add the note
+	environments.
+	(org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA
+	lines and collect and combine the content.
+	(org-beamer-after-initial-vars): Check for note tags and make sure
+	they will be seen like a property.
+
 	* org.el (org-offer-links-in-entry): Fix bug when there is a
 	* org.el (org-offer-links-in-entry): Fix bug when there is a
 	single link.
 	single link.
 
 

+ 31 - 17
lisp/org-beamer.el

@@ -93,14 +93,17 @@ These are just a completion help.")
     ("example"        "e" "\\begin{example}%a%U%x"             "\\end{example}")
     ("example"        "e" "\\begin{example}%a%U%x"             "\\end{example}")
     ("proof"          "p" "\\begin{proof}%a%U%x"               "\\end{proof}")
     ("proof"          "p" "\\begin{proof}%a%U%x"               "\\end{proof}")
     ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x"    "\\end{beamercolorbox}")
     ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x"    "\\end{beamercolorbox}")
-    ("normal"         "n" "%h" "")
+    ("normal"         "h" "%h" "") ; Emit the heading as normal text
+    ("note"           "n" "\\note%o%a{%h"                      "}")
+    ("noteNH"         "N" "\\note%o%a{"                        "}") ; note, ignore heading
     ("ignoreheading"  "i" "%%%% %h" ""))
     ("ignoreheading"  "i" "%%%% %h" ""))
   "Environments triggered by properties in Beamer export.
   "Environments triggered by properties in Beamer export.
 These are the defaults - for user definitions, see
 These are the defaults - for user definitions, see
 `org-beamer-environments-extra'.
 `org-beamer-environments-extra'.
-\"normal\" is a special fake environment.  It is needed when an environment
-should be surrounded by normal text.  Since beamer export converts sections
-into environments, you need to have a headline to end the environment.
+\"normal\" is a special fake environment, which emite the heading as
+normal text. It is needed when an environment should be surrounded
+by normal text.  Since beamer export converts nodes into environments,
+you need to have a node to end the environment.
 For example
 For example
 
 
    ** a frame
    ** a frame
@@ -266,6 +269,10 @@ in org-export-latex-classes."
       ;; A beamer environment selected by the BEAMER_env property
       ;; A beamer environment selected by the BEAMER_env property
       (if (string-match "[ \t]+:[ \t]*$" text)
       (if (string-match "[ \t]+:[ \t]*$" text)
 	  (setq text (replace-match "" t t text)))
 	  (setq text (replace-match "" t t text)))
+      (if (member env '("note" "noteNH"))
+	  ;; There should be no labels in a note, so we remove the targets
+	  ;; FIXME???
+	  (remove-text-properties 0 (length text) '(target nil) text))
       (org-beamer-get-special props)
       (org-beamer-get-special props)
       (setq text (org-trim text))
       (setq text (org-trim text))
       (setq have-text (string-match "\\S-" text))
       (setq have-text (string-match "\\S-" text))
@@ -350,7 +357,9 @@ The need to be after the begin statement of the environment."
       (goto-char (point-min))
       (goto-char (point-min))
       (while (re-search-forward
       (while (re-search-forward
 	      "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|desctiption\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t)
 	      "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|desctiption\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t)
-	(if (setq dovl (cdr (assoc "BEAMER_dovl" (get-text-property (match-end 0) 'org-props))))
+	(if (setq dovl (cdr (assoc "BEAMER_dovl"
+				   (get-text-property (match-end 0)
+						      'org-props))))
 	    (save-excursion
 	    (save-excursion
 	      (goto-char (1+ (match-end 1)))
 	      (goto-char (1+ (match-end 1)))
 	      (insert dovl)))))))
 	      (insert dovl)))))))
@@ -426,24 +435,29 @@ The effect is that these values will be accessible during export."
 	      (save-excursion
 	      (save-excursion
 		(save-restriction
 		(save-restriction
 		  (widen)
 		  (widen)
-		  (goto-char (point-min))
-		  (and (re-search-forward
-			"^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$" nil t)
-		       (match-string 1))))
+		  (let ((txt ""))
+		    (goto-char (point-min))
+		    (while (re-search-forward
+			    "^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$"
+			    nil t)
+		      (setq txt (concat txt "\n" (match-string 1))))
+		    (if (> (length txt) 0) (substring txt 1)))))
 	      (plist-get org-export-latex-options-plist
 	      (plist-get org-export-latex-options-plist
 			 :beamer-header-extra)))
 			 :beamer-header-extra)))
-    (let ((inhibit-read-only t))
+    (let ((inhibit-read-only t)
+	  (case-fold-search nil)
+	  props)
       (org-unmodified
       (org-unmodified
        (remove-text-properties (point-min) (point-max) '(org-props nil))
        (remove-text-properties (point-min) (point-max) '(org-props nil))
        (org-map-entries
        (org-map-entries
-	'(put-text-property (point-at-bol) (point-at-eol) 'org-props
-			    (org-entry-properties nil 'standard)))
+	'(progn
+	   (setq props (org-entry-properties nil 'standard))
+	   (if (and (not (assoc "BEAMER_env" props))
+		    (looking-at ".*?:B_\\(note\\(NH\\)?\\):"))
+	       (push (cons "BEAMER_env" (match-string 1)) props))
+	   (put-text-property (point-at-bol) (point-at-eol) 'org-props props)))
        (setq org-export-latex-options-plist
        (setq org-export-latex-options-plist
-	     (plist-put org-export-latex-options-plist :tags nil))
-       (remove-text-properties (point-min) (point-max) '(org-props nil))
-       (org-map-entries
-	'(put-text-property (point-at-bol) (point-at-eol) 'org-props
-			    (org-entry-properties nil 'standard)))))))
+	     (plist-put org-export-latex-options-plist :tags nil))))))
 
 
 (defun org-beamer-auto-fragile-frames ()
 (defun org-beamer-auto-fragile-frames ()
   "Mark any frames containing verbatim environments as fragile.
   "Mark any frames containing verbatim environments as fragile.

+ 5 - 1
lisp/org-latex.el

@@ -914,7 +914,11 @@ If NUM, export sections as numerical sections."
       (setq sectioning (funcall (car sectioning) level heading))
       (setq sectioning (funcall (car sectioning) level heading))
       (when sectioning
       (when sectioning
 	(setq heading (car sectioning)
 	(setq heading (car sectioning)
-	      sectioning (cdr sectioning)))
+	      sectioning (cdr sectioning)
+	      ;; target property migh have changed...
+	      label (org-get-text-property-any 0 'target heading)
+	      label-list (cons label (cdr (assoc label
+						 org-export-target-aliases)))))
       (if sectioning (setq sectioning (make-list 10 sectioning)))
       (if sectioning (setq sectioning (make-list 10 sectioning)))
       (setq depth (if sectioning 10000 0)))
       (setq depth (if sectioning 10000 0)))
     (if (string-match "[ \t]*\\\\\\\\[ \t]*" heading)
     (if (string-match "[ \t]*\\\\\\\\[ \t]*" heading)