diff options
Diffstat (limited to 'lisp/ox-beamer.el')
-rw-r--r-- | lisp/ox-beamer.el | 117 |
1 files changed, 26 insertions, 91 deletions
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index a975d24..2868944 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -1,11 +1,13 @@ ;;; ox-beamer.el --- Beamer Back-End for Org Export Engine -;; Copyright (C) 2007-2013 Free Software Foundation, Inc. +;; Copyright (C) 2007-2013 Free Software Foundation, Inc. ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com> ;; Nicolas Goaziou <n.goaziou AT gmail DOT com> ;; Keywords: org, wp, tex +;; This file is part of GNU Emacs. + ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or @@ -23,93 +25,7 @@ ;; ;; This library implements both a Beamer back-end, derived from the ;; LaTeX one and a minor mode easing structure edition of the -;; document. -;; -;; Depending on the desired output format, three commands are provided -;; for export: `org-beamer-export-as-latex' (temporary buffer), -;; `org-beamer-export-to-latex' ("tex" file) and -;; `org-beamer-export-to-pdf' ("pdf" file). -;; -;; This back-end supports every buffer keyword, attribute and options -;; items (see `org-latex-options-alist') already supported by `latex' -;; back-end. As such, it is suggested to add an entry in -;; `org-latex-classes' variable which is appropriate for Beamer -;; export. -;; -;; On top of this, the `beamer' back-end also introduces the following -;; keywords: "BEAMER_THEME", "BEAMER_COLOR_THEME", -;; "BEAMER_FONT_THEME", "BEAMER_INNER_THEME", "BEAMER_OUTER_THEME" and -;; "BEAMER_HEADER". All but the latter accept options in square -;; brackets. -;; -;; Moreover, headlines now fall into three categories: sectioning -;; elements, frames and blocks. -;; -;; - Headlines become frames when their level is equal to -;; `org-beamer-frame-level' (or "H" value in the OPTIONS line). -;; Though, if a headline in the current tree has a "BEAMER_env" -;; (see below) property set to either "frame" or "fullframe", its -;; level overrides the variable. A "fullframe" is a frame with an -;; empty (ignored) title. -;; -;; - All frames' children become block environments. Special block -;; types can be enforced by setting headline's "BEAMER_env" property -;; to an appropriate value (see `org-beamer-environments-default' -;; for supported value and `org-beamer-environments-extra' for -;; adding more). -;; -;; - As a special case, if the "BEAMER_env" property is set to either -;; "appendix", "note", "noteNH" or "againframe", the headline will -;; become, respectively, an appendix, a note (within frame or -;; between frame, depending on its level), a note with its title -;; ignored or an againframe command. In the latter case, -;; a "BEAMER_ref" property is mandatory in order to refer to the -;; frame being resumed, and contents are ignored. -;; -;; Also, a headline with an "ignoreheading" environment will have -;; its contents only inserted in the output. This special value is -;; useful to have data between frames, or to properly close -;; a "column" environment. -;; -;; Along with "BEAMER_env", headlines also support the "BEAMER_act" -;; and "BEAMER_opt" properties. The former is translated as an -;; overlay/action specification (or a default overlay specification -;; when enclosed within square brackets) whereas the latter specifies -;; options for the current frame ("fragile" option is added -;; automatically, though). -;; -;; Moreover, headlines handle the "BEAMER_col" property. Its value -;; should be a decimal number representing the width of the column as -;; a fraction of the total text width. If the headline has no -;; specific environment, its title will be ignored and its contents -;; will fill the column created. Otherwise, the block will fill the -;; whole column and the title will be preserved. Two contiguous -;; headlines with a non-nil "BEAMER_col" value share the same -;; "columns" LaTeX environment. It will end before the next headline -;; without such a property. This environment is generated -;; automatically. Although, it can also be explicitly created, with -;; a special "columns" value for "BEAMER_env" property (if it needs to -;; be set up with some specific options, for example). -;; -;; Every plain list has support for `:environment', `:overlay' and -;; `:options' attributes (through ATTR_BEAMER affiliated keyword). -;; The first one allows to use a different environment, the second -;; sets overlay specifications and the last one inserts optional -;; arguments in current list environment. -;; -;; Table of contents generated from "toc:t" option item are wrapped -;; within a "frame" environment. Those generated from a TOC keyword -;; aren't. TOC keywords accept options enclosed within square -;; brackets (e.g. #+TOC: headlines [currentsection]). -;; -;; Eventually, an export snippet with a value enclosed within angular -;; brackets put at the beginning of an element or object whose type is -;; among `bold', `item', `link', `radio-target' and `target' will -;; control its overlay specifications. -;; -;; On the minor mode side, `org-beamer-select-environment' (bound by -;; default to "C-c C-b") and `org-beamer-insert-options-template' are -;; the two entry points. +;; document. See Org manual for more information. ;;; Code: @@ -444,13 +360,32 @@ INFO is a plist used as a communication channel." "Format HEADLINE as a sectioning part. CONTENTS holds the contents of the headline. INFO is a plist used as a communication channel." - ;; Use `latex' back-end output, inserting overlay specifications - ;; if possible. - (let ((latex-headline (org-export-with-backend 'latex headline contents info)) + (let ((latex-headline + (org-export-with-backend + ;; We create a temporary export back-end which behaves the + ;; same as current one, but adds "\protect" in front of the + ;; output of some objects. + (org-export-create-backend + :parent 'latex + :transcoders + (let ((protected-output + (function + (lambda (object contents info) + (let ((code (org-export-with-backend + 'beamer object contents info))) + (if (org-string-nw-p code) (concat "\\protect" code) + code)))))) + (mapcar #'(lambda (type) (cons type protected-output)) + '(bold footnote-reference italic strike-through timestamp + underline)))) + headline + contents + info)) (mode-specs (org-element-property :BEAMER_ACT headline))) (if (and mode-specs (string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{" latex-headline)) + ;; Insert overlay specifications. (replace-match (concat (match-string 1 latex-headline) (format "<%s>" mode-specs)) nil nil latex-headline 1) |