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