summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-10-03 13:11:03 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2013-10-04 19:11:49 (GMT)
commitb67ff6073c09b3f5c3878152d42efe34fcf0fd6e (patch)
tree719060bee53cee5ba9da5d8c1a6ac3f4b92025ef
parent79ee98d755094814f999f686d942eb0ff4478952 (diff)
downloadorg-mode-b67ff6073c09b3f5c3878152d42efe34fcf0fd6e.zip
org-mode-b67ff6073c09b3f5c3878152d42efe34fcf0fd6e.tar.gz
ox-beamer: Protect fragile commands in sections
* lisp/ox-beamer.el (org-beamer--format-section): Protect fragile commands in sections.
-rw-r--r--lisp/ox-beamer.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index a975d24..f1dbe82 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -444,13 +444,31 @@ INFO is a plist used as a communication channel."
"Format HEADLINE as a sectioning part.
CONTENTS holds the contents of the headline. INFO is a plist
used as a communication channel."
- ;; Use `latex' back-end output, inserting overlay specifications
- ;; if possible.
- (let ((latex-headline (org-export-with-backend 'latex headline contents info))
+ (let ((latex-headline
+ (org-export-data-with-backend
+ headline
+ ;; We create a temporary export back-end which behaves the
+ ;; same as current one, but adds "\protect" in front of the
+ ;; output of some objects.
+ (org-export-create-backend
+ :parent 'latex
+ :transcoders
+ (let ((protected-output
+ (function
+ (lambda (object contents info)
+ (let ((code (org-export-with-backend
+ 'beamer object contents info)))
+ (if (org-string-nw-p code) (concat "\\protect" code)
+ code))))))
+ (mapcar #'(lambda (type) (cons type protected-output))
+ '(bold footnote-reference italic strike-through
+ timestamp underline))))
+ info))
(mode-specs (org-element-property :BEAMER_ACT headline)))
(if (and mode-specs
(string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{"
latex-headline))
+ ;; Insert overlay specifications.
(replace-match (concat (match-string 1 latex-headline)
(format "<%s>" mode-specs))
nil nil latex-headline 1)