Browse Source

Implement #+LATEX_HEADER special.

Proposed by Austin Frank and apparently also by Russel Adams.
Carsten Dominik 16 years ago
parent
commit
20364d043a
3 changed files with 16 additions and 2 deletions
  1. 8 0
      lisp/ChangeLog
  2. 7 2
      lisp/org-exp.el
  3. 1 0
      lisp/org-export-latex.el

+ 8 - 0
lisp/ChangeLog

@@ -1,3 +1,11 @@
+2008-10-02  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org-export-latex.el (org-export-latex-make-header): Also insert
+	the content of the property :latex-header-extra.
+
+	* org-exp.el (org-infile-export-plist): Put the content of
+	#+LATEX_HEADER: into the property :latex-header-extra.
+
 2008-10-01  Carsten Dominik  <dominik@science.uva.nl>
 
 	* org-colview.el (org-columns-get-format-and-top-level): Remove

+ 7 - 2
lisp/org-exp.el

@@ -865,10 +865,11 @@ modified) list.")
       (let ((re (org-make-options-regexp
 		 (append
 		  '("TITLE" "AUTHOR" "DATE" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"
-		    "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE"
+		    "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE" "LATEX_HEADER"
 		    "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS")
 		  (mapcar 'car org-export-inbuffer-options-extra))))
 	    p key val text options js-up js-main js-css js-opt a pr style
+	    latex-header
 	    ext-setup-or-nil setup-contents (start 0))
 	(while (or (and ext-setup-or-nil
 			(string-match re ext-setup-or-nil start)
@@ -888,6 +889,8 @@ modified) list.")
 	   ((string-equal key "LANGUAGE") (setq p (plist-put p :language val)))
 	   ((string-equal key "STYLE")
 	    (setq style (concat style "\n" val)))
+	   ((string-equal key "LATEX_HEADER")
+	    (setq latex-header (concat latex-header "\n" val)))
 	   ((string-equal key "TEXT")
 	    (setq text (if text (concat text "\n" val) val)))
 	   ((string-equal key "OPTIONS")
@@ -913,7 +916,9 @@ modified) list.")
 			    "\n" setup-contents "\n"
 			    (substring ext-setup-or-nil start)))))))
 	(setq p (plist-put p :text text))
-	(if style (setq p (plist-put p :style-extra style)))
+	(when style (setq p (plist-put p :style-extra style)))
+	(when latex-header
+	  (setq p (plist-put p :latex-header-extra (substring latex-header 1))))
 	(when options
 	  (setq p (org-export-add-options-to-plist p options)))
 	p))))

+ 1 - 0
lisp/org-export-latex.el

@@ -622,6 +622,7 @@ OPT-PLIST is the options plist for current buffer."
 			      (car p) (cadr p))))
 		  org-export-latex-packages-alist "\n"))
      ;; insert additional commands in the header
+     (plist-get opt-plist :latex-header-extra)
      org-export-latex-append-header
      ;; insert the title
      (format