浏览代码

LaTeX Export: Allow class definition in property

When exporting a region starting with a headline, a LaTeX_CLASS
property in that entry will be honored.

Requested by Robert Goldman.
Carsten Dominik 16 年之前
父节点
当前提交
0e46dc3f9c
共有 5 个文件被更改,包括 62 次插入37 次删除
  1. 37 28
      ORGWEBPAGE/Changes.org
  2. 2 0
      doc/ChangeLog
  3. 5 3
      doc/org.texi
  4. 2 0
      lisp/ChangeLog
  5. 16 6
      lisp/org-export-latex.el

+ 37 - 28
ORGWEBPAGE/Changes.org

@@ -26,6 +26,17 @@
     empty except for the colon.    
 
 ** Details
+
+*** Include files can now also process switches
+
+    The example and src switches like =-n= can now also be added
+    to inlcude file statements:
+
+: #+INCLUDE "~/.emacs" src emacs-lisp -n -r
+
+    Thanks to Manish for pointing out that this was not yet
+    supported.
+
 *** Examples can be exported to HTML as text areas
     
     You can now specify a =-t= switch to an example or src block,
@@ -35,21 +46,13 @@
 
     Thanks to Ulf Stegemann for driving this development.
 
-*** The attachment directory may now be chosen by the user
-
-    Instead of using the automatic, unique directory related to
-    the entry ID, you can also use a chosen directory for the
-    attachments of an entry.  This directory is specified by the
-    ATTACH_DIR property.  You can use `C-c C-a s' to set this
-    property.
+*** LaTeX_CLASS can be given as a property
 
-*** You can use a single attachment directory for a subtree
+    When exporting a single subtree by selectiong it as a region
+    before export, the LaTeX class for the export will be taken
+    from the =LaTeX_CLASS= property of the entry if present.
 
-    By setting the property ATTACH_DIR_INHERIT, you can now tell
-    Org that children of the entry should use the same directory
-    for attachments, unless a child explicitly defines its own
-    directory with the ATTACH_DIR property.  You can use the
-    command `C-c C-a i' to set this property in an entry.
+    Thanks to Robert Goldman for this request.
 
 *** Better handling of inlined images in different backends
 
@@ -67,6 +70,15 @@
     make sure that the link has a description part which is not
     equal to the link part.
 
+*** Links by ID now continue to work in HTML exported files
+
+    If you make links by ID, these links will now still work in
+    HTML exported files, provided that you keep the relative path
+    from link to target file the same.
+
+    Thanks to Friedrich Delgado Friedrichs for pushing this over
+    the line.
+
 *** The relative timer can be paused
 
     The new command `C-c C-x ,' will pause the relative timer.
@@ -76,24 +88,21 @@
 
     Thanks to Alan Davis for driving this change.
 
-*** Include files can now also process switches
-
-    The example and src switches like =-n= can now also be added
-    to inlcude file statements:
-
-: #+INCLUDE "~/.emacs" src emacs-lisp -n -r
-
-    Thanks to Manish for pointing out that this was not yet
-    supported.
+*** The attachment directory may now be chosen by the user
 
-*** Links by ID now continue to work in HTML exported files
+    Instead of using the automatic, unique directory related to
+    the entry ID, you can also use a chosen directory for the
+    attachments of an entry.  This directory is specified by the
+    ATTACH_DIR property.  You can use `C-c C-a s' to set this
+    property.
 
-    If you make links by ID, these links will now still work in
-    HTML exported files, provided that you keep the relative path
-    from link to target file the same.
+*** You can use a single attachment directory for a subtree
 
-    Thanks to Friedrich Delgado Friedrichs for pushing this over
-    the line.
+    By setting the property ATTACH_DIR_INHERIT, you can now tell
+    Org that children of the entry should use the same directory
+    for attachments, unless a child explicitly defines its own
+    directory with the ATTACH_DIR property.  You can use the
+    command `C-c C-a i' to set this property in an entry.
 
 * Version 6.17
 

+ 2 - 0
doc/ChangeLog

@@ -4,6 +4,8 @@
 	LaTeX macros survive LaTeX export.
 	(Images in LaTeX export): Show how to create a reference to a
 	figure.
+	(Sectioning structure): Document that the LaTeX class can be
+	specified in a property.
 
 2009-01-19  Carsten Dominik  <carsten.dominik@gmail.com>
 

+ 5 - 3
doc/org.texi

@@ -8193,9 +8193,11 @@ By default, the La@TeX{} output uses the class @code{article}.
 
 You can change this globally by setting a different value for
 @code{org-export-latex-default-class} or locally by adding an option like
-@code{#+LaTeX_CLASS: myclass} in your file.  The class should be listed in
-@code{org-export-latex-classes}, where you can also define the sectioning
-structure for each class, as well as defining additional classes.
+@code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:}
+property that applies when exporting a region containing only this (sub)tree.
+The class should be listed in @code{org-export-latex-classes}, where you can
+also define the sectioning structure for each class, as well as defining
+additional classes.
 
 @node Tables in LaTeX export, Images in LaTeX export, Sectioning structure, LaTeX and PDF export
 @subsection Tables in LaTeX export

+ 2 - 0
lisp/ChangeLog

@@ -2,6 +2,8 @@
 
 	* org-export-latex.el (org-export-latex-quotation-marks): Use
 	`org-if-unprotected-1'.
+	(org-export-latex-set-initial-vars): Check for class definition in
+	property.
 
 	* org-macs.el (org-if-unprotected-1): New macro.
 

+ 16 - 6
lisp/org-export-latex.el

@@ -688,12 +688,22 @@ LEVEL indicates the default depth for export."
 	(org-combine-plists (org-default-export-plist) ext-plist
 			    (org-infile-export-plist))
 	org-export-latex-class
-	(save-excursion
-	  (goto-char (point-min))
-	  (if (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
-		   (assoc (match-string 1) org-export-latex-classes))
-	      (match-string 1)
-	    org-export-latex-default-class))
+	(or (and (org-region-active-p)
+		 (save-excursion
+		   (goto-char (region-beginning))
+		   (and (looking-at org-complex-heading-regexp)
+			(org-entry-get nil "LaTeX_CLASS" 'selective))))
+	    (save-excursion
+	      (save-restriction
+		(widen)
+		(goto-char (point-min))
+		(and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
+		     (match-string 1))))
+	    org-export-latex-default-class)
+	org-export-latex-class
+	(or (car (assoc org-export-latex-class org-export-latex-classes))
+	    (error "No definition for class `%s' in `org-export-latex-classes'"
+		   org-export-latex-class))
 	org-export-latex-header
 	(cadr (assoc org-export-latex-class org-export-latex-classes))
 	org-export-latex-sectioning