فهرست منبع

Make latex preview also use the packages in `org-export-latex-packages-alist'.

Carsten Dominik 15 سال پیش
والد
کامیت
f7e208da37
3فایلهای تغییر یافته به همراه21 افزوده شده و 1 حذف شده
  1. 6 0
      lisp/ChangeLog
  2. 4 1
      lisp/org-latex.el
  3. 11 0
      lisp/org.el

+ 6 - 0
lisp/ChangeLog

@@ -1,5 +1,11 @@
 2009-08-16  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-latex.el (org-export-latex-packages-alist): Fix
+	customization type.
+
+	* org.el (org-create-formula-image): Also use
+	`org-export-latex-packages-alist'.
+
 	* org-html.el (org-export-as-html): Fix bug in footnote regexp.
 	(org-export-as-html): Format footnotes correctly.
 

+ 4 - 1
lisp/org-latex.el

@@ -247,7 +247,10 @@ When nil, grouping causes only separation lines between groups."
   "Alist of packages to be inserted in the header.
 Each cell is of the format \( \"option\" . \"package\" \)."
   :group 'org-export-latex
-  :type 'alist)
+  :type '(repeat
+	  (list
+	   (string :tag "option")
+	   (string :tag "package"))))
 
 (defcustom org-export-latex-low-levels 'itemize
   "How to convert sections below the current level of sectioning.

+ 11 - 0
lisp/org.el

@@ -13984,6 +13984,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
 
 ;; This function borrows from Ganesh Swami's latex2png.el
 (defun org-create-formula-image (string tofile options buffer)
+  (require 'org-latex)
   (let* ((tmpdir (if (featurep 'xemacs)
 		     (temp-directory)
 		   temporary-file-directory))
@@ -14005,7 +14006,17 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
     (if (eq bg 'default) (setq bg (org-dvipng-color :background)))
     (with-temp-file texfile
       (insert org-format-latex-header
+	      (if org-export-latex-packages-alist
+		  (concat "\n"
+			  (mapconcat (lambda(p)
+				       (if (equal "" (car p))
+					   (format "\\usepackage{%s}" (cadr p))
+					 (format "\\usepackage[%s]{%s}"
+						 (car p) (cadr p))))
+				     org-export-latex-packages-alist "\n"))
+		"")
 	      "\n\\begin{document}\n" string "\n\\end{document}\n"))
+    (debug)
     (let ((dir default-directory))
       (condition-case nil
 	  (progn