Browse Source

LaTeX export: Apply macros also in header

Carsten Dominik 16 years ago
parent
commit
0dea2ba3df
3 changed files with 17 additions and 3 deletions
  1. 5 0
      lisp/ChangeLog
  2. 8 0
      lisp/org-exp.el
  3. 4 3
      lisp/org-export-latex.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2009-03-21  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-export-latex.el (org-export-latex-make-header): Apply macros
+	in header.
+
+	* org-exp.el (org-export-apply-macros-in-string): New function.
+
 	* org-export-latex.el (org-export-latex-list-parameters): Fix bug
 	with the definition of a checked box.
 

+ 8 - 0
lisp/org-exp.el

@@ -2365,6 +2365,14 @@ TYPE must be a string, any of:
 	(and (stringp val)
 	     (replace-match val t t))))))
 
+(defun org-export-apply-macros-in-string (s)
+  "Apply the macros in string S."
+  (when s
+    (with-temp-buffer
+      (insert s)
+      (org-export-preprocess-apply-macros)
+      (buffer-string))))
+
 ;;; Include files
 
 (defun org-export-handle-include-files ()

+ 4 - 3
lisp/org-export-latex.el

@@ -757,7 +757,7 @@ OPT-PLIST is the options plist for current buffer."
      (if (plist-get opt-plist :time-stamp-file)
 	 (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
      ;; insert LaTeX custom header
-     org-export-latex-header
+     (org-export-apply-macros-in-string org-export-latex-header)
      "\n"
      ;; insert information on LaTeX packages
      (when org-export-latex-packages-alist
@@ -768,8 +768,9 @@ 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
+     (org-export-apply-macros-in-string
+      (plist-get opt-plist :latex-header-extra))
+     (org-export-apply-macros-in-string org-export-latex-append-header)
      ;; insert the title
      (format
       "\n\n\\title{%s}\n"