emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: dates in heading break beamer export


From: Nicolas Goaziou
Subject: Re: [O] Bug: dates in heading break beamer export
Date: Thu, 03 Oct 2013 15:30:44 +0200

Hello,

Daniele Pizzolli <address@hidden> writes:

> On 10/02/2013 05:55 PM, Nicolas Goaziou wrote:
>> Daniele Pizzolli writes:
>>
>>> Yes, I think is fair to drop the markup.
>>
>> OK.
>>
>>> I would also think that this is safe default when nested markup is
>>> bad.

The following patch should protect some fragile commands in
a section-like structure. It is Beamer-only since general LaTeX back-end
doesn't seem to encounter these problems.

Does it fix the problem?


Regards,

-- 
Nicolas Goaziou
>From d8c37c9265fd6a3d45dce4ce86a12b634c9be0fd Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <address@hidden>
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]