Merge branch 'master' of orgmode.org:org-mode
[org-mode.git] / lisp / ox-beamer.el
blob6a699e7004b819fdc529a98590780edacb50663d
1 ;;; ox-beamer.el --- Beamer Back-End for Org Export Engine
3 ;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
5 ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
6 ;; Nicolas Goaziou <n.goaziou AT gmail DOT com>
7 ;; Keywords: org, wp, tex
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 ;;; Commentary:
24 ;; This library implements both a Beamer back-end, derived from the
25 ;; LaTeX one and a minor mode easing structure edition of the
26 ;; document.
28 ;; Depending on the desired output format, three commands are provided
29 ;; for export: `org-beamer-export-as-latex' (temporary buffer),
30 ;; `org-beamer-export-to-latex' ("tex" file) and
31 ;; `org-beamer-export-to-pdf' ("pdf" file).
33 ;; This back-end supports every buffer keyword, attribute and options
34 ;; items (see `org-latex-options-alist') already supported by `latex'
35 ;; back-end. As such, it is suggested to add an entry in
36 ;; `org-latex-classes' variable which is appropriate for Beamer
37 ;; export.
39 ;; On top of this, the `beamer' back-end also introduces the following
40 ;; keywords: "BEAMER_THEME", "BEAMER_COLOR_THEME",
41 ;; "BEAMER_FONT_THEME", "BEAMER_INNER_THEME" and "BEAMER_OUTER_THEME".
42 ;; All accept options in square brackets.
44 ;; Moreover, headlines now fall into three categories: sectioning
45 ;; elements, frames and blocks.
47 ;; - Headlines become frames when their level is equal to
48 ;; `org-beamer-frame-level' (or "H" value in the OPTIONS line).
49 ;; Though, if an headline in the current tree has a "BEAMER_env"
50 ;; (see below) property set to either "frame" or "fullframe", its
51 ;; level overrides the variable. A "fullframe" is a frame with an
52 ;; empty (ignored) title.
54 ;; - All frames' children become block environments. Special block
55 ;; types can be enforced by setting headline's "BEAMER_env" property
56 ;; to an appropriate value (see `org-beamer-environments-default'
57 ;; for supported value and `org-beamer-environments-extra' for
58 ;; adding more).
60 ;; - As a special case, if the "BEAMER_env" property is set to either
61 ;; "appendix", "note", "noteNH" or "againframe", the headline will
62 ;; become, respectively, an appendix, a note (within frame or
63 ;; between frame, depending on its level), a note with its title
64 ;; ignored or an againframe command. In the latter case,
65 ;; a "BEAMER_ref" property is mandatory in order to refer to the
66 ;; frame being resumed, and contents are ignored.
68 ;; Also, an headline with an "ignoreheading" environment will have
69 ;; its contents only inserted in the output. This special value is
70 ;; useful to have data between frames, or to properly close
71 ;; a "column" environment.
73 ;; Along with "BEAMER_env", headlines also support the "BEAMER_act"
74 ;; and "BEAMER_opt" properties. The former is translated as an
75 ;; overlay/action specification (or a default overlay specification
76 ;; when enclosed within square brackets) whereas the latter specifies
77 ;; options for the current frame ("fragile" option is added
78 ;; automatically, though).
80 ;; Moreover, headlines handle the "BEAMER_col" property. Its value
81 ;; should be a decimal number representing the width of the column as
82 ;; a fraction of the total text width. If the headline has no
83 ;; specific environment, its title will be ignored and its contents
84 ;; will fill the column created. Otherwise, the block will fill the
85 ;; whole column and the title will be preserved. Two contiguous
86 ;; headlines with a non-nil "BEAMER_col" value share the same
87 ;; "columns" LaTeX environment. It will end before the next headline
88 ;; without such a property. This environment is generated
89 ;; automatically. Although, it can also be explicitly created, with
90 ;; a special "columns" value for "BEAMER_env" property (if it needs to
91 ;; be set up with some specific options, for example).
93 ;; Every plain list has support for `:environment', `:overlay' and
94 ;; `:options' attributes (through ATTR_BEAMER affiliated keyword).
95 ;; The first one allows to use a different environment, the second
96 ;; sets overlay specifications and the last one inserts optional
97 ;; arguments in current list environment.
99 ;; Eventually, an export snippet with a value enclosed within angular
100 ;; brackets put at the beginning of an element or object whose type is
101 ;; among `bold', `item', `link', `radio-target' and `target' will
102 ;; control its overlay specifications.
104 ;; On the minor mode side, `org-beamer-select-environment' (bound by
105 ;; default to "C-c C-b") and `org-beamer-insert-options-template' are
106 ;; the two entry points.
108 ;;; Code:
110 (require 'ox-latex)
114 ;;; User-Configurable Variables
116 (defgroup org-export-beamer nil
117 "Options specific for using the beamer class in LaTeX export."
118 :tag "Org Beamer"
119 :group 'org-export
120 :version "24.2")
122 (defcustom org-beamer-frame-level 1
123 "The level at which headlines become frames.
125 Headlines at a lower level will be translated into a sectioning
126 structure. At a higher level, they will be translated into
127 blocks.
129 If an headline with a \"BEAMER_env\" property set to \"frame\" is
130 found within a tree, its level locally overrides this number.
132 This variable has no effect on headlines with the \"BEAMER_env\"
133 property set to either \"ignoreheading\", \"appendix\", or
134 \"note\", which will respectively, be invisible, become an
135 appendix or a note.
137 This integer is relative to the minimal level of an headline
138 within the parse tree, defined as 1."
139 :group 'org-export-beamer
140 :type 'integer)
142 (defcustom org-beamer-frame-default-options ""
143 "Default options string to use for frames.
144 For example, it could be set to \"allowframebreaks\"."
145 :group 'org-export-beamer
146 :type '(string :tag "[options]"))
148 (defcustom org-beamer-column-view-format
149 "%45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act) %4BEAMER_col(Col) %8BEAMER_opt(Opt)"
150 "Column view format that should be used to fill the template."
151 :group 'org-export-beamer
152 :type '(choice
153 (const :tag "Do not insert Beamer column view format" nil)
154 (string :tag "Beamer column view format")))
156 (defcustom org-beamer-theme "default"
157 "Default theme used in Beamer presentations."
158 :group 'org-export-beamer
159 :type '(choice
160 (const :tag "Do not insert a Beamer theme" nil)
161 (string :tag "Beamer theme")))
163 (defcustom org-beamer-environments-extra nil
164 "Environments triggered by tags in Beamer export.
165 Each entry has 4 elements:
167 name Name of the environment
168 key Selection key for `org-beamer-select-environment'
169 open The opening template for the environment, with the following escapes
170 %a the action/overlay specification
171 %A the default action/overlay specification
172 %o the options argument of the template
173 %h the headline text
174 %H if there is headline text, that text in {} braces
175 %U if there is headline text, that text in [] brackets
176 close The closing string of the environment."
177 :group 'org-export-beamer
178 :type '(repeat
179 (list
180 (string :tag "Environment")
181 (string :tag "Selection key")
182 (string :tag "Begin")
183 (string :tag "End"))))
185 (defcustom org-beamer-outline-frame-title "Outline"
186 "Default title of a frame containing an outline."
187 :group 'org-export-beamer
188 :type '(string :tag "Outline frame title"))
190 (defcustom org-beamer-outline-frame-options ""
191 "Outline frame options appended after \\begin{frame}.
192 You might want to put e.g. \"allowframebreaks=0.9\" here."
193 :group 'org-export-beamer
194 :type '(string :tag "Outline frame options"))
198 ;;; Internal Variables
200 (defconst org-beamer-column-widths
201 "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
202 "The column widths that should be installed as allowed property values.")
204 (defconst org-beamer-environments-special
205 '(("againframe" "A")
206 ("appendix" "x")
207 ("column" "c")
208 ("columns" "C")
209 ("frame" "f")
210 ("fullframe" "F")
211 ("ignoreheading" "i")
212 ("note" "n")
213 ("noteNH" "N"))
214 "Alist of environments treated in a special way by the back-end.
215 Keys are environment names, as strings, values are bindings used
216 in `org-beamer-select-environment'. Environments listed here,
217 along with their binding, are hard coded and cannot be modified
218 through `org-beamer-environments-extra' variable.")
220 (defconst org-beamer-environments-default
221 '(("block" "b" "\\begin{block}%a{%h}" "\\end{block}")
222 ("alertblock" "a" "\\begin{alertblock}%a{%h}" "\\end{alertblock}")
223 ("verse" "v" "\\begin{verse}%a %% %h" "\\end{verse}")
224 ("quotation" "q" "\\begin{quotation}%a %% %h" "\\end{quotation}")
225 ("quote" "Q" "\\begin{quote}%a %% %h" "\\end{quote}")
226 ("structureenv" "s" "\\begin{structureenv}%a %% %h" "\\end{structureenv}")
227 ("theorem" "t" "\\begin{theorem}%a%U" "\\end{theorem}")
228 ("definition" "d" "\\begin{definition}%a%U" "\\end{definition}")
229 ("example" "e" "\\begin{example}%a%U" "\\end{example}")
230 ("exampleblock" "E" "\\begin{exampleblock}%a{%h}" "\\end{exampleblock}")
231 ("proof" "p" "\\begin{proof}%a%U" "\\end{proof}")
232 ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}" "\\end{beamercolorbox}"))
233 "Environments triggered by properties in Beamer export.
234 These are the defaults - for user definitions, see
235 `org-beamer-environments-extra'.")
237 (defconst org-beamer-verbatim-elements
238 '(code example-block fixed-width inline-src-block src-block verbatim)
239 "List of element or object types producing verbatim text.
240 This is used internally to determine when a frame should have the
241 \"fragile\" option.")
245 ;;; Internal functions
247 (defun org-beamer--normalize-argument (argument type)
248 "Return ARGUMENT string with proper boundaries.
250 TYPE is a symbol among the following:
251 `action' Return ARGUMENT within angular brackets.
252 `defaction' Return ARGUMENT within both square and angular brackets.
253 `option' Return ARGUMENT within square brackets."
254 (if (not (string-match "\\S-" argument)) ""
255 (case type
256 (action (if (string-match "\\`<.*>\\'" argument) argument
257 (format "<%s>" argument)))
258 (defaction (cond
259 ((string-match "\\`\\[<.*>\\]\\'" argument) argument)
260 ((string-match "\\`<.*>\\'" argument)
261 (format "[%s]" argument))
262 ((string-match "\\`\\[\\(.*\\)\\]\\'" argument)
263 (format "[<%s>]" (match-string 1 argument)))
264 (t (format "[<%s>]" argument))))
265 (option (if (string-match "\\`\\[.*\\]\\'" argument) argument
266 (format "[%s]" argument)))
267 (otherwise argument))))
269 (defun org-beamer--element-has-overlay-p (element)
270 "Non-nil when ELEMENT has an overlay specified.
271 An element has an overlay specification when it starts with an
272 `beamer' export-snippet whose value is between angular brackets.
273 Return overlay specification, as a string, or nil."
274 (let ((first-object (car (org-element-contents element))))
275 (when (eq (org-element-type first-object) 'export-snippet)
276 (let ((value (org-element-property :value first-object)))
277 (and (string-match "\\`<.*>\\'" value) value)))))
281 ;;; Define Back-End
283 (org-export-define-derived-backend beamer latex
284 :export-block "BEAMER"
285 :menu-entry
286 (?l 1
287 ((?B "As TEX buffer (Beamer)" org-beamer-export-as-latex)
288 (?b "As TEX file (Beamer)" org-beamer-export-to-latex)
289 (?P "As PDF file (Beamer)" org-beamer-export-to-pdf)
290 (?O "As PDF file and open (Beamer)"
291 (lambda (a s v b)
292 (if a (org-beamer-export-to-pdf t s v b)
293 (org-open-file (org-beamer-export-to-pdf nil s v b)))))))
294 :options-alist
295 ((:beamer-theme "BEAMER_THEME" nil org-beamer-theme)
296 (:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t)
297 (:beamer-font-theme "BEAMER_FONT_THEME" nil nil t)
298 (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t)
299 (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t)
300 (:headline-levels nil "H" org-beamer-frame-level))
301 :translate-alist ((bold . org-beamer-bold)
302 (export-block . org-beamer-export-block)
303 (export-snippet . org-beamer-export-snippet)
304 (headline . org-beamer-headline)
305 (item . org-beamer-item)
306 (keyword . org-beamer-keyword)
307 (link . org-beamer-link)
308 (plain-list . org-beamer-plain-list)
309 (radio-target . org-beamer-radio-target)
310 (target . org-beamer-target)
311 (template . org-beamer-template)))
315 ;;; Transcode Functions
317 ;;;; Bold
319 (defun org-beamer-bold (bold contents info)
320 "Transcode BLOCK object into Beamer code.
321 CONTENTS is the text being bold. INFO is a plist used as
322 a communication channel."
323 (format "\\alert%s{%s}"
324 (or (org-beamer--element-has-overlay-p bold) "")
325 contents))
328 ;;;; Export Block
330 (defun org-beamer-export-block (export-block contents info)
331 "Transcode an EXPORT-BLOCK element into Beamer code.
332 CONTENTS is nil. INFO is a plist used as a communication
333 channel."
334 (when (member (org-element-property :type export-block) '("BEAMER" "LATEX"))
335 (org-remove-indentation (org-element-property :value export-block))))
338 ;;;; Export Snippet
340 (defun org-beamer-export-snippet (export-snippet contents info)
341 "Transcode an EXPORT-SNIPPET object into Beamer code.
342 CONTENTS is nil. INFO is a plist used as a communication
343 channel."
344 (let ((backend (org-export-snippet-backend export-snippet))
345 (value (org-element-property :value export-snippet)))
346 ;; Only "latex" and "beamer" snippets are retained.
347 (cond ((eq backend 'latex) value)
348 ;; Ignore "beamer" snippets specifying overlays.
349 ((and (eq backend 'beamer)
350 (or (org-export-get-previous-element export-snippet info)
351 (not (string-match "\\`<.*>\\'" value))))
352 value))))
355 ;;;; Headline
357 ;; The main function to translate an headline is
358 ;; `org-beamer-headline'.
360 ;; Depending on the level at which an headline is considered as
361 ;; a frame (given by `org-beamer--frame-level'), the headline is
362 ;; either a section (`org-beamer--format-section'), a frame
363 ;; (`org-beamer--format-frame') or a block
364 ;; (`org-beamer--format-block').
366 ;; `org-beamer-headline' also takes care of special environments
367 ;; like "ignoreheading", "note", "noteNH", "appendix" and
368 ;; "againframe".
370 (defun org-beamer--get-label (headline info)
371 "Return label for HEADLINE, as a string.
373 INFO is a plist used as a communication channel.
375 The value is either the label specified in \"BEAMER_opt\"
376 property, or a fallback value built from headline's number. This
377 function assumes HEADLINE will be treated as a frame."
378 (let ((opt (org-element-property :beamer-opt headline)))
379 (if (and (org-string-nw-p opt)
380 (string-match "\\(?:^\\|,\\)label=\\(.*?\\)\\(?:$\\|,\\)" opt))
381 (match-string 1 opt)
382 (format "sec-%s"
383 (mapconcat 'number-to-string
384 (org-export-get-headline-number headline info)
385 "-")))))
387 (defun org-beamer--frame-level (headline info)
388 "Return frame level in subtree containing HEADLINE.
389 INFO is a plist used as a communication channel."
391 ;; 1. Look for "frame" environment in parents, starting from the
392 ;; farthest.
393 (catch 'exit
394 (mapc (lambda (parent)
395 (let ((env (org-element-property :beamer-env parent)))
396 (when (and env (member (downcase env) '("frame" "fullframe")))
397 (throw 'exit (org-export-get-relative-level parent info)))))
398 (nreverse (org-export-get-genealogy headline)))
399 nil)
400 ;; 2. Look for "frame" environment in HEADLINE.
401 (let ((env (org-element-property :beamer-env headline)))
402 (and env (member (downcase env) '("frame" "fullframe"))
403 (org-export-get-relative-level headline info)))
404 ;; 3. Look for "frame" environment in sub-tree.
405 (org-element-map headline 'headline
406 (lambda (hl)
407 (let ((env (org-element-property :beamer-env hl)))
408 (when (and env (member (downcase env) '("frame" "fullframe")))
409 (org-export-get-relative-level hl info))))
410 info 'first-match)
411 ;; 4. No "frame" environment in tree: use default value.
412 (plist-get info :headline-levels)))
414 (defun org-beamer--format-section (headline contents info)
415 "Format HEADLINE as a sectioning part.
416 CONTENTS holds the contents of the headline. INFO is a plist
417 used as a communication channel."
418 ;; Use `latex' back-end output, inserting overlay specifications
419 ;; if possible.
420 (let ((latex-headline (org-export-with-backend 'latex headline contents info))
421 (mode-specs (org-element-property :beamer-act headline)))
422 (if (and mode-specs
423 (string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{"
424 latex-headline))
425 (replace-match (concat (match-string 1 latex-headline)
426 (format "<%s>" mode-specs))
427 nil nil latex-headline 1)
428 latex-headline)))
430 (defun org-beamer--format-frame (headline contents info)
431 "Format HEADLINE as a frame.
432 CONTENTS holds the contents of the headline. INFO is a plist
433 used as a communication channel."
434 (let ((fragilep
435 ;; FRAGILEP is non-nil when HEADLINE contains an element
436 ;; among `org-beamer-verbatim-elements'.
437 (org-element-map headline org-beamer-verbatim-elements 'identity
438 info 'first-match)))
439 (concat "\\begin{frame}"
440 ;; Overlay specification, if any. When surrounded by
441 ;; square brackets, consider it as a default
442 ;; specification.
443 (let ((action (org-element-property :beamer-act headline)))
444 (cond
445 ((not action) "")
446 ((string-match "\\`\\[.*\\]\\'" action )
447 (org-beamer--normalize-argument action 'defaction))
448 (t (org-beamer--normalize-argument action 'action))))
449 ;; Options, if any.
450 (let* ((beamer-opt (org-element-property :beamer-opt headline))
451 (options
452 ;; Collect options from default value and headline's
453 ;; properties. Also add a label for links.
454 (append
455 (org-split-string org-beamer-frame-default-options ",")
456 (and beamer-opt
457 (org-split-string
458 ;; Remove square brackets if user provided
459 ;; them.
460 (and (string-match "^\\[?\\(.*\\)\\]?$" beamer-opt)
461 (match-string 1 beamer-opt))
462 ","))
463 ;; Provide an automatic label for the frame
464 ;; unless the user specified one.
465 (unless (and beamer-opt
466 (string-match "\\(^\\|,\\)label=" beamer-opt))
467 (list
468 (format "label=%s"
469 (org-beamer--get-label headline info)))))))
470 ;; Change options list into a string.
471 (org-beamer--normalize-argument
472 (mapconcat
473 'identity
474 (if (or (not fragilep) (member "fragile" options)) options
475 (cons "fragile" options))
476 ",")
477 'option))
478 ;; Title.
479 (let ((env (org-element-property :beamer-env headline)))
480 (format "{%s}"
481 (if (and env (equal (downcase env) "fullframe")) ""
482 (org-export-data
483 (org-element-property :title headline) info))))
484 "\n"
485 ;; The following workaround is required in fragile frames
486 ;; as Beamer will append "\par" to the beginning of the
487 ;; contents. So we need to make sure the command is
488 ;; separated from the contents by at least one space. If
489 ;; it isn't, it will create "\parfirst-word" command and
490 ;; remove the first word from the contents in the PDF
491 ;; output.
492 (if (not fragilep) contents
493 (replace-regexp-in-string "\\`\n*" "\\& " contents))
494 "\\end{frame}")))
496 (defun org-beamer--format-block (headline contents info)
497 "Format HEADLINE as a block.
498 CONTENTS holds the contents of the headline. INFO is a plist
499 used as a communication channel."
500 (let* ((column-width (org-element-property :beamer-col headline))
501 ;; ENVIRONMENT defaults to "block" if none is specified and
502 ;; there is no column specification. If there is a column
503 ;; specified but still no explicit environment, ENVIRONMENT
504 ;; is "column".
505 (environment (let ((env (org-element-property :beamer-env headline)))
506 (cond
507 ;; "block" is the fallback environment.
508 ((and (not env) (not column-width)) "block")
509 ;; "column" only.
510 ((not env) "column")
511 ;; Use specified environment.
512 (t (downcase env)))))
513 (env-format (unless (member environment '("column" "columns"))
514 (assoc environment
515 (append org-beamer-environments-special
516 org-beamer-environments-extra
517 org-beamer-environments-default))))
518 (title (org-export-data (org-element-property :title headline) info))
519 (options (let ((options (org-element-property :beamer-opt headline)))
520 (if (not options) ""
521 (org-beamer--normalize-argument options 'option))))
522 ;; Start a "columns" environment when explicitly requested or
523 ;; when there is no previous headline or the previous
524 ;; headline do not have a BEAMER_column property.
525 (parent-env (org-element-property
526 :beamer-env (org-export-get-parent-headline headline)))
527 (start-columns-p
528 (or (equal environment "columns")
529 (and column-width
530 (not (and parent-env
531 (equal (downcase parent-env) "columns")))
532 (or (org-export-first-sibling-p headline info)
533 (not (org-element-property
534 :beamer-col
535 (org-export-get-previous-element
536 headline info)))))))
537 ;; End the "columns" environment when explicitly requested or
538 ;; when there is no next headline or the next headline do not
539 ;; have a BEAMER_column property.
540 (end-columns-p
541 (or (equal environment "columns")
542 (and column-width
543 (not (and parent-env
544 (equal (downcase parent-env) "columns")))
545 (or (org-export-last-sibling-p headline info)
546 (not (org-element-property
547 :beamer-col
548 (org-export-get-next-element headline info))))))))
549 (concat
550 (when start-columns-p
551 ;; Column can accept options only when the environment is
552 ;; explicitly defined.
553 (if (not (equal environment "columns")) "\\begin{columns}\n"
554 (format "\\begin{columns}%s\n" options)))
555 (when column-width
556 (format "\\begin{column}%s{%s}\n"
557 ;; One can specify placement for column only when
558 ;; HEADLINE stands for a column on its own.
559 (if (equal environment "column") options "")
560 (format "%s\\textwidth" column-width)))
561 ;; Block's opening string.
562 (when env-format
563 (concat
564 (org-fill-template
565 (nth 2 env-format)
566 (nconc
567 ;; If BEAMER_act property has its value enclosed in square
568 ;; brackets, it is a default overlay specification and
569 ;; overlay specification is empty. Otherwise, it is an
570 ;; overlay specification and the default one is nil.
571 (let ((action (org-element-property :beamer-act headline)))
572 (cond
573 ((not action) (list (cons "a" "") (cons "A" "")))
574 ((string-match "\\`\\[.*\\]\\'" action)
575 (list
576 (cons "A" (org-beamer--normalize-argument action 'defaction))
577 (cons "a" "")))
579 (list (cons "a" (org-beamer--normalize-argument action 'action))
580 (cons "A" "")))))
581 (list (cons "o" options)
582 (cons "h" title)
583 (cons "H" (if (equal title "") "" (format "{%s}" title)))
584 (cons "U" (if (equal title "") "" (format "[%s]" title))))))
585 "\n"))
586 contents
587 ;; Block's closing string.
588 (when environment (concat (nth 3 env-format) "\n"))
589 (when column-width "\\end{column}\n")
590 (when end-columns-p "\\end{columns}"))))
592 (defun org-beamer-headline (headline contents info)
593 "Transcode HEADLINE element into Beamer code.
594 CONTENTS is the contents of the headline. INFO is a plist used
595 as a communication channel."
596 (unless (org-element-property :footnote-section-p headline)
597 (let ((level (org-export-get-relative-level headline info))
598 (frame-level (org-beamer--frame-level headline info))
599 (environment (let ((env (org-element-property :beamer-env headline)))
600 (if (stringp env) (downcase env) "block"))))
601 (cond
602 ;; Case 1: Resume frame specified by "BEAMER_ref" property.
603 ((equal environment "againframe")
604 (let ((ref (org-element-property :beamer-ref headline)))
605 ;; Reference to frame being resumed is mandatory. Ignore
606 ;; the whole headline if it isn't provided.
607 (when (org-string-nw-p ref)
608 (concat "\\againframe"
609 ;; Overlay specification.
610 (let ((overlay (org-element-property :beamer-act headline)))
611 (when overlay
612 (org-beamer--normalize-argument
613 overlay
614 (if (string-match "^\\[.*\\]$" overlay) 'defaction
615 'action))))
616 ;; Options.
617 (let ((options (org-element-property :beamer-opt headline)))
618 (when options
619 (org-beamer--normalize-argument options 'option)))
620 ;; Resolve reference provided by "BEAMER_ref"
621 ;; property. This is done by building a minimal fake
622 ;; link and calling the appropriate resolve function,
623 ;; depending on the reference syntax.
624 (let* ((type
625 (progn
626 (string-match "^\\(id:\\|#\\|\\*\\)?\\(.*\\)" ref)
627 (cond
628 ((or (not (match-string 1 ref))
629 (equal (match-string 1 ref) "*")) 'fuzzy)
630 ((equal (match-string 1 ref) "id:") 'id)
631 (t 'custom-id))))
632 (link (list 'link (list :path (match-string 2 ref))))
633 (target (if (eq type 'fuzzy)
634 (org-export-resolve-fuzzy-link link info)
635 (org-export-resolve-id-link link info))))
636 ;; Now use user-defined label provided in TARGET
637 ;; headline, or fallback to standard one.
638 (format "{%s}" (org-beamer--get-label target info)))))))
639 ;; Case 2: Creation of an appendix is requested.
640 ((equal environment "appendix")
641 (concat "\\appendix"
642 (org-element-property :beamer-act headline)
643 "\n"
644 (make-string (org-element-property :pre-blank headline) ?\n)
645 contents))
646 ;; Case 3: Ignore heading.
647 ((equal environment "ignoreheading")
648 (concat (make-string (org-element-property :pre-blank headline) ?\n)
649 contents))
650 ;; Case 4: HEADLINE is a note.
651 ((member environment '("note" "noteNH"))
652 (format "\\note{%s}"
653 (concat (and (equal environment "note")
654 (concat
655 (org-export-data
656 (org-element-property :title headline) info)
657 "\n"))
658 (org-trim contents))))
659 ;; Case 5: HEADLINE is a frame.
660 ((= level frame-level)
661 (org-beamer--format-frame headline contents info))
662 ;; Case 6: Regular section, extracted from
663 ;; `org-latex-classes'.
664 ((< level frame-level)
665 (org-beamer--format-section headline contents info))
666 ;; Case 7: Otherwise, HEADLINE is a block.
667 (t (org-beamer--format-block headline contents info))))))
670 ;;;; Item
672 (defun org-beamer-item (item contents info)
673 "Transcode an ITEM element into Beamer code.
674 CONTENTS holds the contents of the item. INFO is a plist holding
675 contextual information."
676 (let ((action (let ((first-element (car (org-element-contents item))))
677 (and (eq (org-element-type first-element) 'paragraph)
678 (org-beamer--element-has-overlay-p first-element))))
679 (output (org-export-with-backend 'latex item contents info)))
680 (if (not action) output
681 ;; If the item starts with a paragraph and that paragraph starts
682 ;; with an export snippet specifying an overlay, insert it after
683 ;; \item command.
684 (replace-regexp-in-string "\\\\item" (concat "\\\\item" action) output))))
687 ;;;; Keyword
689 (defun org-beamer-keyword (keyword contents info)
690 "Transcode a KEYWORD element into Beamer code.
691 CONTENTS is nil. INFO is a plist used as a communication
692 channel."
693 (let ((key (org-element-property :key keyword))
694 (value (org-element-property :value keyword)))
695 ;; Handle specifically BEAMER and TOC (headlines only) keywords.
696 ;; Otherwise, fallback to `latex' back-end.
697 (cond
698 ((equal key "BEAMER") value)
699 ((and (equal key "TOC") (string-match "\\<headlines\\>" value))
700 (let ((depth (or (and (string-match "[0-9]+" value)
701 (string-to-number (match-string 0 value)))
702 (plist-get info :with-toc)))
703 (options (and (string-match "\\[.*?\\]" value)
704 (match-string 0 value))))
705 (concat
706 "\\begin{frame}"
707 (when (wholenump depth) (format "\\setcounter{tocdepth}{%s}\n" depth))
708 "\\tableofcontents" options "\n"
709 "\\end{frame}")))
710 (t (org-export-with-backend 'latex keyword contents info)))))
713 ;;;; Link
715 (defun org-beamer-link (link contents info)
716 "Transcode a LINK object into Beamer code.
717 CONTENTS is the description part of the link. INFO is a plist
718 used as a communication channel."
719 (let ((type (org-element-property :type link))
720 (path (org-element-property :path link)))
721 ;; Use \hyperlink command for all internal links.
722 (cond
723 ((equal type "radio")
724 (let ((destination (org-export-resolve-radio-link link info)))
725 (when destination
726 (format "\\hyperlink%s{%s}{%s}"
727 (or (org-beamer--element-has-overlay-p link) "")
728 (org-export-solidify-link-text path)
729 (org-export-data (org-element-contents destination) info)))))
730 ((and (member type '("custom-id" "fuzzy" "id"))
731 (let ((destination (if (string= type "fuzzy")
732 (org-export-resolve-fuzzy-link link info)
733 (org-export-resolve-id-link link info))))
734 (case (org-element-type destination)
735 (headline
736 (let ((label
737 (format "sec-%s"
738 (mapconcat
739 'number-to-string
740 (org-export-get-headline-number
741 destination info)
742 "-"))))
743 (if (and (plist-get info :section-numbers) (not contents))
744 (format "\\ref{%s}" label)
745 (format "\\hyperlink%s{%s}{%s}"
746 (or (org-beamer--element-has-overlay-p link) "")
747 label
748 contents))))
749 (target
750 (let ((path (org-export-solidify-link-text path)))
751 (if (not contents) (format "\\ref{%s}" path)
752 (format "\\hyperlink%s{%s}{%s}"
753 (or (org-beamer--element-has-overlay-p link) "")
754 path
755 contents))))))))
756 ;; Otherwise, use `latex' back-end.
757 (t (org-export-with-backend 'latex link contents info)))))
760 ;;;; Plain List
762 ;; Plain lists support `:environment', `:overlay' and `:options'
763 ;; attributes.
765 (defun org-beamer-plain-list (plain-list contents info)
766 "Transcode a PLAIN-LIST element into Beamer code.
767 CONTENTS is the contents of the list. INFO is a plist holding
768 contextual information."
769 (let* ((type (org-element-property :type plain-list))
770 (attributes (org-export-read-attribute :attr_beamer plain-list))
771 (latex-type (let ((env (plist-get attributes :environment)))
772 (cond (env (format "%s" env))
773 ((eq type 'ordered) "enumerate")
774 ((eq type 'descriptive) "description")
775 (t "itemize")))))
776 (org-latex--wrap-label
777 plain-list
778 (format "\\begin{%s}%s%s\n%s\\end{%s}"
779 latex-type
780 ;; Default overlay specification, if any.
781 (org-beamer--normalize-argument
782 (format "%s" (or (plist-get attributes :overlay) ""))
783 'defaction)
784 ;; Second optional argument depends on the list type.
785 (org-beamer--normalize-argument
786 (format "%s" (or (plist-get attributes :options) ""))
787 'option)
788 ;; Eventually insert contents and close environment.
789 contents
790 latex-type))))
793 ;;;; Radio Target
795 (defun org-beamer-radio-target (radio-target text info)
796 "Transcode a RADIO-TARGET object into Beamer code.
797 TEXT is the text of the target. INFO is a plist holding
798 contextual information."
799 (format "\\hypertarget%s{%s}{%s}"
800 (or (org-beamer--element-has-overlay-p radio-target) "")
801 (org-export-solidify-link-text
802 (org-element-property :value radio-target))
803 text))
806 ;;;; Target
808 (defun org-beamer-target (target contents info)
809 "Transcode a TARGET object into Beamer code.
810 CONTENTS is nil. INFO is a plist holding contextual
811 information."
812 (format "\\hypertarget{%s}{}"
813 (org-export-solidify-link-text (org-element-property :value target))))
816 ;;;; Template
818 ;; Template used is similar to the one used in `latex' back-end,
819 ;; excepted for the table of contents and Beamer themes.
821 (defun org-beamer-template (contents info)
822 "Return complete document string after Beamer conversion.
823 CONTENTS is the transcoded contents string. INFO is a plist
824 holding export options."
825 (let ((title (org-export-data (plist-get info :title) info)))
826 (concat
827 ;; 1. Time-stamp.
828 (and (plist-get info :time-stamp-file)
829 (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
830 ;; 2. Document class and packages.
831 (let ((class (plist-get info :latex-class))
832 (class-options (plist-get info :latex-class-options)))
833 (org-element-normalize-string
834 (let* ((header (nth 1 (assoc class org-latex-classes)))
835 (document-class-string
836 (and (stringp header)
837 (if (not class-options) header
838 (replace-regexp-in-string
839 "^[ \t]*\\\\documentclass\\(\\(\\[.*\\]\\)?\\)"
840 class-options header t nil 1)))))
841 (if (not document-class-string)
842 (user-error "Unknown LaTeX class `%s'")
843 (org-latex-guess-babel-language
844 (org-latex-guess-inputenc
845 (org-splice-latex-header
846 document-class-string
847 org-latex-default-packages-alist
848 org-latex-packages-alist nil
849 (plist-get info :latex-header-extra)))
850 info)))))
851 ;; 3. Insert themes.
852 (let ((format-theme
853 (function
854 (lambda (prop command)
855 (let ((theme (plist-get info prop)))
856 (when theme
857 (concat command
858 (if (not (string-match "\\[.*\\]" theme))
859 (format "{%s}\n" theme)
860 (format "%s{%s}\n"
861 (match-string 0 theme)
862 (org-trim
863 (replace-match "" nil nil theme)))))))))))
864 (mapconcat (lambda (args) (apply format-theme args))
865 '((:beamer-theme "\\usetheme")
866 (:beamer-color-theme "\\usecolortheme")
867 (:beamer-font-theme "\\usefonttheme")
868 (:beamer-inner-theme "\\useinnertheme")
869 (:beamer-outer-theme "\\useoutertheme"))
870 ""))
871 ;; 4. Possibly limit depth for headline numbering.
872 (let ((sec-num (plist-get info :section-numbers)))
873 (when (integerp sec-num)
874 (format "\\setcounter{secnumdepth}{%d}\n" sec-num)))
875 ;; 5. Author.
876 (let ((author (and (plist-get info :with-author)
877 (let ((auth (plist-get info :author)))
878 (and auth (org-export-data auth info)))))
879 (email (and (plist-get info :with-email)
880 (org-export-data (plist-get info :email) info))))
881 (cond ((and author email (not (string= "" email)))
882 (format "\\author{%s\\thanks{%s}}\n" author email))
883 (author (format "\\author{%s}\n" author))
884 (t "\\author{}\n")))
885 ;; 6. Date.
886 (let ((date (and (plist-get info :with-date) (plist-get info :date))))
887 (format "\\date{%s}\n"
888 (cond ((not date) "")
889 ;; If `:date' consists in a single timestamp and
890 ;; `:date-format' is provided, apply it.
891 ((and (plist-get info :date-format)
892 (not (cdr date))
893 (eq (org-element-type (car date)) 'timestamp))
894 (org-timestamp-format
895 (car date) (plist-get info :date-format)))
896 (t (org-export-data date info)))))
897 ;; 7. Title
898 (format "\\title{%s}\n" title)
899 ;; 8. Hyperref options.
900 (when (plist-get info :latex-hyperref-p)
901 (format "\\hypersetup{\n pdfkeywords={%s},\n pdfsubject={%s},\n pdfcreator={%s}}\n"
902 (or (plist-get info :keywords) "")
903 (or (plist-get info :description) "")
904 (if (not (plist-get info :with-creator)) ""
905 (plist-get info :creator))))
906 ;; 9. Document start.
907 "\\begin{document}\n\n"
908 ;; 10. Title command.
909 (org-element-normalize-string
910 (cond ((string= "" title) nil)
911 ((not (stringp org-latex-title-command)) nil)
912 ((string-match "\\(?:[^%]\\|^\\)%s"
913 org-latex-title-command)
914 (format org-latex-title-command title))
915 (t org-latex-title-command)))
916 ;; 11. Table of contents.
917 (let ((depth (plist-get info :with-toc)))
918 (when depth
919 (concat
920 (format "\\begin{frame}%s{%s}\n"
921 (org-beamer--normalize-argument
922 org-beamer-outline-frame-options 'option)
923 org-beamer-outline-frame-title)
924 (when (wholenump depth)
925 (format "\\setcounter{tocdepth}{%d}\n" depth))
926 "\\tableofcontents\n"
927 "\\end{frame}\n\n")))
928 ;; 12. Document's body.
929 contents
930 ;; 13. Creator.
931 (let ((creator-info (plist-get info :with-creator)))
932 (cond
933 ((not creator-info) "")
934 ((eq creator-info 'comment)
935 (format "%% %s\n" (plist-get info :creator)))
936 (t (concat (plist-get info :creator) "\n"))))
937 ;; 14. Document end.
938 "\\end{document}")))
942 ;;; Minor Mode
945 (defvar org-beamer-mode-map (make-sparse-keymap)
946 "The keymap for `org-beamer-mode'.")
947 (define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment)
949 ;;;###autoload
950 (define-minor-mode org-beamer-mode
951 "Support for editing Beamer oriented Org mode files."
952 nil " Bm" 'org-beamer-mode-map)
954 (when (fboundp 'font-lock-add-keywords)
955 (font-lock-add-keywords
956 'org-mode
957 '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
958 'prepend))
960 (defface org-beamer-tag '((t (:box (:line-width 1 :color grey40))))
961 "The special face for beamer tags."
962 :group 'org-export-beamer)
964 (defun org-beamer-property-changed (property value)
965 "Track the BEAMER_env property with tags.
966 PROPERTY is the name of the modified property. VALUE is its new
967 value."
968 (cond
969 ((equal property "BEAMER_env")
970 (save-excursion
971 (org-back-to-heading t)
972 ;; Filter out Beamer-related tags and install environment tag.
973 (let ((tags (org-remove-if (lambda (x) (string-match "^B_" x))
974 (org-get-tags)))
975 (env-tag (and (org-string-nw-p value) (concat "B_" value))))
976 (org-set-tags-to (if env-tag (cons env-tag tags) tags))
977 (when env-tag (org-toggle-tag env-tag 'on)))))
978 ((equal property "BEAMER_col")
979 (org-toggle-tag "BMCOL" (if (org-string-nw-p value) 'on 'off)))))
981 (add-hook 'org-property-changed-functions 'org-beamer-property-changed)
983 (defun org-beamer-allowed-property-values (property)
984 "Supply allowed values for PROPERTY."
985 (cond
986 ((and (equal property "BEAMER_env")
987 (not (org-entry-get nil (concat property "_ALL") 'inherit)))
988 ;; If no allowed values for BEAMER_env have been defined,
989 ;; supply all defined environments
990 (mapcar 'car (append org-beamer-environments-special
991 org-beamer-environments-extra
992 org-beamer-environments-default)))
993 ((and (equal property "BEAMER_col")
994 (not (org-entry-get nil (concat property "_ALL") 'inherit)))
995 ;; If no allowed values for BEAMER_col have been defined,
996 ;; supply some
997 (org-split-string org-beamer-column-widths " "))))
999 (add-hook 'org-property-allowed-value-functions
1000 'org-beamer-allowed-property-values)
1004 ;;; Commands
1006 ;;;###autoload
1007 (defun org-beamer-export-as-latex
1008 (&optional async subtreep visible-only body-only ext-plist)
1009 "Export current buffer as a Beamer buffer.
1011 If narrowing is active in the current buffer, only export its
1012 narrowed part.
1014 If a region is active, export that region.
1016 A non-nil optional argument ASYNC means the process should happen
1017 asynchronously. The resulting buffer should be accessible
1018 through the `org-export-stack' interface.
1020 When optional argument SUBTREEP is non-nil, export the sub-tree
1021 at point, extracting information from the headline properties
1022 first.
1024 When optional argument VISIBLE-ONLY is non-nil, don't export
1025 contents of hidden elements.
1027 When optional argument BODY-ONLY is non-nil, only write code
1028 between \"\\begin{document}\" and \"\\end{document}\".
1030 EXT-PLIST, when provided, is a property list with external
1031 parameters overriding Org default settings, but still inferior to
1032 file-local settings.
1034 Export is done in a buffer named \"*Org BEAMER Export*\", which
1035 will be displayed when `org-export-show-temporary-export-buffer'
1036 is non-nil."
1037 (interactive)
1038 (if async
1039 (org-export-async-start
1040 (lambda (output)
1041 (with-current-buffer (get-buffer-create "*Org BEAMER Export*")
1042 (erase-buffer)
1043 (insert output)
1044 (goto-char (point-min))
1045 (LaTeX-mode)
1046 (org-export-add-to-stack (current-buffer) 'beamer)))
1047 `(org-export-as 'beamer ,subtreep ,visible-only ,body-only
1048 ',ext-plist))
1049 (let ((outbuf (org-export-to-buffer
1050 'beamer "*Org BEAMER Export*"
1051 subtreep visible-only body-only ext-plist)))
1052 (with-current-buffer outbuf (LaTeX-mode))
1053 (when org-export-show-temporary-export-buffer
1054 (switch-to-buffer-other-window outbuf)))))
1056 ;;;###autoload
1057 (defun org-beamer-export-to-latex
1058 (&optional async subtreep visible-only body-only ext-plist)
1059 "Export current buffer as a Beamer presentation (tex).
1061 If narrowing is active in the current buffer, only export its
1062 narrowed part.
1064 If a region is active, export that region.
1066 A non-nil optional argument ASYNC means the process should happen
1067 asynchronously. The resulting file should be accessible through
1068 the `org-export-stack' interface.
1070 When optional argument SUBTREEP is non-nil, export the sub-tree
1071 at point, extracting information from the headline properties
1072 first.
1074 When optional argument VISIBLE-ONLY is non-nil, don't export
1075 contents of hidden elements.
1077 When optional argument BODY-ONLY is non-nil, only write code
1078 between \"\\begin{document}\" and \"\\end{document}\".
1080 EXT-PLIST, when provided, is a property list with external
1081 parameters overriding Org default settings, but still inferior to
1082 file-local settings.
1084 Return output file's name."
1085 (interactive)
1086 (let ((outfile (org-export-output-file-name ".tex" subtreep)))
1087 (if async
1088 (org-export-async-start
1089 (lambda (f) (org-export-add-to-stack f 'beamer))
1090 `(expand-file-name
1091 (org-export-to-file
1092 'beamer ,outfile ,subtreep ,visible-only ,body-only
1093 ',ext-plist)))
1094 (org-export-to-file
1095 'beamer outfile subtreep visible-only body-only ext-plist))))
1097 ;;;###autoload
1098 (defun org-beamer-export-to-pdf
1099 (&optional async subtreep visible-only body-only ext-plist)
1100 "Export current buffer as a Beamer presentation (PDF).
1102 If narrowing is active in the current buffer, only export its
1103 narrowed part.
1105 If a region is active, export that region.
1107 A non-nil optional argument ASYNC means the process should happen
1108 asynchronously. The resulting file should be accessible through
1109 the `org-export-stack' interface.
1111 When optional argument SUBTREEP is non-nil, export the sub-tree
1112 at point, extracting information from the headline properties
1113 first.
1115 When optional argument VISIBLE-ONLY is non-nil, don't export
1116 contents of hidden elements.
1118 When optional argument BODY-ONLY is non-nil, only write code
1119 between \"\\begin{document}\" and \"\\end{document}\".
1121 EXT-PLIST, when provided, is a property list with external
1122 parameters overriding Org default settings, but still inferior to
1123 file-local settings.
1125 Return PDF file's name."
1126 (interactive)
1127 (if async
1128 (let ((outfile (org-export-output-file-name ".tex" subtreep)))
1129 (org-export-async-start
1130 (lambda (f) (org-export-add-to-stack f 'beamer))
1131 `(expand-file-name
1132 (org-latex-compile
1133 (org-export-to-file
1134 'beamer ,outfile ,subtreep ,visible-only ,body-only
1135 ',ext-plist)))))
1136 (org-latex-compile
1137 (org-beamer-export-to-latex
1138 nil subtreep visible-only body-only ext-plist))))
1140 ;;;###autoload
1141 (defun org-beamer-select-environment ()
1142 "Select the environment to be used by beamer for this entry.
1143 While this uses (for convenience) a tag selection interface, the
1144 result of this command will be that the BEAMER_env *property* of
1145 the entry is set.
1147 In addition to this, the command will also set a tag as a visual
1148 aid, but the tag does not have any semantic meaning."
1149 (interactive)
1150 ;; Make sure `org-beamer-environments-special' has a higher
1151 ;; priority than `org-beamer-environments-extra'.
1152 (let* ((envs (append org-beamer-environments-special
1153 org-beamer-environments-extra
1154 org-beamer-environments-default))
1155 (org-tag-alist
1156 (append '((:startgroup))
1157 (mapcar (lambda (e) (cons (concat "B_" (car e))
1158 (string-to-char (nth 1 e))))
1159 envs)
1160 '((:endgroup))
1161 '(("BMCOL" . ?|))))
1162 (org-fast-tag-selection-single-key t))
1163 (org-set-tags)
1164 (let ((tags (or (ignore-errors (org-get-tags-string)) "")))
1165 (cond
1166 ;; For a column, automatically ask for its width.
1167 ((eq org-last-tag-selection-key ?|)
1168 (if (string-match ":BMCOL:" tags)
1169 (org-set-property "BEAMER_col" (read-string "Column width: "))
1170 (org-delete-property "BEAMER_col")))
1171 ;; For an "againframe" section, automatically ask for reference
1172 ;; to resumed frame and overlay specifications.
1173 ((eq org-last-tag-selection-key ?A)
1174 (if (equal (org-entry-get nil "BEAMER_env") "againframe")
1175 (progn (org-entry-delete nil "BEAMER_env")
1176 (org-entry-delete nil "BEAMER_ref")
1177 (org-entry-delete nil "BEAMER_act"))
1178 (org-entry-put nil "BEAMER_env" "againframe")
1179 (org-set-property
1180 "BEAMER_ref"
1181 (read-string "Frame reference (*Title, #custom-id, id:...): "))
1182 (org-set-property "BEAMER_act"
1183 (read-string "Overlay specification: "))))
1184 ((string-match (concat ":B_\\(" (mapconcat 'car envs "\\|") "\\):") tags)
1185 (org-entry-put nil "BEAMER_env" (match-string 1 tags)))
1186 (t (org-entry-delete nil "BEAMER_env"))))))
1188 ;;;###autoload
1189 (defun org-beamer-insert-options-template (&optional kind)
1190 "Insert a settings template, to make sure users do this right."
1191 (interactive (progn
1192 (message "Current [s]ubtree or [g]lobal?")
1193 (if (eq (read-char-exclusive) ?g) (list 'global)
1194 (list 'subtree))))
1195 (if (eq kind 'subtree)
1196 (progn
1197 (org-back-to-heading t)
1198 (org-reveal)
1199 (org-entry-put nil "EXPORT_LaTeX_CLASS" "beamer")
1200 (org-entry-put nil "EXPORT_LaTeX_CLASS_OPTIONS" "[presentation]")
1201 (org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf")
1202 (when org-beamer-column-view-format
1203 (org-entry-put nil "COLUMNS" org-beamer-column-view-format))
1204 (org-entry-put nil "BEAMER_col_ALL" org-beamer-column-widths))
1205 (insert "#+LaTeX_CLASS: beamer\n")
1206 (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n")
1207 (when org-beamer-theme (insert "#+BEAMER_THEME: " org-beamer-theme "\n"))
1208 (when org-beamer-column-view-format
1209 (insert "#+COLUMNS: " org-beamer-column-view-format "\n"))
1210 (insert "#+PROPERTY: BEAMER_col_ALL " org-beamer-column-widths "\n")))
1212 ;;;###autoload
1213 (defun org-beamer-publish-to-latex (plist filename pub-dir)
1214 "Publish an Org file to a Beamer presentation (LaTeX).
1216 FILENAME is the filename of the Org file to be published. PLIST
1217 is the property list for the given project. PUB-DIR is the
1218 publishing directory.
1220 Return output file name."
1221 (org-publish-org-to 'beamer filename ".tex" plist pub-dir))
1223 ;;;###autoload
1224 (defun org-beamer-publish-to-pdf (plist filename pub-dir)
1225 "Publish an Org file to a Beamer presentation (PDF, via LaTeX).
1227 FILENAME is the filename of the Org file to be published. PLIST
1228 is the property list for the given project. PUB-DIR is the
1229 publishing directory.
1231 Return output file name."
1232 ;; Unlike to `org-beamer-publish-to-latex', PDF file is generated in
1233 ;; working directory and then moved to publishing directory.
1234 (org-publish-attachment
1235 plist
1236 (org-latex-compile (org-publish-org-to 'beamer filename ".tex" plist))
1237 pub-dir))
1240 (provide 'ox-beamer)
1242 ;; Local variables:
1243 ;; generated-autoload-file: "org-loaddefs.el"
1244 ;; End:
1246 ;;; ox-beamer.el ends here