emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christoph Dittmann <github@christoph-d.de>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Make [fragile] work with overlay specifications.
Date: Tue, 07 Feb 2012 18:26:32 +0100	[thread overview]
Message-ID: <4F315EC8.5040704@christoph-d.de> (raw)

[-- 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


             reply	other threads:[~2012-02-07 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 17:26 Christoph Dittmann [this message]
2012-04-20 13:20 ` [PATCH] Make [fragile] work with overlay specifications Bastien
  -- strict thread matches above, loose matches on Subject: below --
2012-02-07 17:34 Christoph Dittmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F315EC8.5040704@christoph-d.de \
    --to=github@christoph-d.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).