Hello, I wondered if it was possible to include custom Latex packages when processing embedded LaTeX fragments in org. This would require only a simple change in org-create-formula-image:
(defun org-create-formula-image (string tofile options) (let* ((tmpdir (if (featurep 'xemacs) (temp-directory) temporary-file-directory)) (texfilebase (make-temp-name (expand-file-name "orgtex" tmpdir))) ;(texfilebase (make-temp-file "orgtex")) ; (dummy (delete-file texfilebase)) (texfile (concat texfilebase ".tex")) (dvifile (concat texfilebase ".dvi")) (pngfile (concat texfilebase ".png")) (scale (number-to-string (* 1000 (or (plist-get options :scale) 1.0)))) (fg (or (plist-get options :foreground) "Black")) (bg (or (plist-get options :background) "Transparent"))) (with-temp-file texfile (insert "\\documentclass{article} \\usepackage{fullpage} \\usepackage{amssymb} \\usepackage[usenames]{color} \\usepackage{amsmath} \\usepackage{latexsym} \\usepackage[mathscr]{eucal} XXX insert custom packages here \\pagestyle{empty} \\begin{document}\n" string "\n\\end{document}\n")) (let ((dir default-directory)) (condition-case nil (progn (cd tmpdir) (call-process "latex" nil nil nil texfile)) (error nil)) (cd dir)) (if (not (file-exists-p dvifile)) (progn (message "Failed to create dvi file from %s" texfile) nil) (call-process "dvipng" nil nil nil "-E" "-fg" fg "-bg" bg "-x" scale "-y" scale "-T" "tight" "-o" pngfile dvifile) (if (not (file-exists-p pngfile)) (progn (message "Failed to create png file from %s" texfile) nil) ;; Use the requested file name and clean up (copy-file pngfile tofile 'replace) (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do (delete-file (concat texfilebase e))) pngfile)))) This should be global or per-file options. The point is that there are plenty of good LaTeX environments that it would be useful to have in org (for instance algorithm or tikz). One of these environments is tikzpicture, and using tikzpicture in org would allow to create high-quality graphics in org documents. There is one remaining difficulty though; tikz pictures aren't extracted with dvipng. What do you think? Thanks, Matthieu Lemerre _______________________________________________ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode