1 ;;; org-beamer.el --- Beamer-specific LaTeX export for org-mode
3 ;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
5 ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
6 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
7 ;; Keywords: org, wp, tex
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; This library implement the special treatment needed by using the
27 ;; beamer class during LaTeX export.
34 (defvar org-export-latex-header
)
35 (defvar org-export-latex-options-plist
)
36 (defvar org-export-opt-plist
)
38 (defgroup org-beamer nil
39 "Options specific for using the beamer class in LaTeX export."
41 :group
'org-export-latex
)
43 (defcustom org-beamer-use-parts nil
48 (defcustom org-beamer-frame-level
1
49 "The level that should be interpreted as a frame.
50 The levels above this one will be translated into a sectioning structure.
51 Setting this to 2 will allow sections, 3 will allow subsections as well.
52 You can set this to 4 as well, if you at the same time set
53 `org-beamer-use-parts' to make the top levels `\part'."
56 (const :tag
"Frames need a BEAMER_env property" nil
)
57 (integer :tag
"Specific level makes a frame")))
59 (defcustom org-beamer-frame-default-options
""
60 "Default options string to use for frames, should contains the [brackets].
61 And example for this is \"[allowframebreaks]\"."
63 :type
'(string :tag
"[options]"))
65 (defcustom org-beamer-column-view-format
66 "%45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)"
67 "Default column view format that should be used to fill the template."
70 (const :tag
"Do not insert Beamer column view format" nil
)
71 (string :tag
"Beamer column view format")))
73 (defcustom org-beamer-themes
74 "\\usetheme{default}\\usecolortheme{default}"
75 "Default string to be used for extra heading stuff in beamer presentations.
76 When a beamer template is filled, this will be the default for
77 BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}."
80 (const :tag
"Do not insert Beamer themes" nil
)
81 (string :tag
"Beamer themes")))
83 (defconst org-beamer-column-widths
84 "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
85 "The column widths that should be installed as allowed property values.")
87 (defconst org-beamer-transitions
88 "\transblindsvertical \transblindshorizontal \transboxin \transboxout \transdissolve \transduration \transglitter \transsplithorizontalin \transsplithorizontalout \transsplitverticalin \transsplitverticalout \transwipe :ETC"
89 "Transitions available for beamer.
90 These are just a completion help.")
92 (defconst org-beamer-environments-default
93 '(("frame" "f" "dummy- special handling hard coded" "dummy")
94 ("columns" "C" "\\begin{columns}%o %% %h%x" "\\end{columns}")
95 ("column" "c" "\\begin{column}%o{%h\\textwidth}%x" "\\end{column}")
96 ("block" "b" "\\begin{block}%a{%h}%x" "\\end{block}")
97 ("alertblock" "a" "\\begin{alertblock}%a{%h}%x" "\\end{alertblock}")
98 ("verse" "v" "\\begin{verse}%a %% %h%x" "\\end{verse}")
99 ("quotation" "q" "\\begin{quotation}%a %% %h%x" "\\end{quotation}")
100 ("quote" "Q" "\\begin{quote}%a %% %h%x" "\\end{quote}")
101 ("structureenv" "s" "\\begin{structureenv}%a %% %h%x" "\\end{structureenv}")
102 ("theorem" "t" "\\begin{theorem}%a%U%x" "\\end{theorem}")
103 ("definition" "d" "\\begin{definition}%a%U%x" "\\end{definition}")
104 ("example" "e" "\\begin{example}%a%U%x" "\\end{example}")
105 ("exampleblock" "E" "\\begin{exampleblock}%a{%h}%x" "\\end{exampleblock}")
106 ("proof" "p" "\\begin{proof}%a%U%x" "\\end{proof}")
107 ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x" "\\end{beamercolorbox}")
108 ("normal" "h" "%h" "") ; Emit the heading as normal text
109 ("note" "n" "\\note%o%a{%h" "}")
110 ("noteNH" "N" "\\note%o%a{" "}") ; note, ignore heading
111 ("ignoreheading" "i" "%%%% %h" ""))
112 "Environments triggered by properties in Beamer export.
113 These are the defaults - for user definitions, see
114 `org-beamer-environments-extra'.
115 \"normal\" is a special fake environment, which emit the heading as
116 normal text. It is needed when an environment should be surrounded
117 by normal text. Since beamer export converts nodes into environments,
118 you need to have a node to end the environment.
123 *** Blocktitle :B_block:
125 *** After the block :B_normal:
129 (defcustom org-beamer-environments-extra nil
130 "Environments triggered by tags in Beamer export.
131 Each entry has 4 elements:
133 name Name of the environment
134 key Selection key for `org-beamer-select-environment'
135 open The opening template for the environment, with the following escapes
136 %a the action/overlay specification
137 %A the default action/overlay specification
138 %o the options argument of the template
140 %H if there is headline text, that text in {} braces
141 %U if there is headline text, that text in [] brackets
142 %x the content of the BEAMER_extra property
143 close The closing string of the environment."
148 (string :tag
"Environment")
149 (string :tag
"Selection key")
150 (string :tag
"Begin")
151 (string :tag
"End"))))
153 (defvar org-beamer-frame-level-now nil
)
154 (defvar org-beamer-header-extra nil
)
155 (defvar org-beamer-export-is-beamer-p nil
)
156 (defvar org-beamer-inside-frame-at-level nil
)
157 (defvar org-beamer-columns-open nil
)
158 (defvar org-beamer-column-open nil
)
160 (defun org-beamer-cleanup-column-width (width)
161 "Make sure the width is not empty, and that it has a unit."
162 (setq width
(org-trim (or width
"")))
163 (unless (string-match "\\S-" width
) (setq width
"0.5"))
164 (if (string-match "\\`[.0-9]+\\'" width
)
165 (setq width
(concat width
"\\textwidth")))
168 (defun org-beamer-open-column (&optional width opt
)
169 (org-beamer-close-column-maybe)
170 (setq org-beamer-column-open t
)
171 (setq width
(org-beamer-cleanup-column-width width
))
172 (insert (format "\\begin{column}%s{%s}\n" (or opt
"") width
)))
173 (defun org-beamer-close-column-maybe ()
174 (when org-beamer-column-open
175 (setq org-beamer-column-open nil
)
176 (insert "\\end{column}\n")))
177 (defun org-beamer-open-columns-maybe (&optional opts
)
178 (unless org-beamer-columns-open
179 (setq org-beamer-columns-open t
)
180 (insert (format "\\begin{columns}%s\n" (or opts
"")))))
181 (defun org-beamer-close-columns-maybe ()
182 (org-beamer-close-column-maybe)
183 (when org-beamer-columns-open
184 (setq org-beamer-columns-open nil
)
185 (insert "\\end{columns}\n")))
187 (defun org-beamer-select-environment ()
188 "Select the environment to be used by beamer for this entry.
189 While this uses (for convenience) a tag selection interface, the result
190 of this command will be that the BEAMER_env *property* of the entry is set.
192 In addition to this, the command will also set a tag as a visual aid, but
193 the tag does not have any semantic meaning."
195 (let* ((envs (append org-beamer-environments-extra
196 org-beamer-environments-default
))
198 (append '((:startgroup
))
199 (mapcar (lambda (e) (cons (concat "B_" (car e
))
200 (string-to-char (nth 1 e
))))
204 (org-fast-tag-selection-single-key t
))
206 (let ((tags (or (ignore-errors (org-get-tags-string)) "")))
208 ((equal org-last-tag-selection-key ?|
)
209 (if (string-match ":BMCOL:" tags
)
210 (org-set-property "BEAMER_col" (read-string "Column width: "))
211 (org-delete-property "BEAMER_col")))
212 ((string-match (concat ":B_\\("
213 (mapconcat 'car envs
"\\|")
216 (org-entry-put nil
"BEAMER_env" (match-string 1 tags
)))
217 (t (org-entry-delete nil
"BEAMER_env"))))))
220 (defun org-beamer-sectioning (level text
)
221 "Return the sectioning entry for the current headline.
222 LEVEL is the reduced level of the headline.
223 TEXT is the text of the headline, everything except the leading stars.
224 The return value is a cons cell. The car is the headline text, usually
225 just TEXT, but possibly modified if options have been extracted from the
226 text. The cdr is the sectioning entry, similar to what is given
227 in org-export-latex-classes."
228 (let* ((frame-level (or org-beamer-frame-level-now org-beamer-frame-level
))
230 (if org-beamer-use-parts
231 '((1 .
("\\part{%s}" .
"\\part*{%s}"))
232 (2 .
("\\section{%s}" .
"\\section*{%s}"))
233 (3 .
("\\subsection{%s}" .
"\\subsection*{%s}")))
234 '((1 .
("\\section{%s}" .
"\\section*{%s}"))
235 (2 .
("\\subsection{%s}" .
"\\subsection*{%s}")))))
236 (envs (append org-beamer-environments-extra
237 org-beamer-environments-default
))
238 (props (org-get-text-property-any 0 'org-props text
))
239 (in "") (out "") option action defaction environment extra
240 columns-option column-option
241 env have-text ass tmp
)
242 (if (= frame-level
0) (setq frame-level nil
))
243 (when (and org-beamer-inside-frame-at-level
244 (<= level org-beamer-inside-frame-at-level
))
245 (setq org-beamer-inside-frame-at-level nil
))
246 (when (setq tmp
(org-beamer-assoc-not-empty "BEAMER_col" props
))
247 (if (and (string-match "\\`[0-9.]+\\'" tmp
)
248 (or (= (string-to-number tmp
) 1.0)
249 (= (string-to-number tmp
) 0.0)))
250 ;; column width 1 means close columns, go back to full width
251 (org-beamer-close-columns-maybe)
252 (when (setq ass
(assoc "BEAMER_envargs" props
))
253 (let (case-fold-search)
254 (while (string-match "C\\(\\[[^][]*\\]\\|<[^<>]*>\\)" (cdr ass
))
255 (setq columns-option
(match-string 1 (cdr ass
)))
256 (setcdr ass
(replace-match "" t t
(cdr ass
))))
257 (while (string-match "c\\(\\[[^][]*\\]\\|<[^<>]*>\\)" (cdr ass
))
258 (setq column-option
(match-string 1 (cdr ass
)))
259 (setcdr ass
(replace-match "" t t
(cdr ass
))))))
260 (org-beamer-open-columns-maybe columns-option
)
261 (org-beamer-open-column tmp column-option
)))
263 ((or (equal (cdr (assoc "BEAMER_env" props
)) "frame")
264 (and frame-level
(= level frame-level
)))
266 (org-beamer-get-special props
)
268 (setq in
(org-fill-template
269 "\\begin{frame}%a%A%o%T%S%x"
270 (list (cons "a" (or action
""))
271 (cons "A" (or defaction
""))
272 (cons "o" (or option org-beamer-frame-default-options
""))
273 (cons "x" (if extra
(concat "\n" extra
) ""))
275 (cons "T" (if (string-match "\\S-" text
)
276 "\n\\frametitle{%s}" ""))
277 (cons "S" (if (string-match "\\\\\\\\" text
)
278 "\n\\framesubtitle{%s}" ""))))
279 out
(copy-sequence "\\end{frame}"))
281 '(org-insert-hook org-beamer-close-columns-maybe
))
282 (setq org-beamer-inside-frame-at-level level
)
283 (cons text
(list in out in out
)))
284 ((and (setq env
(cdr (assoc "BEAMER_env" props
)))
285 (setq ass
(assoc env envs
)))
286 ;; A beamer environment selected by the BEAMER_env property
287 (if (string-match "[ \t]+:[ \t]*$" text
)
288 (setq text
(replace-match "" t t text
)))
289 (if (member env
'("note" "noteNH"))
290 ;; There should be no labels in a note, so we remove the targets
292 (remove-text-properties 0 (length text
) '(target nil
) text
))
293 (org-beamer-get-special props
)
294 (setq text
(org-trim text
))
295 (setq have-text
(string-match "\\S-" text
))
296 (setq in
(org-fill-template
298 (list (cons "a" (or action
""))
299 (cons "A" (or defaction
""))
300 (cons "o" (or option
""))
301 (cons "x" (if extra
(concat "\n" extra
) ""))
303 (cons "H" (if have-text
(concat "{" text
"}") ""))
304 (cons "U" (if have-text
(concat "[" text
"]") ""))))
307 ((equal out
"\\end{columns}")
308 (setq org-beamer-columns-open t
)
309 (setq out
(org-add-props (copy-sequence out
)
312 (org-beamer-close-column-maybe)
313 (setq org-beamer-columns-open nil
))))))
314 ((equal out
"\\end{column}")
315 (org-beamer-open-columns-maybe)))
316 (cons text
(list in out in out
)))
317 ((and (not org-beamer-inside-frame-at-level
)
318 (or (not frame-level
)
319 (< level frame-level
))
320 (assoc level default
))
322 (cons text
(cdr (assoc level default
))))
330 (defun org-beamer-get-special (props)
331 "Extract an option, action, and default action string from text.
332 The variables option, action, defaction, extra are all scoped into
333 this function dynamically."
335 (setq environment
(org-beamer-assoc-not-empty "BEAMER_env" props
))
336 (setq extra
(org-beamer-assoc-not-empty "BEAMER_extra" props
))
338 (setq extra
(replace-regexp-in-string "\\\\n" "\n" extra
)))
339 (setq tmp
(org-beamer-assoc-not-empty "BEAMER_envargs" props
))
341 (setq tmp
(copy-sequence tmp
))
342 (if (string-match "\\[<[^][<>]*>\\]" tmp
)
343 (setq defaction
(match-string 0 tmp
)
344 tmp
(replace-match "" t t tmp
)))
345 (if (string-match "\\[[^][]*\\]" tmp
)
346 (setq option
(match-string 0 tmp
)
347 tmp
(replace-match "" t t tmp
)))
348 (if (string-match "<[^<>]*>" tmp
)
349 (setq action
(match-string 0 tmp
)
350 tmp
(replace-match "" t t tmp
))))))
352 (defun org-beamer-assoc-not-empty (elt list
)
353 (let ((tmp (cdr (assoc elt list
))))
354 (and tmp
(string-match "\\S-" tmp
) tmp
)))
357 (defvar org-beamer-mode-map
(make-sparse-keymap)
358 "The keymap for `org-beamer-mode'.")
359 (define-key org-beamer-mode-map
"\C-c\C-b" 'org-beamer-select-environment
)
361 (define-minor-mode org-beamer-mode
362 "Special support for editing Org-mode files made to export to beamer."
364 (when (fboundp 'font-lock-add-keywords
)
365 (font-lock-add-keywords
367 '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend
))
370 (defun org-beamer-place-default-actions-for-lists ()
371 "Find default overlay specifications in items, and move them.
372 The need to be after the begin statement of the environment."
373 (when org-beamer-export-is-beamer-p
375 (goto-char (point-min))
376 (while (re-search-forward
377 "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|description\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t
)
378 (if (setq dovl
(cdr (assoc "BEAMER_dovl"
379 (get-text-property (match-end 0)
382 (goto-char (1+ (match-end 1)))
385 (defun org-beamer-amend-header ()
386 "Add `org-beamer-header-extra' to the LaTeX header.
387 If the file contains the string BEAMER-HEADER-EXTRA-HERE on a line
388 by itself, it will be replaced with `org-beamer-header-extra'. If not,
389 the value will be inserted right after the documentclass statement."
390 (when (and org-beamer-export-is-beamer-p
391 org-beamer-header-extra
)
392 (goto-char (point-min))
395 "^[ \t]*\\[?BEAMER-HEADER-EXTRA\\(-HERE\\)?\\]?[ \t]*$" nil t
)
396 (replace-match org-beamer-header-extra t t
)
397 (or (bolp) (insert "\n")))
398 ((re-search-forward "^[ \t]*\\\\begin{document}" nil t
)
399 (beginning-of-line 1)
400 (insert org-beamer-header-extra
)
401 (or (bolp) (insert "\n"))))))
403 (defcustom org-beamer-fragile-re
"\\\\\\(verb\\|lstinline\\)\\|^[ \t]*\\\\begin{\\(verbatim\\|lstlisting\\|minted\\)}"
404 "If this regexp matches in a frame, the frame is marked as fragile."
408 (defface org-beamer-tag
'((t (:box
(:line-width
1 :color grey40
))))
409 "The special face for beamer tags."
413 ;; Functions to initialize and post-process
414 ;; These functions will be hooked into various places in the export process
416 (defun org-beamer-initialize-open-trackers ()
417 "Reset variables that track if certain environments are open during export."
418 (setq org-beamer-columns-open nil
)
419 (setq org-beamer-column-open nil
)
420 (setq org-beamer-inside-frame-at-level nil
)
421 (setq org-beamer-export-is-beamer-p nil
))
423 (defun org-beamer-after-initial-vars ()
424 "Find special settings for beamer and store them.
425 The effect is that these values will be accessible during export."
426 ;; First verify that we are exporting using the beamer class
427 (setq org-beamer-export-is-beamer-p
428 (string-match "\\\\documentclass\\(\\[[^][]*?\\]\\)?{beamer}"
429 org-export-latex-header
))
430 (when org-beamer-export-is-beamer-p
431 ;; Find the frame level
432 (setq org-beamer-frame-level-now
433 (or (and (org-region-active-p)
435 (goto-char (region-beginning))
436 (and (looking-at org-complex-heading-regexp
)
437 (org-entry-get nil
"BEAMER_FRAME_LEVEL" 'selective
))))
441 (goto-char (point-min))
442 (and (re-search-forward
443 "^#\\+BEAMER_FRAME_LEVEL:[ \t]*\\(.*?\\)[ \t]*$" nil t
)
445 (plist-get org-export-latex-options-plist
:beamer-frame-level
)
446 org-beamer-frame-level
))
447 ;; Normalize the value so that the functions can trust the value
449 ((not org-beamer-frame-level-now
)
450 (setq org-beamer-frame-level-now nil
))
451 ((stringp org-beamer-frame-level-now
)
452 (setq org-beamer-frame-level-now
453 (string-to-number org-beamer-frame-level-now
))))
454 ;; Find the header additions, most likely theme commands
455 (setq org-beamer-header-extra
456 (or (and (org-region-active-p)
458 (goto-char (region-beginning))
459 (and (looking-at org-complex-heading-regexp
)
460 (org-entry-get nil
"BEAMER_HEADER_EXTRA"
466 (goto-char (point-min))
467 (while (re-search-forward
468 "^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$"
470 (setq txt
(concat txt
"\n" (match-string 1))))
471 (if (> (length txt
) 0) (substring txt
1)))))
472 (plist-get org-export-latex-options-plist
473 :beamer-header-extra
)))
474 (let ((inhibit-read-only t
)
475 (case-fold-search nil
)
478 (remove-text-properties (point-min) (point-max) '(org-props nil
))
481 (setq props
(org-entry-properties nil
'standard
))
482 (if (and (not (assoc "BEAMER_env" props
))
483 (looking-at ".*?:B_\\(note\\(NH\\)?\\):"))
484 (push (cons "BEAMER_env" (match-string 1)) props
))
485 (put-text-property (point-at-bol) (point-at-eol) 'org-props props
)))
486 (setq org-export-latex-options-plist
487 (plist-put org-export-latex-options-plist
:tags nil
))))))
489 (defun org-beamer-auto-fragile-frames ()
490 "Mark any frames containing verbatim environments as fragile.
491 This function will run in the final LaTeX document."
492 (when org-beamer-export-is-beamer-p
494 (goto-char (point-min))
495 ;; Find something that might be fragile
496 (while (re-search-forward org-beamer-fragile-re nil t
)
498 ;; Are we inside a frame here?
499 (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}"
501 (equal (match-string 1) "begin"))
502 ;; yes, inside a frame, make sure "fragile" is one of the options
503 (goto-char (match-end 0))
504 (if (not (looking-at "\\[.*?\\]"))
506 (setq opts
(substring (match-string 0) 1 -
1))
507 (delete-region (match-beginning 0) (match-end 0))
508 (setq opts
(org-split-string opts
","))
509 (add-to-list 'opts
"fragile")
510 (insert "[" (mapconcat 'identity opts
",") "]"))))))))
512 (defcustom org-beamer-outline-frame-title
"Outline"
513 "Default title of a frame containing an outline."
515 :type
'(string :tag
"Outline frame title")
518 (defcustom org-beamer-outline-frame-options nil
519 "Outline frame options appended after \\begin{frame}.
520 You might want to put e.g. [allowframebreaks=0.9] here. Remember to
521 include square brackets."
523 :type
'(string :tag
"Outline frame options")
526 (defun org-beamer-fix-toc ()
527 "Fix the table of contents by removing the vspace line."
528 (when org-beamer-export-is-beamer-p
530 (goto-char (point-min))
531 (when (re-search-forward "\\(\\\\setcounter{tocdepth.*\n\\\\tableofcontents.*\n\\)\\(\\\\vspace\\*.*\\)"
534 (concat "\\\\begin{frame}" org-beamer-outline-frame-options
536 org-beamer-outline-frame-title
537 "}\n\\1\\\\end{frame}")
540 (defun org-beamer-property-changed (property value
)
541 "Track the BEAMER_env property with tags."
543 ((equal property
"BEAMER_env")
545 (org-back-to-heading t
)
546 (let ((tags (org-get-tags)))
547 (setq tags
(delq nil
(mapcar (lambda (x)
548 (if (string-match "^B_" x
) nil x
))
550 (org-set-tags-to tags
))
551 (when (and value
(stringp value
) (string-match "\\S-" value
))
552 (org-toggle-tag (concat "B_" value
) 'on
))))
553 ((equal property
"BEAMER_col")
554 (org-toggle-tag "BMCOL" (if (and value
(string-match "\\S-" value
))
557 (defun org-beamer-select-beamer-code ()
558 "Take code marked for BEAMER and turn it into marked for LaTeX."
559 (when org-beamer-export-is-beamer-p
560 (goto-char (point-min))
561 (while (re-search-forward
562 "^\\([ \]*#\\+\\(begin_\\|end_\\)?\\)\\(beamer\\)\\>" nil t
)
563 (replace-match "\\1latex"))))
565 ;; OK, hook all these functions into appropriate places
566 (add-hook 'org-export-first-hook
567 'org-beamer-initialize-open-trackers
)
568 (add-hook 'org-property-changed-functions
569 'org-beamer-property-changed
)
570 (add-hook 'org-export-latex-after-initial-vars-hook
571 'org-beamer-after-initial-vars
)
572 (add-hook 'org-export-latex-final-hook
573 'org-beamer-place-default-actions-for-lists
)
574 (add-hook 'org-export-latex-final-hook
575 'org-beamer-auto-fragile-frames
)
576 (add-hook 'org-export-latex-final-hook
578 (add-hook 'org-export-latex-final-hook
579 'org-beamer-amend-header
)
580 (add-hook 'org-export-preprocess-before-selecting-backend-code-hook
581 'org-beamer-select-beamer-code
)
583 (defun org-insert-beamer-options-template (kind)
584 "Insert a settings template, to make sure users do this right."
586 (message "Current [s]ubtree or [g]lobal?")
587 (if (equal (read-char-exclusive) ?g
)
590 (if (eq kind
'subtree
)
592 (org-back-to-heading t
)
594 (org-entry-put nil
"LaTeX_CLASS" "beamer")
595 (org-entry-put nil
"LaTeX_CLASS_OPTIONS" "[presentation]")
596 (org-entry-put nil
"EXPORT_FILE_NAME" "presentation.pdf")
597 (org-entry-put nil
"BEAMER_FRAME_LEVEL" (number-to-string
598 org-beamer-frame-level
))
599 (when org-beamer-themes
600 (org-entry-put nil
"BEAMER_HEADER_EXTRA" org-beamer-themes
))
601 (when org-beamer-column-view-format
602 (org-entry-put nil
"COLUMNS" org-beamer-column-view-format
))
603 (org-entry-put nil
"BEAMER_col_ALL" "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC"))
604 (insert "#+LaTeX_CLASS: beamer\n")
605 (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n")
606 (insert (format "#+BEAMER_FRAME_LEVEL: %d\n" org-beamer-frame-level
) "\n")
607 (when org-beamer-themes
608 (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes
"\n"))
609 (when org-beamer-column-view-format
610 (insert "#+COLUMNS: " org-beamer-column-view-format
"\n"))
611 (insert "#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC\n")))
614 (defun org-beamer-allowed-property-values (property)
615 "Supply allowed values for BEAMER properties."
617 ((and (equal property
"BEAMER_env")
618 (not (org-entry-get nil
(concat property
"_ALL") 'inherit
)))
619 ;; If no allowed values for BEAMER_env have been defined,
620 ;; supply all defined environments
621 (mapcar 'car
(append org-beamer-environments-extra
622 org-beamer-environments-default
)))
623 ((and (equal property
"BEAMER_col")
624 (not (org-entry-get nil
(concat property
"_ALL") 'inherit
)))
625 ;; If no allowed values for BEAMER_col have been defined,
627 '("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "" ":ETC"))
630 (add-hook 'org-property-allowed-value-functions
631 'org-beamer-allowed-property-values
)
633 (provide 'org-beamer
)
635 ;;; org-beamer.el ends here