2013-01-27 22:11:34 +00:00
|
|
|
|
;;; ox-beamer.el --- Beamer Back-End for Org Export Engine
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-01 15:04:24 +00:00
|
|
|
|
;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
|
|
|
|
|
;; Nicolas Goaziou <n.goaziou AT gmail DOT com>
|
|
|
|
|
;; Keywords: org, wp, tex
|
|
|
|
|
|
|
|
|
|
;; 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
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
|
|
|
|
;; 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
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; for export: `org-beamer-export-as-latex' (temporary buffer),
|
|
|
|
|
;; `org-beamer-export-to-latex' ("tex" file) and
|
|
|
|
|
;; `org-beamer-export-to-pdf' ("pdf" file).
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; 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",
|
2013-02-08 21:38:47 +00:00
|
|
|
|
;; "BEAMER_FONT_THEME", "BEAMER_INNER_THEME", "BEAMER_OUTER_THEME" and
|
|
|
|
|
;; "BEAMER_HEADER". All but the latter accept options in square
|
|
|
|
|
;; brackets.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Moreover, headlines now fall into three categories: sectioning
|
|
|
|
|
;; elements, frames and blocks.
|
|
|
|
|
;;
|
|
|
|
|
;; - Headlines become frames when their level is equal to
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-beamer-frame-level' (or "H" value in the OPTIONS line).
|
2013-02-23 12:47:44 +00:00
|
|
|
|
;; Though, if a headline in the current tree has a "BEAMER_env"
|
2012-11-17 20:47:04 +00:00
|
|
|
|
;; (see below) property set to either "frame" or "fullframe", its
|
|
|
|
|
;; level overrides the variable. A "fullframe" is a frame with an
|
|
|
|
|
;; empty (ignored) title.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;;
|
|
|
|
|
;; - All frames' children become block environments. Special block
|
|
|
|
|
;; types can be enforced by setting headline's "BEAMER_env" property
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; to an appropriate value (see `org-beamer-environments-default'
|
|
|
|
|
;; for supported value and `org-beamer-environments-extra' for
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; adding more).
|
|
|
|
|
;;
|
|
|
|
|
;; - As a special case, if the "BEAMER_env" property is set to either
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; "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.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;;
|
2013-02-23 12:47:44 +00:00
|
|
|
|
;; Also, a headline with an "ignoreheading" environment will have
|
2013-02-07 14:03:11 +00:00
|
|
|
|
;; its contents only inserted in the output. This special value is
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; useful to have data between frames, or to properly close
|
|
|
|
|
;; a "column" environment.
|
|
|
|
|
;;
|
2013-02-07 14:03:11 +00:00
|
|
|
|
;; Along with "BEAMER_env", headlines also support the "BEAMER_act"
|
|
|
|
|
;; and "BEAMER_opt" properties. The former is translated as an
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; 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).
|
|
|
|
|
;;
|
2013-02-07 14:03:11 +00:00
|
|
|
|
;; 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).
|
|
|
|
|
;;
|
2012-11-27 20:04:05 +00:00
|
|
|
|
;; 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.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;;
|
2013-03-06 12:33:51 +00:00
|
|
|
|
;; 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]).
|
|
|
|
|
;;
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; 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.
|
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; 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.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2013-02-09 17:25:57 +00:00
|
|
|
|
(eval-when-compile (require 'cl))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(require 'ox-latex)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; User-Configurable Variables
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defgroup org-export-beamer nil
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Options specific for using the beamer class in LaTeX export."
|
|
|
|
|
:tag "Org Beamer"
|
2012-07-06 22:51:02 +00:00
|
|
|
|
:group 'org-export
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:version "24.2")
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-beamer-frame-level 1
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"The level at which headlines become frames.
|
|
|
|
|
|
|
|
|
|
Headlines at a lower level will be translated into a sectioning
|
|
|
|
|
structure. At a higher level, they will be translated into
|
|
|
|
|
blocks.
|
|
|
|
|
|
2013-02-23 12:47:44 +00:00
|
|
|
|
If a headline with a \"BEAMER_env\" property set to \"frame\" is
|
2012-06-30 11:54:43 +00:00
|
|
|
|
found within a tree, its level locally overrides this number.
|
|
|
|
|
|
|
|
|
|
This variable has no effect on headlines with the \"BEAMER_env\"
|
|
|
|
|
property set to either \"ignoreheading\", \"appendix\", or
|
|
|
|
|
\"note\", which will respectively, be invisible, become an
|
|
|
|
|
appendix or a note.
|
|
|
|
|
|
2013-02-23 12:47:44 +00:00
|
|
|
|
This integer is relative to the minimal level of a headline
|
2012-06-30 11:54:43 +00:00
|
|
|
|
within the parse tree, defined as 1."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:type 'integer)
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-beamer-frame-default-options ""
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Default options string to use for frames.
|
|
|
|
|
For example, it could be set to \"allowframebreaks\"."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:type '(string :tag "[options]"))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-beamer-column-view-format
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"%45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act) %4BEAMER_col(Col) %8BEAMER_opt(Opt)"
|
|
|
|
|
"Column view format that should be used to fill the template."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Do not insert Beamer column view format" nil)
|
|
|
|
|
(string :tag "Beamer column view format")))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-beamer-theme "default"
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Default theme used in Beamer presentations."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Do not insert a Beamer theme" nil)
|
|
|
|
|
(string :tag "Beamer theme")))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-beamer-environments-extra nil
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Environments triggered by tags in Beamer export.
|
|
|
|
|
Each entry has 4 elements:
|
|
|
|
|
|
|
|
|
|
name Name of the environment
|
2013-01-27 22:11:34 +00:00
|
|
|
|
key Selection key for `org-beamer-select-environment'
|
2012-06-30 11:54:43 +00:00
|
|
|
|
open The opening template for the environment, with the following escapes
|
|
|
|
|
%a the action/overlay specification
|
|
|
|
|
%A the default action/overlay specification
|
|
|
|
|
%o the options argument of the template
|
|
|
|
|
%h the headline text
|
|
|
|
|
%H if there is headline text, that text in {} braces
|
|
|
|
|
%U if there is headline text, that text in [] brackets
|
|
|
|
|
close The closing string of the environment."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:type '(repeat
|
|
|
|
|
(list
|
|
|
|
|
(string :tag "Environment")
|
|
|
|
|
(string :tag "Selection key")
|
|
|
|
|
(string :tag "Begin")
|
|
|
|
|
(string :tag "End"))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-beamer-outline-frame-title "Outline"
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Default title of a frame containing an outline."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:type '(string :tag "Outline frame title"))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defcustom org-beamer-outline-frame-options ""
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Outline frame options appended after \\begin{frame}.
|
|
|
|
|
You might want to put e.g. \"allowframebreaks=0.9\" here."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:type '(string :tag "Outline frame options"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Internal Variables
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defconst org-beamer-column-widths
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
|
|
|
|
|
"The column widths that should be installed as allowed property values.")
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defconst org-beamer-environments-special
|
2012-11-17 20:47:04 +00:00
|
|
|
|
'(("againframe" "A")
|
2012-09-04 09:07:56 +00:00
|
|
|
|
("appendix" "x")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
("column" "c")
|
2012-11-17 20:17:19 +00:00
|
|
|
|
("columns" "C")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
("frame" "f")
|
2012-11-17 20:47:04 +00:00
|
|
|
|
("fullframe" "F")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
("ignoreheading" "i")
|
|
|
|
|
("note" "n")
|
|
|
|
|
("noteNH" "N"))
|
|
|
|
|
"Alist of environments treated in a special way by the back-end.
|
|
|
|
|
Keys are environment names, as strings, values are bindings used
|
2013-01-27 22:11:34 +00:00
|
|
|
|
in `org-beamer-select-environment'. Environments listed here,
|
2012-06-30 11:54:43 +00:00
|
|
|
|
along with their binding, are hard coded and cannot be modified
|
2013-01-27 22:11:34 +00:00
|
|
|
|
through `org-beamer-environments-extra' variable.")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defconst org-beamer-environments-default
|
2012-06-30 11:54:43 +00:00
|
|
|
|
'(("block" "b" "\\begin{block}%a{%h}" "\\end{block}")
|
|
|
|
|
("alertblock" "a" "\\begin{alertblock}%a{%h}" "\\end{alertblock}")
|
|
|
|
|
("verse" "v" "\\begin{verse}%a %% %h" "\\end{verse}")
|
|
|
|
|
("quotation" "q" "\\begin{quotation}%a %% %h" "\\end{quotation}")
|
|
|
|
|
("quote" "Q" "\\begin{quote}%a %% %h" "\\end{quote}")
|
|
|
|
|
("structureenv" "s" "\\begin{structureenv}%a %% %h" "\\end{structureenv}")
|
|
|
|
|
("theorem" "t" "\\begin{theorem}%a%U" "\\end{theorem}")
|
|
|
|
|
("definition" "d" "\\begin{definition}%a%U" "\\end{definition}")
|
|
|
|
|
("example" "e" "\\begin{example}%a%U" "\\end{example}")
|
|
|
|
|
("exampleblock" "E" "\\begin{exampleblock}%a{%h}" "\\end{exampleblock}")
|
|
|
|
|
("proof" "p" "\\begin{proof}%a%U" "\\end{proof}")
|
|
|
|
|
("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}" "\\end{beamercolorbox}"))
|
|
|
|
|
"Environments triggered by properties in Beamer export.
|
|
|
|
|
These are the defaults - for user definitions, see
|
2013-01-27 22:11:34 +00:00
|
|
|
|
`org-beamer-environments-extra'.")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defconst org-beamer-verbatim-elements
|
2012-06-30 11:54:43 +00:00
|
|
|
|
'(code example-block fixed-width inline-src-block src-block verbatim)
|
|
|
|
|
"List of element or object types producing verbatim text.
|
|
|
|
|
This is used internally to determine when a frame should have the
|
|
|
|
|
\"fragile\" option.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Internal functions
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer--normalize-argument (argument type)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Return ARGUMENT string with proper boundaries.
|
|
|
|
|
|
|
|
|
|
TYPE is a symbol among the following:
|
|
|
|
|
`action' Return ARGUMENT within angular brackets.
|
|
|
|
|
`defaction' Return ARGUMENT within both square and angular brackets.
|
|
|
|
|
`option' Return ARGUMENT within square brackets."
|
2012-08-22 15:45:18 +00:00
|
|
|
|
(if (not (string-match "\\S-" argument)) ""
|
|
|
|
|
(case type
|
|
|
|
|
(action (if (string-match "\\`<.*>\\'" argument) argument
|
|
|
|
|
(format "<%s>" argument)))
|
|
|
|
|
(defaction (cond
|
|
|
|
|
((string-match "\\`\\[<.*>\\]\\'" argument) argument)
|
|
|
|
|
((string-match "\\`<.*>\\'" argument)
|
|
|
|
|
(format "[%s]" argument))
|
|
|
|
|
((string-match "\\`\\[\\(.*\\)\\]\\'" argument)
|
|
|
|
|
(format "[<%s>]" (match-string 1 argument)))
|
|
|
|
|
(t (format "[<%s>]" argument))))
|
|
|
|
|
(option (if (string-match "\\`\\[.*\\]\\'" argument) argument
|
|
|
|
|
(format "[%s]" argument)))
|
|
|
|
|
(otherwise argument))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer--element-has-overlay-p (element)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Non-nil when ELEMENT has an overlay specified.
|
|
|
|
|
An element has an overlay specification when it starts with an
|
2013-01-27 22:11:34 +00:00
|
|
|
|
`beamer' export-snippet whose value is between angular brackets.
|
|
|
|
|
Return overlay specification, as a string, or nil."
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(let ((first-object (car (org-element-contents element))))
|
|
|
|
|
(when (eq (org-element-type first-object) 'export-snippet)
|
|
|
|
|
(let ((value (org-element-property :value first-object)))
|
|
|
|
|
(and (string-match "\\`<.*>\\'" value) value)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Define Back-End
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-export-define-derived-backend beamer latex
|
2012-07-23 12:07:16 +00:00
|
|
|
|
:export-block "BEAMER"
|
org-export: Internal changes to back-end definition
* contrib/lisp/org-export.el (org-export-registered-backends): New
variable.
(org-export-define-backend, org-export-define-derived-backend): Use
new variable. Also redefine how sub-menus are defined.
(org-export-backend-filters, org-export-backend-menu,
org-export-backend-options, org-export-backend-translate-table): New
functions.
(org-export-get-environment, org-export--parse-option-keyword,
org-export--get-subtree-options, org-export--get-inbuffer-options,
org-export--get-global-options, org-export-install-filters,
org-export-with-backend): Access to data stored in new variable.
(org-export-dispatch-ui): Display sub-menus according to new
definition.
(org-export-dispatch-menu-entries): Removed variable.
* contrib/lisp/org-e-beamer.el: Use new sub-menu definition.
(org-e-beamer--format-section, org-e-beamer-item,
org-e-beamer-keyword): Use `org-export-with-backend' instead of
relying on removed variables.
* testing/lisp/test-org-export.el: Update tests.
This patch gets rid of "invisible" variables, that is variables
defvar'ed within a macro.
2012-11-12 22:21:05 +00:00
|
|
|
|
:menu-entry
|
|
|
|
|
(?l 1
|
2013-02-08 21:36:07 +00:00
|
|
|
|
((?B "As LaTeX buffer (Beamer)" org-beamer-export-as-latex)
|
|
|
|
|
(?b "As LaTeX file (Beamer)" org-beamer-export-to-latex)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(?P "As PDF file (Beamer)" org-beamer-export-to-pdf)
|
org-export: Internal changes to back-end definition
* contrib/lisp/org-export.el (org-export-registered-backends): New
variable.
(org-export-define-backend, org-export-define-derived-backend): Use
new variable. Also redefine how sub-menus are defined.
(org-export-backend-filters, org-export-backend-menu,
org-export-backend-options, org-export-backend-translate-table): New
functions.
(org-export-get-environment, org-export--parse-option-keyword,
org-export--get-subtree-options, org-export--get-inbuffer-options,
org-export--get-global-options, org-export-install-filters,
org-export-with-backend): Access to data stored in new variable.
(org-export-dispatch-ui): Display sub-menus according to new
definition.
(org-export-dispatch-menu-entries): Removed variable.
* contrib/lisp/org-e-beamer.el: Use new sub-menu definition.
(org-e-beamer--format-section, org-e-beamer-item,
org-e-beamer-keyword): Use `org-export-with-backend' instead of
relying on removed variables.
* testing/lisp/test-org-export.el: Update tests.
This patch gets rid of "invisible" variables, that is variables
defvar'ed within a macro.
2012-11-12 22:21:05 +00:00
|
|
|
|
(?O "As PDF file and open (Beamer)"
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(lambda (a s v b)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(if a (org-beamer-export-to-pdf t s v b)
|
|
|
|
|
(org-open-file (org-beamer-export-to-pdf nil s v b)))))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
:options-alist
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((:beamer-theme "BEAMER_THEME" nil org-beamer-theme)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t)
|
|
|
|
|
(:beamer-font-theme "BEAMER_FONT_THEME" nil nil t)
|
|
|
|
|
(:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t)
|
|
|
|
|
(:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t)
|
2013-02-08 21:38:47 +00:00
|
|
|
|
(:beamer-header-extra "BEAMER_HEADER" nil nil newline)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(:headline-levels nil "H" org-beamer-frame-level))
|
|
|
|
|
:translate-alist ((bold . org-beamer-bold)
|
|
|
|
|
(export-block . org-beamer-export-block)
|
|
|
|
|
(export-snippet . org-beamer-export-snippet)
|
|
|
|
|
(headline . org-beamer-headline)
|
|
|
|
|
(item . org-beamer-item)
|
|
|
|
|
(keyword . org-beamer-keyword)
|
|
|
|
|
(link . org-beamer-link)
|
|
|
|
|
(plain-list . org-beamer-plain-list)
|
|
|
|
|
(radio-target . org-beamer-radio-target)
|
|
|
|
|
(target . org-beamer-target)
|
|
|
|
|
(template . org-beamer-template)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Transcode Functions
|
|
|
|
|
|
|
|
|
|
;;;; Bold
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-bold (bold contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode BLOCK object into Beamer code.
|
|
|
|
|
CONTENTS is the text being bold. INFO is a plist used as
|
|
|
|
|
a communication channel."
|
|
|
|
|
(format "\\alert%s{%s}"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(or (org-beamer--element-has-overlay-p bold) "")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
contents))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Export Block
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-export-block (export-block contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode an EXPORT-BLOCK element into Beamer code.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
|
|
|
|
(when (member (org-element-property :type export-block) '("BEAMER" "LATEX"))
|
|
|
|
|
(org-remove-indentation (org-element-property :value export-block))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Export Snippet
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-export-snippet (export-snippet contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode an EXPORT-SNIPPET object into Beamer code.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
|
|
|
|
(let ((backend (org-export-snippet-backend export-snippet))
|
|
|
|
|
(value (org-element-property :value export-snippet)))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; Only "latex" and "beamer" snippets are retained.
|
|
|
|
|
(cond ((eq backend 'latex) value)
|
|
|
|
|
;; Ignore "beamer" snippets specifying overlays.
|
|
|
|
|
((and (eq backend 'beamer)
|
2012-07-27 14:13:57 +00:00
|
|
|
|
(or (org-export-get-previous-element export-snippet info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(not (string-match "\\`<.*>\\'" value))))
|
|
|
|
|
value))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Headline
|
|
|
|
|
;;
|
2013-02-23 12:47:44 +00:00
|
|
|
|
;; The main function to translate a headline is
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-beamer-headline'.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;;
|
2013-02-23 12:47:44 +00:00
|
|
|
|
;; Depending on the level at which a headline is considered as
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; a frame (given by `org-beamer--frame-level'), the headline is
|
|
|
|
|
;; either a section (`org-beamer--format-section'), a frame
|
|
|
|
|
;; (`org-beamer--format-frame') or a block
|
|
|
|
|
;; (`org-beamer--format-block').
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-beamer-headline' also takes care of special environments
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; like "ignoreheading", "note", "noteNH", "appendix" and
|
|
|
|
|
;; "againframe".
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer--get-label (headline info)
|
2012-09-04 13:03:17 +00:00
|
|
|
|
"Return label for HEADLINE, as a string.
|
|
|
|
|
|
|
|
|
|
INFO is a plist used as a communication channel.
|
|
|
|
|
|
|
|
|
|
The value is either the label specified in \"BEAMER_opt\"
|
|
|
|
|
property, or a fallback value built from headline's number. This
|
|
|
|
|
function assumes HEADLINE will be treated as a frame."
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((opt (org-element-property :BEAMER_OPT headline)))
|
2012-09-04 13:03:17 +00:00
|
|
|
|
(if (and (org-string-nw-p opt)
|
|
|
|
|
(string-match "\\(?:^\\|,\\)label=\\(.*?\\)\\(?:$\\|,\\)" opt))
|
|
|
|
|
(match-string 1 opt)
|
|
|
|
|
(format "sec-%s"
|
|
|
|
|
(mapconcat 'number-to-string
|
|
|
|
|
(org-export-get-headline-number headline info)
|
|
|
|
|
"-")))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer--frame-level (headline info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Return frame level in subtree containing HEADLINE.
|
|
|
|
|
INFO is a plist used as a communication channel."
|
|
|
|
|
(or
|
|
|
|
|
;; 1. Look for "frame" environment in parents, starting from the
|
|
|
|
|
;; farthest.
|
|
|
|
|
(catch 'exit
|
|
|
|
|
(mapc (lambda (parent)
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((env (org-element-property :BEAMER_ENV parent)))
|
2012-11-17 20:47:04 +00:00
|
|
|
|
(when (and env (member (downcase env) '("frame" "fullframe")))
|
|
|
|
|
(throw 'exit (org-export-get-relative-level parent info)))))
|
|
|
|
|
(nreverse (org-export-get-genealogy headline)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
nil)
|
|
|
|
|
;; 2. Look for "frame" environment in HEADLINE.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((env (org-element-property :BEAMER_ENV headline)))
|
2012-11-17 20:47:04 +00:00
|
|
|
|
(and env (member (downcase env) '("frame" "fullframe"))
|
|
|
|
|
(org-export-get-relative-level headline info)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; 3. Look for "frame" environment in sub-tree.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-element-map headline 'headline
|
|
|
|
|
(lambda (hl)
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((env (org-element-property :BEAMER_ENV hl)))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(when (and env (member (downcase env) '("frame" "fullframe")))
|
|
|
|
|
(org-export-get-relative-level hl info))))
|
|
|
|
|
info 'first-match)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; 4. No "frame" environment in tree: use default value.
|
|
|
|
|
(plist-get info :headline-levels)))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer--format-section (headline contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Format HEADLINE as a sectioning part.
|
|
|
|
|
CONTENTS holds the contents of the headline. INFO is a plist
|
|
|
|
|
used as a communication channel."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; Use `latex' back-end output, inserting overlay specifications
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; if possible.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let ((latex-headline (org-export-with-backend 'latex headline contents info))
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(mode-specs (org-element-property :BEAMER_ACT headline)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(if (and mode-specs
|
|
|
|
|
(string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{"
|
|
|
|
|
latex-headline))
|
|
|
|
|
(replace-match (concat (match-string 1 latex-headline)
|
|
|
|
|
(format "<%s>" mode-specs))
|
|
|
|
|
nil nil latex-headline 1)
|
|
|
|
|
latex-headline)))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer--format-frame (headline contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Format HEADLINE as a frame.
|
|
|
|
|
CONTENTS holds the contents of the headline. INFO is a plist
|
|
|
|
|
used as a communication channel."
|
2012-08-12 16:24:34 +00:00
|
|
|
|
(let ((fragilep
|
|
|
|
|
;; FRAGILEP is non-nil when HEADLINE contains an element
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; among `org-beamer-verbatim-elements'.
|
|
|
|
|
(org-element-map headline org-beamer-verbatim-elements 'identity
|
2012-08-12 16:24:34 +00:00
|
|
|
|
info 'first-match)))
|
|
|
|
|
(concat "\\begin{frame}"
|
2012-09-04 06:23:29 +00:00
|
|
|
|
;; Overlay specification, if any. When surrounded by
|
|
|
|
|
;; square brackets, consider it as a default
|
|
|
|
|
;; specification.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((action (org-element-property :BEAMER_ACT headline)))
|
2012-08-12 16:24:34 +00:00
|
|
|
|
(cond
|
|
|
|
|
((not action) "")
|
|
|
|
|
((string-match "\\`\\[.*\\]\\'" action )
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument action 'defaction))
|
|
|
|
|
(t (org-beamer--normalize-argument action 'action))))
|
2012-08-12 16:24:34 +00:00
|
|
|
|
;; Options, if any.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let* ((beamer-opt (org-element-property :BEAMER_OPT headline))
|
2012-09-04 06:23:29 +00:00
|
|
|
|
(options
|
|
|
|
|
;; Collect options from default value and headline's
|
|
|
|
|
;; properties. Also add a label for links.
|
|
|
|
|
(append
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-split-string org-beamer-frame-default-options ",")
|
2012-09-04 06:23:29 +00:00
|
|
|
|
(and beamer-opt
|
|
|
|
|
(org-split-string
|
|
|
|
|
;; Remove square brackets if user provided
|
|
|
|
|
;; them.
|
|
|
|
|
(and (string-match "^\\[?\\(.*\\)\\]?$" beamer-opt)
|
|
|
|
|
(match-string 1 beamer-opt))
|
|
|
|
|
","))
|
|
|
|
|
;; Provide an automatic label for the frame
|
|
|
|
|
;; unless the user specified one.
|
|
|
|
|
(unless (and beamer-opt
|
|
|
|
|
(string-match "\\(^\\|,\\)label=" beamer-opt))
|
|
|
|
|
(list
|
2012-09-04 13:03:17 +00:00
|
|
|
|
(format "label=%s"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--get-label headline info)))))))
|
2012-08-12 16:24:34 +00:00
|
|
|
|
;; Change options list into a string.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(mapconcat
|
|
|
|
|
'identity
|
|
|
|
|
(if (or (not fragilep) (member "fragile" options)) options
|
|
|
|
|
(cons "fragile" options))
|
|
|
|
|
",")
|
2012-08-12 16:24:34 +00:00
|
|
|
|
'option))
|
|
|
|
|
;; Title.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((env (org-element-property :BEAMER_ENV headline)))
|
2012-11-17 20:47:04 +00:00
|
|
|
|
(format "{%s}"
|
|
|
|
|
(if (and env (equal (downcase env) "fullframe")) ""
|
|
|
|
|
(org-export-data
|
|
|
|
|
(org-element-property :title headline) info))))
|
2012-08-12 16:24:34 +00:00
|
|
|
|
"\n"
|
|
|
|
|
;; The following workaround is required in fragile frames
|
|
|
|
|
;; as Beamer will append "\par" to the beginning of the
|
|
|
|
|
;; contents. So we need to make sure the command is
|
|
|
|
|
;; separated from the contents by at least one space. If
|
|
|
|
|
;; it isn't, it will create "\parfirst-word" command and
|
|
|
|
|
;; remove the first word from the contents in the PDF
|
|
|
|
|
;; output.
|
|
|
|
|
(if (not fragilep) contents
|
|
|
|
|
(replace-regexp-in-string "\\`\n*" "\\& " contents))
|
|
|
|
|
"\\end{frame}")))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer--format-block (headline contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Format HEADLINE as a block.
|
|
|
|
|
CONTENTS holds the contents of the headline. INFO is a plist
|
|
|
|
|
used as a communication channel."
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let* ((column-width (org-element-property :BEAMER_COL headline))
|
2012-11-17 20:17:19 +00:00
|
|
|
|
;; ENVIRONMENT defaults to "block" if none is specified and
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; there is no column specification. If there is a column
|
|
|
|
|
;; specified but still no explicit environment, ENVIRONMENT
|
2012-11-17 20:17:19 +00:00
|
|
|
|
;; is "column".
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(environment (let ((env (org-element-property :BEAMER_ENV headline)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(cond
|
|
|
|
|
;; "block" is the fallback environment.
|
|
|
|
|
((and (not env) (not column-width)) "block")
|
|
|
|
|
;; "column" only.
|
2012-11-17 20:17:19 +00:00
|
|
|
|
((not env) "column")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; Use specified environment.
|
|
|
|
|
(t (downcase env)))))
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(env-format (unless (member environment '("column" "columns"))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(assoc environment
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(append org-beamer-environments-special
|
|
|
|
|
org-beamer-environments-extra
|
|
|
|
|
org-beamer-environments-default))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(title (org-export-data (org-element-property :title headline) info))
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(options (let ((options (org-element-property :BEAMER_OPT headline)))
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(if (not options) ""
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument options 'option))))
|
2012-11-17 20:17:19 +00:00
|
|
|
|
;; Start a "columns" environment when explicitly requested or
|
|
|
|
|
;; when there is no previous headline or the previous
|
|
|
|
|
;; headline do not have a BEAMER_column property.
|
|
|
|
|
(parent-env (org-element-property
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
:BEAMER_ENV (org-export-get-parent-headline headline)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(start-columns-p
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(or (equal environment "columns")
|
|
|
|
|
(and column-width
|
|
|
|
|
(not (and parent-env
|
|
|
|
|
(equal (downcase parent-env) "columns")))
|
|
|
|
|
(or (org-export-first-sibling-p headline info)
|
|
|
|
|
(not (org-element-property
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
:BEAMER_COL
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(org-export-get-previous-element
|
|
|
|
|
headline info)))))))
|
|
|
|
|
;; End the "columns" environment when explicitly requested or
|
|
|
|
|
;; when there is no next headline or the next headline do not
|
|
|
|
|
;; have a BEAMER_column property.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(end-columns-p
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(or (equal environment "columns")
|
|
|
|
|
(and column-width
|
|
|
|
|
(not (and parent-env
|
|
|
|
|
(equal (downcase parent-env) "columns")))
|
|
|
|
|
(or (org-export-last-sibling-p headline info)
|
|
|
|
|
(not (org-element-property
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
:BEAMER_COL
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(org-export-get-next-element headline info))))))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(concat
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(when start-columns-p
|
|
|
|
|
;; Column can accept options only when the environment is
|
|
|
|
|
;; explicitly defined.
|
|
|
|
|
(if (not (equal environment "columns")) "\\begin{columns}\n"
|
|
|
|
|
(format "\\begin{columns}%s\n" options)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(when column-width
|
|
|
|
|
(format "\\begin{column}%s{%s}\n"
|
|
|
|
|
;; One can specify placement for column only when
|
|
|
|
|
;; HEADLINE stands for a column on its own.
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(if (equal environment "column") options "")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(format "%s\\textwidth" column-width)))
|
|
|
|
|
;; Block's opening string.
|
|
|
|
|
(when env-format
|
|
|
|
|
(concat
|
|
|
|
|
(org-fill-template
|
|
|
|
|
(nth 2 env-format)
|
|
|
|
|
(nconc
|
|
|
|
|
;; If BEAMER_act property has its value enclosed in square
|
|
|
|
|
;; brackets, it is a default overlay specification and
|
|
|
|
|
;; overlay specification is empty. Otherwise, it is an
|
|
|
|
|
;; overlay specification and the default one is nil.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((action (org-element-property :BEAMER_ACT headline)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(cond
|
|
|
|
|
((not action) (list (cons "a" "") (cons "A" "")))
|
|
|
|
|
((string-match "\\`\\[.*\\]\\'" action)
|
|
|
|
|
(list
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(cons "A" (org-beamer--normalize-argument action 'defaction))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(cons "a" "")))
|
|
|
|
|
(t
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(list (cons "a" (org-beamer--normalize-argument action 'action))
|
2012-11-17 20:17:19 +00:00
|
|
|
|
(cons "A" "")))))
|
|
|
|
|
(list (cons "o" options)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(cons "h" title)
|
|
|
|
|
(cons "H" (if (equal title "") "" (format "{%s}" title)))
|
|
|
|
|
(cons "U" (if (equal title "") "" (format "[%s]" title))))))
|
|
|
|
|
"\n"))
|
|
|
|
|
contents
|
|
|
|
|
;; Block's closing string.
|
|
|
|
|
(when environment (concat (nth 3 env-format) "\n"))
|
|
|
|
|
(when column-width "\\end{column}\n")
|
|
|
|
|
(when end-columns-p "\\end{columns}"))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-headline (headline contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode HEADLINE element into Beamer code.
|
|
|
|
|
CONTENTS is the contents of the headline. INFO is a plist used
|
|
|
|
|
as a communication channel."
|
|
|
|
|
(unless (org-element-property :footnote-section-p headline)
|
|
|
|
|
(let ((level (org-export-get-relative-level headline info))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(frame-level (org-beamer--frame-level headline info))
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(environment (let ((env (org-element-property :BEAMER_ENV headline)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(if (stringp env) (downcase env) "block"))))
|
|
|
|
|
(cond
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; Case 1: Resume frame specified by "BEAMER_ref" property.
|
|
|
|
|
((equal environment "againframe")
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((ref (org-element-property :BEAMER_REF headline)))
|
2012-09-04 13:03:17 +00:00
|
|
|
|
;; Reference to frame being resumed is mandatory. Ignore
|
|
|
|
|
;; the whole headline if it isn't provided.
|
|
|
|
|
(when (org-string-nw-p ref)
|
|
|
|
|
(concat "\\againframe"
|
|
|
|
|
;; Overlay specification.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((overlay (org-element-property :BEAMER_ACT headline)))
|
2012-09-04 13:03:17 +00:00
|
|
|
|
(when overlay
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument
|
2012-09-04 13:03:17 +00:00
|
|
|
|
overlay
|
|
|
|
|
(if (string-match "^\\[.*\\]$" overlay) 'defaction
|
|
|
|
|
'action))))
|
|
|
|
|
;; Options.
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(let ((options (org-element-property :BEAMER_OPT headline)))
|
2012-09-04 13:03:17 +00:00
|
|
|
|
(when options
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument options 'option)))
|
2012-09-04 13:03:17 +00:00
|
|
|
|
;; Resolve reference provided by "BEAMER_ref"
|
|
|
|
|
;; property. This is done by building a minimal fake
|
|
|
|
|
;; link and calling the appropriate resolve function,
|
|
|
|
|
;; depending on the reference syntax.
|
|
|
|
|
(let* ((type
|
|
|
|
|
(progn
|
|
|
|
|
(string-match "^\\(id:\\|#\\|\\*\\)?\\(.*\\)" ref)
|
|
|
|
|
(cond
|
|
|
|
|
((or (not (match-string 1 ref))
|
|
|
|
|
(equal (match-string 1 ref) "*")) 'fuzzy)
|
|
|
|
|
((equal (match-string 1 ref) "id:") 'id)
|
|
|
|
|
(t 'custom-id))))
|
|
|
|
|
(link (list 'link (list :path (match-string 2 ref))))
|
|
|
|
|
(target (if (eq type 'fuzzy)
|
|
|
|
|
(org-export-resolve-fuzzy-link link info)
|
|
|
|
|
(org-export-resolve-id-link link info))))
|
|
|
|
|
;; Now use user-defined label provided in TARGET
|
|
|
|
|
;; headline, or fallback to standard one.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(format "{%s}" (org-beamer--get-label target info)))))))
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; Case 2: Creation of an appendix is requested.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
((equal environment "appendix")
|
|
|
|
|
(concat "\\appendix"
|
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
org-beamer--format-section, org-beamer--format-frame,
org-beamer--format-block, org-beamer-headline): Apply changes to
properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
org-icalendar-blocked-headline-p, org-icalendar-entry,
org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
org-texinfo--generate-menu-items, org-texinfo-template,
org-texinfo-headline, org-texinfo-link): Apply changes to
properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
Apply changes to properties.
(org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-17 23:01:21 +00:00
|
|
|
|
(org-element-property :BEAMER_ACT headline)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"\n"
|
|
|
|
|
(make-string (org-element-property :pre-blank headline) ?\n)
|
|
|
|
|
contents))
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; Case 3: Ignore heading.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
((equal environment "ignoreheading")
|
|
|
|
|
(concat (make-string (org-element-property :pre-blank headline) ?\n)
|
|
|
|
|
contents))
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; Case 4: HEADLINE is a note.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
((member environment '("note" "noteNH"))
|
|
|
|
|
(format "\\note{%s}"
|
|
|
|
|
(concat (and (equal environment "note")
|
|
|
|
|
(concat
|
|
|
|
|
(org-export-data
|
|
|
|
|
(org-element-property :title headline) info)
|
|
|
|
|
"\n"))
|
|
|
|
|
(org-trim contents))))
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; Case 5: HEADLINE is a frame.
|
2012-09-04 13:03:17 +00:00
|
|
|
|
((= level frame-level)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--format-frame headline contents info))
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; Case 6: Regular section, extracted from
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; `org-latex-classes'.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
((< level frame-level)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--format-section headline contents info))
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; Case 7: Otherwise, HEADLINE is a block.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(t (org-beamer--format-block headline contents info))))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Item
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-item (item contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode an ITEM element into Beamer code.
|
|
|
|
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let ((action (let ((first-element (car (org-element-contents item))))
|
|
|
|
|
(and (eq (org-element-type first-element) 'paragraph)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--element-has-overlay-p first-element))))
|
|
|
|
|
(output (org-export-with-backend 'latex item contents info)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(if (not action) output
|
|
|
|
|
;; If the item starts with a paragraph and that paragraph starts
|
|
|
|
|
;; with an export snippet specifying an overlay, insert it after
|
|
|
|
|
;; \item command.
|
|
|
|
|
(replace-regexp-in-string "\\\\item" (concat "\\\\item" action) output))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Keyword
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-keyword (keyword contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode a KEYWORD element into Beamer code.
|
|
|
|
|
CONTENTS is nil. INFO is a plist used as a communication
|
|
|
|
|
channel."
|
|
|
|
|
(let ((key (org-element-property :key keyword))
|
|
|
|
|
(value (org-element-property :value keyword)))
|
|
|
|
|
;; Handle specifically BEAMER and TOC (headlines only) keywords.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; Otherwise, fallback to `latex' back-end.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(cond
|
|
|
|
|
((equal key "BEAMER") value)
|
|
|
|
|
((and (equal key "TOC") (string-match "\\<headlines\\>" value))
|
|
|
|
|
(let ((depth (or (and (string-match "[0-9]+" value)
|
|
|
|
|
(string-to-number (match-string 0 value)))
|
|
|
|
|
(plist-get info :with-toc)))
|
|
|
|
|
(options (and (string-match "\\[.*?\\]" value)
|
|
|
|
|
(match-string 0 value))))
|
|
|
|
|
(concat
|
|
|
|
|
(when (wholenump depth) (format "\\setcounter{tocdepth}{%s}\n" depth))
|
2013-03-06 12:33:51 +00:00
|
|
|
|
"\\tableofcontents" options)))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(t (org-export-with-backend 'latex keyword contents info)))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Link
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-link (link contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode a LINK object into Beamer code.
|
|
|
|
|
CONTENTS is the description part of the link. INFO is a plist
|
|
|
|
|
used as a communication channel."
|
|
|
|
|
(let ((type (org-element-property :type link))
|
|
|
|
|
(path (org-element-property :path link)))
|
|
|
|
|
;; Use \hyperlink command for all internal links.
|
|
|
|
|
(cond
|
|
|
|
|
((equal type "radio")
|
|
|
|
|
(let ((destination (org-export-resolve-radio-link link info)))
|
|
|
|
|
(when destination
|
|
|
|
|
(format "\\hyperlink%s{%s}{%s}"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(or (org-beamer--element-has-overlay-p link) "")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(org-export-solidify-link-text path)
|
|
|
|
|
(org-export-data (org-element-contents destination) info)))))
|
|
|
|
|
((and (member type '("custom-id" "fuzzy" "id"))
|
|
|
|
|
(let ((destination (if (string= type "fuzzy")
|
|
|
|
|
(org-export-resolve-fuzzy-link link info)
|
|
|
|
|
(org-export-resolve-id-link link info))))
|
|
|
|
|
(case (org-element-type destination)
|
|
|
|
|
(headline
|
|
|
|
|
(let ((label
|
|
|
|
|
(format "sec-%s"
|
|
|
|
|
(mapconcat
|
|
|
|
|
'number-to-string
|
|
|
|
|
(org-export-get-headline-number
|
|
|
|
|
destination info)
|
|
|
|
|
"-"))))
|
|
|
|
|
(if (and (plist-get info :section-numbers) (not contents))
|
|
|
|
|
(format "\\ref{%s}" label)
|
|
|
|
|
(format "\\hyperlink%s{%s}{%s}"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(or (org-beamer--element-has-overlay-p link) "")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
label
|
|
|
|
|
contents))))
|
|
|
|
|
(target
|
|
|
|
|
(let ((path (org-export-solidify-link-text path)))
|
|
|
|
|
(if (not contents) (format "\\ref{%s}" path)
|
|
|
|
|
(format "\\hyperlink%s{%s}{%s}"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(or (org-beamer--element-has-overlay-p link) "")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
path
|
|
|
|
|
contents))))))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; Otherwise, use `latex' back-end.
|
|
|
|
|
(t (org-export-with-backend 'latex link contents info)))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Plain List
|
|
|
|
|
;;
|
2012-11-27 20:04:05 +00:00
|
|
|
|
;; Plain lists support `:environment', `:overlay' and `:options'
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; attributes.
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-plain-list (plain-list contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode a PLAIN-LIST element into Beamer code.
|
|
|
|
|
CONTENTS is the contents of the list. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(let* ((type (org-element-property :type plain-list))
|
2013-02-13 13:30:02 +00:00
|
|
|
|
(attributes (org-combine-plists
|
|
|
|
|
(org-export-read-attribute :attr_latex plain-list)
|
|
|
|
|
(org-export-read-attribute :attr_beamer plain-list)))
|
2012-11-27 20:04:05 +00:00
|
|
|
|
(latex-type (let ((env (plist-get attributes :environment)))
|
|
|
|
|
(cond (env (format "%s" env))
|
|
|
|
|
((eq type 'ordered) "enumerate")
|
|
|
|
|
((eq type 'descriptive) "description")
|
|
|
|
|
(t "itemize")))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-latex--wrap-label
|
2012-06-30 11:54:43 +00:00
|
|
|
|
plain-list
|
|
|
|
|
(format "\\begin{%s}%s%s\n%s\\end{%s}"
|
|
|
|
|
latex-type
|
|
|
|
|
;; Default overlay specification, if any.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument
|
2012-11-27 20:04:05 +00:00
|
|
|
|
(format "%s" (or (plist-get attributes :overlay) ""))
|
|
|
|
|
'defaction)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; Second optional argument depends on the list type.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument
|
2012-11-27 20:04:05 +00:00
|
|
|
|
(format "%s" (or (plist-get attributes :options) ""))
|
|
|
|
|
'option)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; Eventually insert contents and close environment.
|
|
|
|
|
contents
|
|
|
|
|
latex-type))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Radio Target
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-radio-target (radio-target text info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode a RADIO-TARGET object into Beamer code.
|
|
|
|
|
TEXT is the text of the target. INFO is a plist holding
|
|
|
|
|
contextual information."
|
|
|
|
|
(format "\\hypertarget%s{%s}{%s}"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(or (org-beamer--element-has-overlay-p radio-target) "")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(org-export-solidify-link-text
|
|
|
|
|
(org-element-property :value radio-target))
|
|
|
|
|
text))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Target
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-target (target contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Transcode a TARGET object into Beamer code.
|
|
|
|
|
CONTENTS is nil. INFO is a plist holding contextual
|
|
|
|
|
information."
|
|
|
|
|
(format "\\hypertarget{%s}{}"
|
|
|
|
|
(org-export-solidify-link-text (org-element-property :value target))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Template
|
|
|
|
|
;;
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; Template used is similar to the one used in `latex' back-end,
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; excepted for the table of contents and Beamer themes.
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-template (contents info)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Return complete document string after Beamer conversion.
|
|
|
|
|
CONTENTS is the transcoded contents string. INFO is a plist
|
|
|
|
|
holding export options."
|
|
|
|
|
(let ((title (org-export-data (plist-get info :title) info)))
|
|
|
|
|
(concat
|
|
|
|
|
;; 1. Time-stamp.
|
|
|
|
|
(and (plist-get info :time-stamp-file)
|
|
|
|
|
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
|
|
|
|
|
;; 2. Document class and packages.
|
|
|
|
|
(let ((class (plist-get info :latex-class))
|
|
|
|
|
(class-options (plist-get info :latex-class-options)))
|
|
|
|
|
(org-element-normalize-string
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let* ((header (nth 1 (assoc class org-latex-classes)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(document-class-string
|
|
|
|
|
(and (stringp header)
|
2012-08-30 13:54:33 +00:00
|
|
|
|
(if (not class-options) header
|
|
|
|
|
(replace-regexp-in-string
|
2013-02-20 19:26:08 +00:00
|
|
|
|
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
|
2012-08-30 13:54:33 +00:00
|
|
|
|
class-options header t nil 1)))))
|
2013-02-06 18:47:35 +00:00
|
|
|
|
(if (not document-class-string)
|
2013-02-15 13:18:59 +00:00
|
|
|
|
(user-error "Unknown LaTeX class `%s'" class)
|
2013-02-02 19:58:39 +00:00
|
|
|
|
(org-latex-guess-babel-language
|
|
|
|
|
(org-latex-guess-inputenc
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(org-splice-latex-header
|
|
|
|
|
document-class-string
|
2013-02-02 19:58:39 +00:00
|
|
|
|
org-latex-default-packages-alist
|
|
|
|
|
org-latex-packages-alist nil
|
2013-02-08 21:38:47 +00:00
|
|
|
|
(concat (plist-get info :latex-header-extra)
|
|
|
|
|
(plist-get info :beamer-header-extra))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
info)))))
|
|
|
|
|
;; 3. Insert themes.
|
|
|
|
|
(let ((format-theme
|
|
|
|
|
(function
|
|
|
|
|
(lambda (prop command)
|
|
|
|
|
(let ((theme (plist-get info prop)))
|
|
|
|
|
(when theme
|
|
|
|
|
(concat command
|
|
|
|
|
(if (not (string-match "\\[.*\\]" theme))
|
|
|
|
|
(format "{%s}\n" theme)
|
|
|
|
|
(format "%s{%s}\n"
|
|
|
|
|
(match-string 0 theme)
|
|
|
|
|
(org-trim
|
|
|
|
|
(replace-match "" nil nil theme)))))))))))
|
|
|
|
|
(mapconcat (lambda (args) (apply format-theme args))
|
|
|
|
|
'((:beamer-theme "\\usetheme")
|
|
|
|
|
(:beamer-color-theme "\\usecolortheme")
|
|
|
|
|
(:beamer-font-theme "\\usefonttheme")
|
|
|
|
|
(:beamer-inner-theme "\\useinnertheme")
|
|
|
|
|
(:beamer-outer-theme "\\useoutertheme"))
|
|
|
|
|
""))
|
|
|
|
|
;; 4. Possibly limit depth for headline numbering.
|
|
|
|
|
(let ((sec-num (plist-get info :section-numbers)))
|
|
|
|
|
(when (integerp sec-num)
|
|
|
|
|
(format "\\setcounter{secnumdepth}{%d}\n" sec-num)))
|
|
|
|
|
;; 5. Author.
|
|
|
|
|
(let ((author (and (plist-get info :with-author)
|
|
|
|
|
(let ((auth (plist-get info :author)))
|
|
|
|
|
(and auth (org-export-data auth info)))))
|
|
|
|
|
(email (and (plist-get info :with-email)
|
|
|
|
|
(org-export-data (plist-get info :email) info))))
|
|
|
|
|
(cond ((and author email (not (string= "" email)))
|
|
|
|
|
(format "\\author{%s\\thanks{%s}}\n" author email))
|
|
|
|
|
(author (format "\\author{%s}\n" author))
|
|
|
|
|
(t "\\author{}\n")))
|
|
|
|
|
;; 6. Date.
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(let ((date (and (plist-get info :with-date) (plist-get info :date))))
|
|
|
|
|
(format "\\date{%s}\n"
|
|
|
|
|
(cond ((not date) "")
|
|
|
|
|
;; If `:date' consists in a single timestamp and
|
|
|
|
|
;; `:date-format' is provided, apply it.
|
|
|
|
|
((and (plist-get info :date-format)
|
|
|
|
|
(not (cdr date))
|
|
|
|
|
(eq (org-element-type (car date)) 'timestamp))
|
|
|
|
|
(org-timestamp-format
|
|
|
|
|
(car date) (plist-get info :date-format)))
|
|
|
|
|
(t (org-export-data date info)))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; 7. Title
|
|
|
|
|
(format "\\title{%s}\n" title)
|
|
|
|
|
;; 8. Hyperref options.
|
2013-01-12 11:04:11 +00:00
|
|
|
|
(when (plist-get info :latex-hyperref-p)
|
|
|
|
|
(format "\\hypersetup{\n pdfkeywords={%s},\n pdfsubject={%s},\n pdfcreator={%s}}\n"
|
|
|
|
|
(or (plist-get info :keywords) "")
|
|
|
|
|
(or (plist-get info :description) "")
|
|
|
|
|
(if (not (plist-get info :with-creator)) ""
|
|
|
|
|
(plist-get info :creator))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; 9. Document start.
|
|
|
|
|
"\\begin{document}\n\n"
|
|
|
|
|
;; 10. Title command.
|
|
|
|
|
(org-element-normalize-string
|
|
|
|
|
(cond ((string= "" title) nil)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
((not (stringp org-latex-title-command)) nil)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
((string-match "\\(?:[^%]\\|^\\)%s"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
org-latex-title-command)
|
|
|
|
|
(format org-latex-title-command title))
|
|
|
|
|
(t org-latex-title-command)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
;; 11. Table of contents.
|
|
|
|
|
(let ((depth (plist-get info :with-toc)))
|
|
|
|
|
(when depth
|
|
|
|
|
(concat
|
|
|
|
|
(format "\\begin{frame}%s{%s}\n"
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-beamer--normalize-argument
|
|
|
|
|
org-beamer-outline-frame-options 'option)
|
|
|
|
|
org-beamer-outline-frame-title)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(when (wholenump depth)
|
|
|
|
|
(format "\\setcounter{tocdepth}{%d}\n" depth))
|
|
|
|
|
"\\tableofcontents\n"
|
|
|
|
|
"\\end{frame}\n\n")))
|
|
|
|
|
;; 12. Document's body.
|
|
|
|
|
contents
|
|
|
|
|
;; 13. Creator.
|
|
|
|
|
(let ((creator-info (plist-get info :with-creator)))
|
|
|
|
|
(cond
|
|
|
|
|
((not creator-info) "")
|
|
|
|
|
((eq creator-info 'comment)
|
|
|
|
|
(format "%% %s\n" (plist-get info :creator)))
|
|
|
|
|
(t (concat (plist-get info :creator) "\n"))))
|
|
|
|
|
;; 14. Document end.
|
|
|
|
|
"\\end{document}")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Minor Mode
|
|
|
|
|
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defvar org-beamer-mode-map (make-sparse-keymap)
|
|
|
|
|
"The keymap for `org-beamer-mode'.")
|
|
|
|
|
(define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(define-minor-mode org-beamer-mode
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Support for editing Beamer oriented Org mode files."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
nil " Bm" 'org-beamer-mode-map)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
(when (fboundp 'font-lock-add-keywords)
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
'org-mode
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
'prepend))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"The special face for beamer tags."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
:group 'org-export-beamer)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-property-changed (property value)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Track the BEAMER_env property with tags.
|
|
|
|
|
PROPERTY is the name of the modified property. VALUE is its new
|
|
|
|
|
value."
|
|
|
|
|
(cond
|
|
|
|
|
((equal property "BEAMER_env")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading t)
|
2012-09-09 12:56:17 +00:00
|
|
|
|
;; Filter out Beamer-related tags and install environment tag.
|
|
|
|
|
(let ((tags (org-remove-if (lambda (x) (string-match "^B_" x))
|
|
|
|
|
(org-get-tags)))
|
|
|
|
|
(env-tag (and (org-string-nw-p value) (concat "B_" value))))
|
|
|
|
|
(org-set-tags-to (if env-tag (cons env-tag tags) tags))
|
|
|
|
|
(when env-tag (org-toggle-tag env-tag 'on)))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
((equal property "BEAMER_col")
|
|
|
|
|
(org-toggle-tag "BMCOL" (if (org-string-nw-p value) 'on 'off)))))
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(add-hook 'org-property-changed-functions 'org-beamer-property-changed)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-allowed-property-values (property)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Supply allowed values for PROPERTY."
|
|
|
|
|
(cond
|
|
|
|
|
((and (equal property "BEAMER_env")
|
|
|
|
|
(not (org-entry-get nil (concat property "_ALL") 'inherit)))
|
|
|
|
|
;; If no allowed values for BEAMER_env have been defined,
|
|
|
|
|
;; supply all defined environments
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(mapcar 'car (append org-beamer-environments-special
|
|
|
|
|
org-beamer-environments-extra
|
|
|
|
|
org-beamer-environments-default)))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
((and (equal property "BEAMER_col")
|
|
|
|
|
(not (org-entry-get nil (concat property "_ALL") 'inherit)))
|
|
|
|
|
;; If no allowed values for BEAMER_col have been defined,
|
|
|
|
|
;; supply some
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-split-string org-beamer-column-widths " "))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
(add-hook 'org-property-allowed-value-functions
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'org-beamer-allowed-property-values)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Commands
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-export-as-latex
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-07-20 11:14:05 +00:00
|
|
|
|
"Export current buffer as a Beamer buffer.
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-02 16:24:19 +00:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting buffer should be accessible
|
|
|
|
|
through the `org-export-stack' interface.
|
|
|
|
|
|
2012-06-30 11:54:43 +00:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{document}\" and \"\\end{document}\".
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
Export is done in a buffer named \"*Org BEAMER Export*\", which
|
2012-07-20 11:11:44 +00:00
|
|
|
|
will be displayed when `org-export-show-temporary-export-buffer'
|
|
|
|
|
is non-nil."
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(interactive)
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(if async
|
|
|
|
|
(org-export-async-start
|
|
|
|
|
(lambda (output)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create "*Org BEAMER Export*")
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert output)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(LaTeX-mode)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-export-add-to-stack (current-buffer) 'beamer)))
|
|
|
|
|
`(org-export-as 'beamer ,subtreep ,visible-only ,body-only
|
2012-12-02 16:24:19 +00:00
|
|
|
|
',ext-plist))
|
|
|
|
|
(let ((outbuf (org-export-to-buffer
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'beamer "*Org BEAMER Export*"
|
2012-12-02 16:24:19 +00:00
|
|
|
|
subtreep visible-only body-only ext-plist)))
|
|
|
|
|
(with-current-buffer outbuf (LaTeX-mode))
|
|
|
|
|
(when org-export-show-temporary-export-buffer
|
|
|
|
|
(switch-to-buffer-other-window outbuf)))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-export-to-latex
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Export current buffer as a Beamer presentation (tex).
|
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-02 16:24:19 +00:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-06-30 11:54:43 +00:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{document}\" and \"\\end{document}\".
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
Return output file's name."
|
|
|
|
|
(interactive)
|
2012-11-29 20:52:43 +00:00
|
|
|
|
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(if async
|
|
|
|
|
(org-export-async-start
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(lambda (f) (org-export-add-to-stack f 'beamer))
|
2012-12-02 16:24:19 +00:00
|
|
|
|
`(expand-file-name
|
|
|
|
|
(org-export-to-file
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'beamer ,outfile ,subtreep ,visible-only ,body-only
|
2012-12-02 16:24:19 +00:00
|
|
|
|
',ext-plist)))
|
|
|
|
|
(org-export-to-file
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'beamer outfile subtreep visible-only body-only ext-plist))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-export-to-pdf
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2012-07-23 07:51:55 +00:00
|
|
|
|
"Export current buffer as a Beamer presentation (PDF).
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
2012-12-02 16:24:19 +00:00
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
2012-06-30 11:54:43 +00:00
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
|
first.
|
|
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
|
contents of hidden elements.
|
|
|
|
|
|
|
|
|
|
When optional argument BODY-ONLY is non-nil, only write code
|
|
|
|
|
between \"\\begin{document}\" and \"\\end{document}\".
|
|
|
|
|
|
|
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
|
|
Return PDF file's name."
|
|
|
|
|
(interactive)
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(if async
|
|
|
|
|
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
|
|
|
|
|
(org-export-async-start
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(lambda (f) (org-export-add-to-stack f 'beamer))
|
2012-12-02 16:24:19 +00:00
|
|
|
|
`(expand-file-name
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-latex-compile
|
2012-12-02 16:24:19 +00:00
|
|
|
|
(org-export-to-file
|
2013-01-27 22:11:34 +00:00
|
|
|
|
'beamer ,outfile ,subtreep ,visible-only ,body-only
|
2012-12-02 16:24:19 +00:00
|
|
|
|
',ext-plist)))))
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-latex-compile
|
|
|
|
|
(org-beamer-export-to-latex
|
2012-12-02 16:24:19 +00:00
|
|
|
|
nil subtreep visible-only body-only ext-plist))))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-select-environment ()
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Select the environment to be used by beamer for this entry.
|
|
|
|
|
While this uses (for convenience) a tag selection interface, the
|
|
|
|
|
result of this command will be that the BEAMER_env *property* of
|
|
|
|
|
the entry is set.
|
|
|
|
|
|
|
|
|
|
In addition to this, the command will also set a tag as a visual
|
|
|
|
|
aid, but the tag does not have any semantic meaning."
|
|
|
|
|
(interactive)
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; Make sure `org-beamer-environments-special' has a higher
|
|
|
|
|
;; priority than `org-beamer-environments-extra'.
|
|
|
|
|
(let* ((envs (append org-beamer-environments-special
|
|
|
|
|
org-beamer-environments-extra
|
|
|
|
|
org-beamer-environments-default))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(org-tag-alist
|
|
|
|
|
(append '((:startgroup))
|
|
|
|
|
(mapcar (lambda (e) (cons (concat "B_" (car e))
|
|
|
|
|
(string-to-char (nth 1 e))))
|
|
|
|
|
envs)
|
|
|
|
|
'((:endgroup))
|
|
|
|
|
'(("BMCOL" . ?|))))
|
|
|
|
|
(org-fast-tag-selection-single-key t))
|
|
|
|
|
(org-set-tags)
|
|
|
|
|
(let ((tags (or (ignore-errors (org-get-tags-string)) "")))
|
|
|
|
|
(cond
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; For a column, automatically ask for its width.
|
org-export: Use `eq' instead of `equal' when possible
* contrib/lisp/org-export.el (org-export-data,
org-export-footnote-first-reference-p,
org-export-get-footnote-number, org-export-get-ordinal,
org-export-get-loc, org-export-table-row-group,
org-export-table-cell-starts-colgroup-p,
org-export-table-cell-ends-colgroup-p,
org-export-table-cell-address): Use `eq' instead of `equal' when
possible.
* contrib/lisp/org-e-ascii.el (org-e-ascii-table-row):
* contrib/lisp/org-e-beamer.el (org-e-beamer-select-environment):
* contrib/lisp/org-e-html.el (org-e-html-footnote-section,
org-e-html-latex-environment, org-e-html-paragraph): Use `eq'
instead of `equal' when possible.
* contrib/lisp/org-e-latex.el (org-e-latex--get-footnote-counter):
* contrib/lisp/org-e-odt.el (org-e-odt-do-format-code,
org-e-odt-footnote-def, org-e-odt-item, org-e-odt-latex-environment,
org-e-odt-latex-fragment, org-e-odt-plain-list, org-e-odt-table,
org-e-odt-enumerate-element): Use `eq' instead of `equal' when
possible.
In particular, comparing elements shouldn't be done with `equal' since
they are circular lists. On the other hand, using `eq' is fine if
they belong to the same tree.
2012-07-16 14:19:56 +00:00
|
|
|
|
((eq org-last-tag-selection-key ?|)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(if (string-match ":BMCOL:" tags)
|
|
|
|
|
(org-set-property "BEAMER_col" (read-string "Column width: "))
|
|
|
|
|
(org-delete-property "BEAMER_col")))
|
2012-09-04 09:07:56 +00:00
|
|
|
|
;; For an "againframe" section, automatically ask for reference
|
|
|
|
|
;; to resumed frame and overlay specifications.
|
2012-11-17 20:47:04 +00:00
|
|
|
|
((eq org-last-tag-selection-key ?A)
|
2012-09-04 09:07:56 +00:00
|
|
|
|
(if (equal (org-entry-get nil "BEAMER_env") "againframe")
|
|
|
|
|
(progn (org-entry-delete nil "BEAMER_env")
|
|
|
|
|
(org-entry-delete nil "BEAMER_ref")
|
|
|
|
|
(org-entry-delete nil "BEAMER_act"))
|
|
|
|
|
(org-entry-put nil "BEAMER_env" "againframe")
|
|
|
|
|
(org-set-property
|
|
|
|
|
"BEAMER_ref"
|
|
|
|
|
(read-string "Frame reference (*Title, #custom-id, id:...): "))
|
|
|
|
|
(org-set-property "BEAMER_act"
|
|
|
|
|
(read-string "Overlay specification: "))))
|
|
|
|
|
((string-match (concat ":B_\\(" (mapconcat 'car envs "\\|") "\\):") tags)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(org-entry-put nil "BEAMER_env" (match-string 1 tags)))
|
|
|
|
|
(t (org-entry-delete nil "BEAMER_env"))))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-insert-options-template (&optional kind)
|
2012-06-30 11:54:43 +00:00
|
|
|
|
"Insert a settings template, to make sure users do this right."
|
|
|
|
|
(interactive (progn
|
|
|
|
|
(message "Current [s]ubtree or [g]lobal?")
|
|
|
|
|
(if (eq (read-char-exclusive) ?g) (list 'global)
|
|
|
|
|
(list 'subtree))))
|
|
|
|
|
(if (eq kind 'subtree)
|
|
|
|
|
(progn
|
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(org-reveal)
|
2012-09-17 15:28:03 +00:00
|
|
|
|
(org-entry-put nil "EXPORT_LaTeX_CLASS" "beamer")
|
|
|
|
|
(org-entry-put nil "EXPORT_LaTeX_CLASS_OPTIONS" "[presentation]")
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf")
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(when org-beamer-column-view-format
|
|
|
|
|
(org-entry-put nil "COLUMNS" org-beamer-column-view-format))
|
|
|
|
|
(org-entry-put nil "BEAMER_col_ALL" org-beamer-column-widths))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
(insert "#+LaTeX_CLASS: beamer\n")
|
|
|
|
|
(insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n")
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(when org-beamer-theme (insert "#+BEAMER_THEME: " org-beamer-theme "\n"))
|
|
|
|
|
(when org-beamer-column-view-format
|
|
|
|
|
(insert "#+COLUMNS: " org-beamer-column-view-format "\n"))
|
|
|
|
|
(insert "#+PROPERTY: BEAMER_col_ALL " org-beamer-column-widths "\n")))
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2012-12-20 08:58:16 +00:00
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-publish-to-latex (plist filename pub-dir)
|
2012-12-20 08:58:16 +00:00
|
|
|
|
"Publish an Org file to a Beamer presentation (LaTeX).
|
|
|
|
|
|
|
|
|
|
FILENAME is the filename of the Org file to be published. PLIST
|
|
|
|
|
is the property list for the given project. PUB-DIR is the
|
|
|
|
|
publishing directory.
|
|
|
|
|
|
|
|
|
|
Return output file name."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-publish-org-to 'beamer filename ".tex" plist pub-dir))
|
2012-12-20 08:58:16 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(defun org-beamer-publish-to-pdf (plist filename pub-dir)
|
2012-12-20 08:58:16 +00:00
|
|
|
|
"Publish an Org file to a Beamer presentation (PDF, via LaTeX).
|
|
|
|
|
|
|
|
|
|
FILENAME is the filename of the Org file to be published. PLIST
|
|
|
|
|
is the property list for the given project. PUB-DIR is the
|
|
|
|
|
publishing directory.
|
|
|
|
|
|
|
|
|
|
Return output file name."
|
2013-01-27 22:11:34 +00:00
|
|
|
|
;; Unlike to `org-beamer-publish-to-latex', PDF file is generated in
|
|
|
|
|
;; working directory and then moved to publishing directory.
|
|
|
|
|
(org-publish-attachment
|
2012-12-20 08:58:16 +00:00
|
|
|
|
plist
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(org-latex-compile (org-publish-org-to 'beamer filename ".tex" plist))
|
2012-12-20 08:58:16 +00:00
|
|
|
|
pub-dir))
|
|
|
|
|
|
2012-06-30 11:54:43 +00:00
|
|
|
|
|
2013-01-27 22:11:34 +00:00
|
|
|
|
(provide 'ox-beamer)
|
|
|
|
|
|
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "org-loaddefs.el"
|
|
|
|
|
;; End:
|
|
|
|
|
|
|
|
|
|
;;; ox-beamer.el ends here
|