emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Make [fragile] work with overlay specifications.
@ 2012-02-07 17:26 Christoph Dittmann
  2012-04-20 13:20 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Dittmann @ 2012-02-07 17:26 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

Hi,

I noticed something unexpected in org-beamer.el when I used overlay 
specifications together with optional parameters for the frame 
environment and the frame contained verbatim sections. In this case the 
exporter would add [fragile] to the frame options in a way that would 
break the LaTeX code.

I wrote a small patch that fixes this particular problem for me.

The following test case generates invalid LaTeX code with org-mode 
revision c4b23345. With the attached patch it generates valid LaTeX code.

#+LaTeX_CLASS: beamer
* overlay + optional parameter
   :PROPERTIES:
   :BEAMER_envargs: [label=abc]<1>
   :END:
   #+BEGIN_LaTeX
   \begin{verbatim}
     I am [fragile]
   \end{verbatim}
   #+END_LaTeX

Christoph

[-- Attachment #2: 0001-Make-fragile-work-with-overlay-specifications.patch --]
[-- Type: text/x-patch, Size: 1346 bytes --]

From a4624f52055667ed8c5220ca49f459274bfc7f45 Mon Sep 17 00:00:00 2001
From: Christoph Dittmann <github@christoph-d.de>
Date: Tue, 7 Feb 2012 14:43:26 +0100
Subject: [PATCH] Make [fragile] work with overlay specifications.

If the BEAMER_envargs property contains optional parameters together
with an overlay specification like [option]<1-2>, the exporter turns
the start of the frame into \begin{frame}<1-2>[option].  If then
[fragile] needs to be added, this becomes
\begin{frame}[fragile]<1-2>[option] and causes a LaTeX error.

With this patch [fragile] is added in a way such that the line becomes
\begin{frame}<1-2>[fragile,option].
---
 lisp/org-beamer.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org-beamer.el b/lisp/org-beamer.el
index fae5967..1823b03 100644
--- a/lisp/org-beamer.el
+++ b/lisp/org-beamer.el
@@ -502,7 +502,7 @@ This function will run in the final LaTeX document."
       (while (re-search-forward org-beamer-fragile-re nil t)
 	(save-excursion
 	  ;; Are we inside a frame here?
-	  (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}"
+	  (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}\\(<[^>]*>\\)?"
 					 nil t)
 		     (equal (match-string 1) "begin"))
 	    ;; yes, inside a frame, make sure "fragile" is one of the options
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] Make [fragile] work with overlay specifications.
@ 2012-02-07 17:34 Christoph Dittmann
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Dittmann @ 2012-02-07 17:34 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

Hi,

I noticed something unexpected in org-beamer.el when I used overlay 
specifications together with optional parameters for the frame 
environment and the frame contained verbatim sections. In this case the 
exporter would add [fragile] to the frame options in a way that would 
break the LaTeX code.

I wrote a small patch that fixes this particular problem for me.

The following test case generates invalid LaTeX code with org-mode 
revision c4b23345. With the attached patch it generates valid LaTeX code.

#+LaTeX_CLASS: beamer
* overlay + optional parameter
   :PROPERTIES:
   :BEAMER_envargs: [label=abc]<1>
   :END:
   #+BEGIN_LaTeX
   \begin{verbatim}
     I am [fragile]
   \end{verbatim}
   #+END_LaTeX

Christoph

[-- Attachment #2: 0001-Make-fragile-work-with-overlay-specifications.patch --]
[-- Type: text/x-patch, Size: 1346 bytes --]

From a4624f52055667ed8c5220ca49f459274bfc7f45 Mon Sep 17 00:00:00 2001
From: Christoph Dittmann <github@christoph-d.de>
Date: Tue, 7 Feb 2012 14:43:26 +0100
Subject: [PATCH] Make [fragile] work with overlay specifications.

If the BEAMER_envargs property contains optional parameters together
with an overlay specification like [option]<1-2>, the exporter turns
the start of the frame into \begin{frame}<1-2>[option].  If then
[fragile] needs to be added, this becomes
\begin{frame}[fragile]<1-2>[option] and causes a LaTeX error.

With this patch [fragile] is added in a way such that the line becomes
\begin{frame}<1-2>[fragile,option].
---
 lisp/org-beamer.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org-beamer.el b/lisp/org-beamer.el
index fae5967..1823b03 100644
--- a/lisp/org-beamer.el
+++ b/lisp/org-beamer.el
@@ -502,7 +502,7 @@ This function will run in the final LaTeX document."
       (while (re-search-forward org-beamer-fragile-re nil t)
 	(save-excursion
 	  ;; Are we inside a frame here?
-	  (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}"
+	  (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}\\(<[^>]*>\\)?"
 					 nil t)
 		     (equal (match-string 1) "begin"))
 	    ;; yes, inside a frame, make sure "fragile" is one of the options
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make [fragile] work with overlay specifications.
  2012-02-07 17:26 [PATCH] Make [fragile] work with overlay specifications Christoph Dittmann
@ 2012-04-20 13:20 ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2012-04-20 13:20 UTC (permalink / raw)
  To: Christoph Dittmann; +Cc: emacs-orgmode

Hi Christoph,

Christoph Dittmann <github@christoph-d.de> writes:

> I noticed something unexpected in org-beamer.el when I used overlay 
> specifications together with optional parameters for the frame 
> environment and the frame contained verbatim sections. In this case the 
> exporter would add [fragile] to the frame options in a way that would 
> break the LaTeX code.
>
> I wrote a small patch that fixes this particular problem for me.

Applied, thanks.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-20 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07 17:26 [PATCH] Make [fragile] work with overlay specifications Christoph Dittmann
2012-04-20 13:20 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2012-02-07 17:34 Christoph Dittmann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).