From 76b8cab6515a25639cb68ffa4fd03fdda842b8fb Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 5 Jan 2010 14:53:14 +0100 Subject: [PATCH] Add support for BEAMER notes. --- doc/org.texi | 26 +++++++++++++++++--------- lisp/ChangeLog | 7 +++++++ lisp/org-beamer.el | 48 +++++++++++++++++++++++++++++++----------------- lisp/org-latex.el | 6 +++++- 4 files changed, 60 insertions(+), 27 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 5aed68180..1bcfaa0ab 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -9587,13 +9587,13 @@ If you need references to a label created in this way, write @subsection Beamer class export 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. 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 @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 the first level below the selected subtree heading) will be turned into 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. 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 -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 Additional commands that should be inserted after the environment has been 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 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 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 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 #+LaTeX_CLASS: beamer @@ -9692,8 +9699,9 @@ Here is a simple) example Org document that is intended for beamer export. :BEAMER_envargs: <2-> :END: for contributing to the discussion +**** This will be formatted as a beamer note :B_note: ** Frame 2 \\ where we will not use columns -*** Request :B_block: +*** Request :B_block: Please test this stuff! @end smallexample diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 13570ea8f..a1cf85d03 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2010-01-05 Carsten Dominik + * 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 single link. diff --git a/lisp/org-beamer.el b/lisp/org-beamer.el index f879518d4..eb08ca403 100644 --- a/lisp/org-beamer.el +++ b/lisp/org-beamer.el @@ -93,14 +93,17 @@ These are just a completion help.") ("example" "e" "\\begin{example}%a%U%x" "\\end{example}") ("proof" "p" "\\begin{proof}%a%U%x" "\\end{proof}") ("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" "")) "Environments triggered by properties in Beamer export. These are the defaults - for user definitions, see `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 ** a frame @@ -266,6 +269,10 @@ in org-export-latex-classes." ;; A beamer environment selected by the BEAMER_env property (if (string-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) (setq text (org-trim 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)) (while (re-search-forward "^[ \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 (goto-char (1+ (match-end 1))) (insert dovl))))))) @@ -426,24 +435,29 @@ The effect is that these values will be accessible during export." (save-excursion (save-restriction (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 :beamer-header-extra))) - (let ((inhibit-read-only t)) + (let ((inhibit-read-only t) + (case-fold-search nil) + props) (org-unmodified (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))) + '(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 - (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 () "Mark any frames containing verbatim environments as fragile. diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 26a38de3d..0e8342219 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -914,7 +914,11 @@ If NUM, export sections as numerical sections." (setq sectioning (funcall (car sectioning) level heading)) (when 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))) (setq depth (if sectioning 10000 0))) (if (string-match "[ \t]*\\\\\\\\[ \t]*" heading) -- 2.11.4.GIT