Hi, I was editing an org document on a server earlier today, remotely using tramp, and continuously exporting it to html. When I added LaTeX, it exported once and then not anymore, failing because it couldn't create a directory anymore. So I found out that patching org-export-latex to pass a "t" parameter to org-make-directory fixes this, and it continues to work perfectly. This is the modified version of that function, if anyone else is interested in this constrained case. The only change I made was right under the "make sure directory exists" comment.
(defun org-format-latex (prefix &optional dir overlays msg at forbuffer) "Replace LaTeX fragments with links to an image, and produce images." (if (and overlays (fboundp 'clear-image-cache)) (clear-image-cache)) (let* ((prefixnodir (file-name-nondirectory prefix)) (absprefix (expand-file-name prefix dir)) (todir (file-name-directory absprefix)) (opt org-format-latex-options) (matchers (plist-get opt :matchers)) (re-list org-latex-regexps) (cnt 0) txt link beg end re e checkdir m n block linkfile movefile ov) ;; Check if there are old images files with this prefix, and remove them (when (file-directory-p todir) (mapc 'delete-file (directory-files todir 'full (concat (regexp-quote prefixnodir) "_[0-9]+\\.png$")))) ;; Check the different regular expressions (while (setq e (pop re-list)) (setq m (car e) re (nth 1 e) n (nth 2 e) block (if (nth 3 e) "\n\n" "")) (when (member m matchers) (goto-char (point-min)) (while (re-search-forward re nil t) (when (and (or (not at) (equal (cdr at) (match-beginning n))) (not (get-text-property (match-beginning n) 'org-protected))) (setq txt (match-string n) beg (match-beginning n) end (match-end n) cnt (1+ cnt) linkfile (format "%s_%04d.png" prefix cnt) movefile (format "%s_%04d.png" absprefix cnt) link (concat block "[[file:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unless checkdir ; make sure the directory exists (setq checkdir t) (or (file-directory-p todir) (make-directory todir t))) (org-create-formula-image txt movefile opt forbuffer) (if overlays (progn (setq ov (org-make-overlay beg end)) (if (featurep 'xemacs) (progn (org-overlay-put ov 'invisible t) (org-overlay-put ov 'end-glyph (make-glyph (vector 'png :file movefile)))) (org-overlay-put ov 'display (list 'image :type 'png :file movefile :ascent 'center))) (push ov org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end) (insert link)))))))) -- - Alexandre _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode