Allow to export to LaTeX while in column view
[org-mode.git] / lisp / org-beamer.el
blobe3cfda9ed978a3d012d95c8573ce5f970daad329
1 ;;; org-beamer.el --- Beamer-specific LaTeX export for org-mode
2 ;;
3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
4 ;;
5 ;; Version: 6.33trans
6 ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
7 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
8 ;; Keywords: org, wp, tex
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
27 ;; This library implement the special treatment needed by using the
28 ;; beamer class during LaTeX export.
30 (require 'org)
31 (require 'org-exp)
32 (defvar org-export-latex-header)
33 (defvar org-export-latex-options-plist)
34 (defvar org-export-opt-plist)
36 (defgroup org-beamer nil
37 "Options specific for using the beamer class in LaTeX export."
38 :tag "Org Beamer"
39 :group 'org-export-latex)
41 (defcustom org-beamer-use-parts nil
43 :group 'org-beamer
44 :type 'boolean)
46 (defcustom org-beamer-frame-level 1
47 "The level that should be interpreted as a frame.
48 The levels above this one will be translated into a sectioning structure.
49 Setting this to 2 will allow sections, 3 will allow subsections as well.
50 You can se this to 4 as well, if you at the same time set
51 `org-beamer-use-parts' to make the top levels `\part'."
52 :group 'org-beamer
53 :type '(choice
54 (const :tag "Frames need a BEAMER_env property" nil)
55 (integer :tag "Specific level makes a frame")))
57 (defcustom org-beamer-column-view-format
58 "%45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)"
59 "Default column view format that should be used to fill the template."
60 :group 'org-beamer
61 :type '(string :tag "Beamer column view format"))
63 (defcustom org-beamer-themes
64 "\\usetheme{default}\\usecolortheme{default}"
65 "Default string to be used for extra heading stuff in beamer presentations.
66 When a beamer template is filled, this will be the default for
67 BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}."
68 :group 'org-beamer
69 :type '(string :tag "Beamer column view format"))
72 (defconst org-beamer-column-widths
73 "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC"
74 "The column widths that should be installed as allowed property values.")
76 (defconst org-beamer-transitions
77 "\transblindsvertical \transblindshorizontal \transboxin \transboxout \transdissolve \transduration \transglitter \transsplithorizontalin \transsplithorizontalout \transsplitverticalin \transsplitverticalout \transwipe :ETC"
78 "Transitions available for beamer.
79 These are just a completion help.")
81 (defconst org-beamer-environments-default
82 '(("frame" "f" "dummy- special handling hard coded" "dummy")
83 ("columns" "C" "\\begin{columns}%o %% %h%x" "\\end{columns}")
84 ("column" "c" "\\begin{column}%o{%h\\textwidth}%x" "\\end{column}")
85 ("block" "b" "\\begin{block}%a{%h}%x" "\\end{block}")
86 ("alertblock" "a" "\\begin{alertblock}%a{%h}%x" "\\end{alertblock}")
87 ("verse" "v" "\\begin{verse}%a %% %h%x" "\\end{verse}")
88 ("quotation" "q" "\\begin{quotation}%a %% %h%x" "\\end{quotation}")
89 ("quote" "Q" "\\begin{quote}%a %% %h%x" "\\end{quote}")
90 ("structureenv" "s" "\\begin{structureenv}%a %% %h%x" "\\end{structureenv}")
91 ("theorem" "t" "\\begin{theorem}%a%U%x" "\\end{theorem}")
92 ("definition" "d" "\\begin{definition}%a%U%x" "\\end{definition}")
93 ("example" "e" "\\begin{example}%a%U%x" "\\end{example}")
94 ("proof" "p" "\\begin{proof}%a%U%x" "\\end{proof}")
95 ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x" "\\end{beamercolorbox}")
96 ("normal" "n" "%h" "")
97 ("ignoreheading" "i" "%%%% %h" ""))
98 "Environments triggered by properties in Beamer export.
99 These are the defaults - for user definitions, see
100 `org-beamer-environments-extra'.
101 \"normal\" is a special fake environment. It is needed when an environment
102 should be surrounded by normal text. Since beamer export converts sections
103 into environments, you need to have a headline to end the environment.
104 For example
106 ** a frame
107 some text
108 *** Blocktitle :B_block:
109 inside the block
110 *** After the block :B_normal:
111 continuing here
112 ** next frame")
114 (defcustom org-beamer-environments-extra nil
115 "Environments triggered by tags in Beamer export.
116 Each entry has 4 elements:
118 name Name of the environment
119 key Selection key for `org-beamer-set-environment-tag'
120 open The opening template for the environment, with the following excapes
121 %a the action/overlay specification
122 %A the default action/overlay specification
123 %o the options argument of the template
124 %h the headline text
125 %H if there is headline text, that text in {} braces
126 %U if there is headline text, that text in [] brackets
127 close The closing string of the environment."
129 :group 'org-beamer
130 :type '(repeat
131 (list
132 (string :tag "Environment")
133 (string :tag "Selection key")
134 (string :tag "Begin")
135 (string :tag "End"))))
137 (defvar org-beamer-frame-level-now nil)
138 (defvar org-beamer-header-extra nil)
139 (defvar org-beamer-export-is-beamer-p nil)
140 (defvar org-beamer-inside-frame-at-level nil)
141 (defvar org-beamer-columns-open nil)
142 (defvar org-beamer-column-open nil)
144 (defun org-beamer-cleanup-column-width (width)
145 "Make sure the width is not empty, and that it has a unit."
146 (setq width (org-trim (or width "")))
147 (unless (string-match "\\S-" width) (setq width "0.5"))
148 (if (string-match "\\`[.0-9]+\\'" width)
149 (setq width (concat width "\\textwidth")))
150 width)
152 (defun org-beamer-open-column (&optional width opt)
153 (org-beamer-close-column-maybe)
154 (setq org-beamer-column-open t)
155 (setq width (org-beamer-cleanup-column-width width))
156 (insert (format "\\begin{column}%s{%s}\n" (or opt "") width)))
157 (defun org-beamer-close-column-maybe ()
158 (when org-beamer-column-open
159 (setq org-beamer-column-open nil)
160 (insert "\\end{column}\n")))
161 (defun org-beamer-close-column-maybe-1 ()
162 (when org-beamer-column-open
163 (setq org-beamer-column-open nil)
164 (insert "\\end{column}\n"))
165 (setq org-beamer-columns-open nil))
166 (defun org-beamer-open-columns-maybe (&optional opts)
167 (unless org-beamer-columns-open
168 (setq org-beamer-columns-open t)
169 (insert (format "\\begin{columns}%s\n" (or opts "")))))
170 (defun org-beamer-close-columns-maybe ()
171 (org-beamer-close-column-maybe)
172 (when org-beamer-columns-open
173 (setq org-beamer-columns-open nil)
174 (insert "\\end{columns}\n")))
176 (defun org-beamer-set-environment-tag ()
177 "Set an environment tag, to determine the beamer environment to be used.
178 This makes use of the fast tag selection interface."
179 (interactive)
180 (let* ((envs (append org-beamer-environments-extra
181 org-beamer-environments-default))
182 (org-tag-alist
183 (append '((:startgroup))
184 (mapcar (lambda (e) (cons (concat "B_" (car e))
185 (string-to-char (nth 1 e))))
186 envs)
187 '((:endgroup))
188 '(("BMCOL" . ?|))))
189 (org-fast-tag-selection-single-key t))
190 (org-set-tags)
191 (let ((tags (or (ignore-errors (org-get-tags-string)) "")))
192 (cond
193 ((equal org-last-tag-selection-key ?|)
194 (if (string-match ":BMCOL:" tags)
195 (org-set-property "BEAMER_col" (read-string "Column width: "))
196 (org-delete-property "BEAMER_col")))
197 ((string-match (concat ":B_\\("
198 (mapconcat 'car envs "\\|")
199 "\\):")
200 tags)
201 (org-entry-put nil "BEAMER_env" (match-string 1 tags)))
202 (t (org-entry-delete nil "BEAMER_env"))))))
205 (defun org-beamer-sectioning (level text)
206 "Return the sectioning entry for the current headline.
207 LEVEL is the reduced level of the headline.
208 TEXT is the text of the headline, everything except the leading stars.
209 The return value is a cons cell. The car is the headline text, usually
210 just TEXT, but possibly modified if options have been extracted from the
211 text. The cdr is the sectioning entry, similar to what is given
212 in org-export-latex-classes."
213 (let* ((frame-level (or org-beamer-frame-level-now org-beamer-frame-level))
214 (default
215 (if org-beamer-use-parts
216 '((1 . ("\\part{%s}" . "\\part*{%s}"))
217 (2 . ("\\section{%s}" . "\\section*{%s}"))
218 (3 . ("\\subsection{%s}" . "\\subsection*{%s}")))
219 '((1 . ("\\section{%s}" . "\\section*{%s}"))
220 (2 . ("\\subsection{%s}" . "\\subsection*{%s}")))))
221 (envs (append org-beamer-environments-extra
222 org-beamer-environments-default))
223 (props (org-get-text-property-any 0 'org-props text))
224 (in "") (out "") option action defaction environment extra
225 columns-option column-option
226 env have-text ass tmp)
227 (if (= frame-level 0) (setq frame-level nil))
228 (when (and org-beamer-inside-frame-at-level
229 (<= level org-beamer-inside-frame-at-level))
230 (setq org-beamer-inside-frame-at-level nil))
231 (when (setq tmp (org-beamer-assoc-not-empty "BEAMER_col" props))
232 (when (setq ass (assoc "BEAMER_envargs" props))
233 (let (case-fold-search)
234 (when (string-match "C\\(\\[[^][]*\\]\\)" (cdr ass))
235 (setq columns-option (match-string 1 (cdr ass)))
236 (setcdr ass (replace-match "" t t (cdr ass))))
237 (when (string-match "c\\(\\[[^][]*\\]\\)" (cdr ass))
238 (setq column-option (match-string 1 (cdr ass)))
239 (setcdr ass (replace-match "" t t (cdr ass))))))
240 (org-beamer-open-columns-maybe columns-option)
241 (org-beamer-open-column tmp column-option))
242 (cond
243 ((or (equal (cdr (assoc "BEAMER_env" props)) "frame")
244 (and frame-level (= level frame-level)))
245 ;; A frame
246 (org-beamer-get-special props)
248 (setq in (org-fill-template
249 "\\begin{frame}%a%A%o%T%S%x"
250 (list (cons "a" (or action ""))
251 (cons "A" (or defaction ""))
252 (cons "o" (or option ""))
253 (cons "x" (if extra (concat "\n" extra) ""))
254 (cons "h" "%s")
255 (cons "T" (if (string-match "\\S-" text)
256 "\n\\frametitle{%s}" ""))
257 (cons "S" (if (string-match "\\\\\\\\" text)
258 "\n\\framesubtitle{%s}" ""))))
259 out (copy-sequence "\\end{frame}"))
260 (org-add-props out
261 '(org-insert-hook org-beamer-close-columns-maybe))
262 (setq org-beamer-inside-frame-at-level level)
263 (cons text (list in out in out)))
264 ((and (setq env (cdr (assoc "BEAMER_env" props)))
265 (setq ass (assoc env envs)))
266 ;; A beamer environment selected by the BEAMER_env property
267 (if (string-match "[ \t]+:[ \t]*$" text)
268 (setq text (replace-match "" t t text)))
269 (org-beamer-get-special props)
270 (setq text (org-trim text))
271 (setq have-text (string-match "\\S-" text))
272 (setq in (org-fill-template
273 (nth 2 ass)
274 (list (cons "a" (or action ""))
275 (cons "A" (or defaction ""))
276 (cons "o" (or option ""))
277 (cons "x" (if extra (concat "\n" extra) ""))
278 (cons "h" "%s")
279 (cons "H" (if have-text (concat "{" text "}") ""))
280 (cons "U" (if have-text (concat "[" text "]") ""))))
281 out (nth 3 ass))
282 (cond
283 ((equal out "\\end{columns}")
284 (setq org-beamer-columns-open t)
285 (setq out (org-add-props (copy-sequence out)
286 '(org-insert-hook
287 (lambda ()
288 (org-beamer-close-column-maybe)
289 (setq org-beamer-columns-open nil))))))
290 ((equal out "\\end{column}")
291 (org-beamer-open-columns-maybe)))
292 (cons text (list in out in out)))
293 ((and (not org-beamer-inside-frame-at-level)
294 (or (not frame-level)
295 (< level frame-level))
296 (assoc level default))
297 ;; Normal sectioning
298 (cons text (cdr (assoc level default))))
299 (t nil))))
301 (defvar extra)
302 (defvar option)
303 (defvar action)
304 (defvar defaction)
305 (defvar environment)
306 (defun org-beamer-get-special (props)
307 "Extract an option, action, and default action string from text.
308 The variables option, action, defaction, extra are all scoped into
309 this function dynamically."
310 (let (tmp)
311 (setq environment (org-beamer-assoc-not-empty "BEAMER_env" props))
312 (setq extra (org-beamer-assoc-not-empty "BEAMER_extra" props))
313 (when extra
314 (setq extra (replace-regexp-in-string "\\\\n" "\n" extra)))
315 (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props))
316 (when tmp
317 (setq tmp (copy-sequence tmp))
318 (if (string-match "\\[<[^][<>]*>\\]" tmp)
319 (setq defaction (match-string 0 tmp)
320 tmp (replace-match "" t t tmp)))
321 (if (string-match "\\[[^][]*\\]" tmp)
322 (setq option (match-string 0 tmp)
323 tmp (replace-match "" t t tmp)))
324 (if (string-match "<[^<>]*>" tmp)
325 (setq action (match-string 0 tmp)
326 tmp (replace-match "" t t tmp))))))
328 (defun org-beamer-assoc-not-empty (elt list)
329 (let ((tmp (cdr (assoc elt list))))
330 (and tmp (string-match "\\S-" tmp) tmp)))
333 (defvar org-beamer-mode-map (make-sparse-keymap)
334 "The keymap for `org-beamer-mode'.")
335 (define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-set-environment-tag)
337 (define-minor-mode org-beamer-mode
338 "Special support for editing Org-mode files made to export to beamer."
339 nil " Bm" nil)
340 (font-lock-add-keywords
341 'org-mode
342 '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
343 'prepent)
345 (defun org-beamer-place-default-actions-for-lists ()
346 "Find default overlay specifications in items, and move them.
347 The need to be after the begin statement of the environment."
348 (when org-beamer-export-is-beamer-p
349 (let (dovl)
350 (goto-char (point-min))
351 (while (re-search-forward
352 "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|desctiption\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t)
353 (if (setq dovl (cdr (assoc "BEAMER_dovl" (get-text-property (match-end 0) 'org-props))))
354 (save-excursion
355 (goto-char (1+ (match-end 1)))
356 (insert dovl)))))))
358 (defun org-beamer-amend-header ()
359 (when (and org-beamer-export-is-beamer-p
360 org-beamer-header-extra)
361 (goto-char (point-min))
362 (when (re-search-forward "^[ \t]*\\\\begin{document}" nil t)
363 (goto-char (match-beginning 0))
364 (insert org-beamer-header-extra)
365 (or (bolp) (insert "\n")))))
367 (defcustom org-beamer-fragile-re "^[ \t]*\\\\begin{verbatim}"
368 "If this regexp matches in a frame, the frame is marked as fragile."
369 :group 'org-beamer
370 :type 'regexp)
372 (defface org-beamer-tag '((t (:box (:line-width 1 :color grey40))))
373 "The special face for beamer tags."
374 :group 'org-beamer)
377 ;; Functions to initialize and post-process
378 ;; These fuctions will be hooked into various places in the export process
380 (defun org-beamer-initialize-open-trackers ()
381 "Reset variables that track if certain environments are open during export."
382 (setq org-beamer-columns-open nil)
383 (setq org-beamer-column-open nil)
384 (setq org-beamer-inside-frame-at-level nil)
385 (setq org-beamer-export-is-beamer-p nil))
387 (defun org-beamer-after-initial-vars ()
388 "Find special setings for beamer and store them.
389 The effect is that these values will be accessible during export."
390 ;; First verify that we are exporting using the beamer class
391 (setq org-beamer-export-is-beamer-p
392 (string-match "\\\\documentclass\\(\\[[^][]*?\\]\\)?{beamer}"
393 org-export-latex-header))
394 (when org-beamer-export-is-beamer-p
395 ;; Find the frame level
396 (setq org-beamer-frame-level-now
397 (or (and (org-region-active-p)
398 (save-excursion
399 (goto-char (region-beginning))
400 (and (looking-at org-complex-heading-regexp)
401 (org-entry-get nil "BEAMER_FRAME_LEVEL" 'selective))))
402 (save-excursion
403 (save-restriction
404 (widen)
405 (goto-char (point-min))
406 (and (re-search-forward
407 "^#\\+BEAMER_FRAME_LEVEL:[ \t]*\\(.*?\\)[ \t]*$" nil t)
408 (match-string 1))))
409 (plist-get org-export-latex-options-plist :beamer-frame-level)
410 org-beamer-frame-level))
411 ;; Normalize the value so that the functions can trust the value
412 (cond
413 ((not org-beamer-frame-level-now)
414 (setq org-beamer-frame-level-now nil))
415 ((stringp org-beamer-frame-level-now)
416 (setq org-beamer-frame-level-now
417 (string-to-number org-beamer-frame-level-now))))
418 ;; Find the header additons, most likely theme commands
419 (setq org-beamer-header-extra
420 (or (and (org-region-active-p)
421 (save-excursion
422 (goto-char (region-beginning))
423 (and (looking-at org-complex-heading-regexp)
424 (org-entry-get nil "BEAMER_HEADER_EXTRA"
425 'selective))))
426 (save-excursion
427 (save-restriction
428 (widen)
429 (goto-char (point-min))
430 (and (re-search-forward
431 "^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$" nil t)
432 (match-string 1))))
433 (plist-get org-export-latex-options-plist
434 :beamer-header-extra)))
435 (let ((inhibit-read-only t))
436 (org-unmodified
437 (remove-text-properties (point-min) (point-max) '(org-props nil))
438 (org-map-entries
439 '(put-text-property (point-at-bol) (point-at-eol) 'org-props
440 (org-entry-properties nil 'standard)))
441 (setq org-export-latex-options-plist
442 (plist-put org-export-latex-options-plist :tags nil))
443 (remove-text-properties (point-min) (point-max) '(org-props nil))
444 (org-map-entries
445 '(put-text-property (point-at-bol) (point-at-eol) 'org-props
446 (org-entry-properties nil 'standard)))))))
448 (defun org-beamer-auto-fragile-frames ()
449 "Mark any frames containing verbatim environments as fragile.
450 This funcion will run in the final LaTeX document."
451 (when org-beamer-export-is-beamer-p
452 (let (opts)
453 (goto-char (point-min))
454 ;; Find something that might be fragile
455 (while (re-search-forward org-beamer-fragile-re nil t)
456 (save-excursion
457 ;; Are we inside a frame here?
458 (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}"
459 nil t)
460 (equal (match-string 1) "begin"))
461 ;; yes, inside a frame, make sure "fragile" is one of the options
462 (goto-char (match-end 0))
463 (if (not (looking-at "\\[.*?\\]"))
464 (insert "[fragile]")
465 (setq opts (substring (match-string 0) 1 -1))
466 (delete-region (match-beginning 0) (match-end 0))
467 (setq opts (org-split-string opts ","))
468 (add-to-list 'opts "fragile")
469 (insert "[" (mapconcat 'identity opts ",") "]"))))))))
471 (defun org-beamer-fix-toc ()
472 "Fix the table of contents by removing the vspace line."
473 (when org-beamer-export-is-beamer-p
474 (save-excursion
475 (goto-char (point-min))
476 (when (re-search-forward "\\\\setcounter{tocdepth.*\n\\\\tableofcontents.*\n\\(\\\\vspace\\*.*\\)" nil t)
477 (delete-region (match-beginning 1) (match-end 1))))))
479 (defun org-beamer-property-changed (property value)
480 "Track the BEAMER_env property with tags."
481 (cond
482 ((equal property "BEAMER_env")
483 (save-excursion
484 (org-back-to-heading t)
485 (let ((tags (org-get-tags)))
486 (setq tags (delq nil (mapcar (lambda (x)
487 (if (string-match "^B_" x) nil x))
488 tags)))
489 (org-set-tags-to tags))
490 (when (and value (stringp value) (string-match "\\S-" value))
491 (org-toggle-tag (concat "B_" value) 'on))))
492 ((equal property "BEAMER_col")
493 (org-toggle-tag "BMCOL" (if (and value (string-match "\\S-" value))
494 'on 'off)))))
496 (defun org-beamer-select-beamer-code ()
497 "Take code marked for BEAMER and turn it into marked for LaTeX."
498 (when org-beamer-export-is-beamer-p
499 (goto-char (point-min))
500 (while (re-search-forward
501 "^\\([ \]*#\\+\\(begin_\\|end_\\)?\\)\\(beamer\\)\\>" nil t)
502 (replace-match "\\1latex"))))
504 ;; OK, hook all these functions into appropriate places
505 (add-hook 'org-export-first-hook
506 'org-beamer-initialize-open-trackers)
507 (add-hook 'org-property-changed-functions
508 'org-beamer-property-changed)
509 (add-hook 'org-export-latex-after-initial-vars-hook
510 'org-beamer-after-initial-vars)
511 (add-hook 'org-export-latex-final-hook
512 'org-beamer-place-default-actions-for-lists)
513 (add-hook 'org-export-latex-final-hook
514 'org-beamer-auto-fragile-frames)
515 (add-hook 'org-export-latex-final-hook
516 'org-beamer-fix-toc)
517 (add-hook 'org-export-latex-final-hook
518 'org-beamer-amend-header)
519 (add-hook 'org-export-preprocess-before-selecting-backend-code-hook
520 'org-beamer-select-beamer-code)
522 (defun org-beamer-settings-template (kind)
523 "Insert a settings template, to make sure users do this right."
524 (interactive (progn
525 (message "Current [s]ubtree or [g]lobal?")
526 (if (equal (read-char-exclusive) ?g)
527 (list 'global)
528 (list 'subtree))))
529 (if (eq kind 'subtree)
530 (progn
531 (org-back-to-heading t)
532 (org-reveal)
533 (org-entry-put nil "LaTeX_CLASS" "beamer")
534 (org-entry-put nil "LaTeX_CLASS_OPTIONS" "[presentation]")
535 (org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf")
536 (org-entry-put nil "BEAMER_FRAME_LEVEL" (number-to-string
537 org-beamer-frame-level))
538 (org-entry-put nil "BEAMER_HEADER_EXTRA" org-beamer-themes)
539 (org-entry-put nil "COLUMNS" org-beamer-column-view-format)
540 (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"))
541 (insert "#+LaTeX_CLASS: beamer\n")
542 (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n")
543 (insert (format "#+BEAMER_FRAME_LEVEL: %d\n" org-beamer-frame-level) "\n")
544 (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes "\n")
545 (insert "#+COLUMNS: " org-beamer-column-view-format "\n")
546 (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")))
549 (defun org-beamer-allowed-property-values (property)
550 "Supply allowed values for BEAMER properties."
551 (cond
552 ((and (equal property "BEAMER_env")
553 (not (org-entry-get nil (concat property "_ALL") 'inherit)))
554 ;; If no allowed values for BEAMER_env have been defined,
555 ;; supply all defined environments
556 (mapcar 'car (append org-beamer-environments-extra
557 org-beamer-environments-default)))
558 ((and (equal property "BEAMER_col")
559 (not (org-entry-get nil (concat property "_ALL") 'inherit)))
560 ;; If no allowed values for BEAMER_col have been defined,
561 ;; supply some
562 '("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "" ":ETC"))
563 (t nil)))
565 (add-hook 'org-property-allowed-value-functions
566 'org-beamer-allowed-property-values)
568 (provide 'org-beamer)
570 ;; arch-tag: 68bac91a-a946-43a3-8173-a9269306f67c
572 ;;; org-beamer.el ends here