From d8c37c9265fd6a3d45dce4ce86a12b634c9be0fd Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 3 Oct 2013 15:11:03 +0200 Subject: [PATCH] ox-beamer: Protect fragile commands in sections * lisp/ox-beamer.el (org-beamer--format-section): Protect fragile commands in sections. --- lisp/ox-beamer.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index a975d24..b812a75 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -444,9 +444,25 @@ 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)) + ;; Use `latex' back-end output, inserting overlay specifications if + ;; possible. Also protect fragile commands. + (let ((latex-headline + (org-export-data-with-backend + headline + (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 "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{" -- 1.8.4