ソースを参照

BEAMER export: Allow a columns environment to be left again on same frame

Carsten Dominik 15 年 前
コミット
d6031c2dc0
3 ファイル変更29 行追加17 行削除
  1. 7 1
      doc/org.texi
  2. 6 0
      lisp/ChangeLog
  3. 16 16
      lisp/org-beamer.el

+ 7 - 1
doc/org.texi

@@ -9623,7 +9623,13 @@ set an options argument for the implied @code{columns} environment.
 @item BEAMER_col
 The width of a column that should start with this entry.  If this property is
 set, the entry will also get a @code{:BMCOL:} property to make this visible.
-Also this tag is only a visual aid.
+Also this tag is only a visual aid.  When his is a plain number, it will be
+interpreted as a fraction of @code{\textwidth}.  Otherwise it will be assumed
+that you have specified the units, like @samp{3cm}.
+The first such property in a frame will start a @code{columns} environment to
+surround the columns.  This environment is closed when an entry has a
+@code{BEAMER_col} property with value 0, or automatically at the end of the
+frame.
 @item BEAMER_extra
 Additional commands that should be inserted after the environment has been
 opened.  For example, when creating a frame, this can be used to specify

+ 6 - 0
lisp/ChangeLog

@@ -1,3 +1,9 @@
+2010-01-02  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-beamer.el (org-beamer-sectioning): Leave columns environment
+	by specifying 0 or 1 for column width.
+	(org-beamer-column-widths): Make 0 stand for 0.0.
+
 2010-01-01  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-exp.el (org-export-mark-radio-links): Don't match inside

+ 16 - 16
lisp/org-beamer.el

@@ -70,7 +70,7 @@ BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}."
 
 
 (defconst org-beamer-column-widths
-  "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC"
+  "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
 "The column widths that should be installed as allowed property values.")
 
 (defconst org-beamer-transitions
@@ -158,11 +158,6 @@ close   The closing string of the environment."
   (when org-beamer-column-open
     (setq org-beamer-column-open nil)
     (insert "\\end{column}\n")))
-(defun org-beamer-close-column-maybe-1 ()
-  (when org-beamer-column-open
-    (setq org-beamer-column-open nil)
-    (insert "\\end{column}\n"))
-  (setq org-beamer-columns-open nil))
 (defun org-beamer-open-columns-maybe (&optional opts)
   (unless org-beamer-columns-open
     (setq org-beamer-columns-open t)
@@ -229,16 +224,21 @@ in org-export-latex-classes."
 	       (<= level org-beamer-inside-frame-at-level))
       (setq org-beamer-inside-frame-at-level nil))
     (when (setq tmp (org-beamer-assoc-not-empty "BEAMER_col" props))
-      (when (setq ass (assoc "BEAMER_envargs" props))
-	(let (case-fold-search)
-	  (when (string-match "C\\(\\[[^][]*\\]\\)" (cdr ass))
-	    (setq columns-option (match-string 1 (cdr ass)))
-	    (setcdr ass (replace-match "" t t (cdr ass))))
-	  (when (string-match "c\\(\\[[^][]*\\]\\)" (cdr ass))
-	    (setq column-option (match-string 1 (cdr ass)))
-	    (setcdr ass (replace-match "" t t (cdr ass))))))
-      (org-beamer-open-columns-maybe columns-option)
-      (org-beamer-open-column tmp column-option))
+      (if (and (string-match "\\`[0-9.]+\\'" tmp)
+	       (or (= (string-to-number tmp) 1.0)
+		   (= (string-to-number tmp) 0.0)))
+	  ;; column width 1 means cloase columns, go back to full width
+	  (org-beamer-close-columns-maybe)
+	(when (setq ass (assoc "BEAMER_envargs" props))
+	  (let (case-fold-search)
+	    (when (string-match "C\\(\\[[^][]*\\]\\)" (cdr ass))
+	      (setq columns-option (match-string 1 (cdr ass)))
+	      (setcdr ass (replace-match "" t t (cdr ass))))
+	    (when (string-match "c\\(\\[[^][]*\\]\\)" (cdr ass))
+	      (setq column-option (match-string 1 (cdr ass)))
+	      (setcdr ass (replace-match "" t t (cdr ass))))))
+	(org-beamer-open-columns-maybe columns-option)
+	(org-beamer-open-column tmp column-option)))
     (cond
      ((or (equal (cdr (assoc "BEAMER_env" props)) "frame")
 	  (and frame-level (= level frame-level)))