0

when I export a full path figure , like: [[file:c:/Users/admin/Desktop/1.png]]

to LaTeX in org-mode, a result of {//c:/Users/admin/Desktop/1.png}

was generated. One more // was generated in front of c:, which is an error in LaTeX.

How can I solve this problem?

I have posted this problem to org-mode mail list, but nobody replied me, so I continued to ask here. Thanks for any help.

  • In cygwin environment one could use /cygdrive/c instead of c:. – Tobias Jan 29 '15 at 6:56
  • Thanks, but my windows hasn't cygwin installed. Sorry, I realized it is a windows relevant problem. @Tobias – Leu_Grady Jan 29 '15 at 6:58
  • I just tried [[file:c:/temp/1.png]] and got \includegraphics[width=.9\linewidth]{c:/temp/1.png} % Emacs 24.4.1 (Org mode 8.2.7c). – Tobias Jan 29 '15 at 7:02
  • @Tobias It is weird. I tried again and again just now, but still same problem. Is there any other special config for your org-mode? or you use Cygwin? – Leu_Grady Jan 29 '15 at 7:13
  • Just tried with emacs -Q (emacs without customization) under Cygwin. Delivers \includegraphics[width=.9\linewidth]{c:/temp/1.png} % Emacs 24.4.1 (Org mode 8.2.10). As you see: other org-mode version but same result. – Tobias Jan 29 '15 at 7:16
0

This bug has been fixed in org-mode 8.3.1.

0

This bug exists in version 9.x.x when exporting to html

And I fixed the bug by changing this function and compiling ox.el

(defun org-export-file-uri (filename)
  "Return file URI associated to FILENAME."
  (cond ((string-prefix-p "//" filename) (concat "file:" filename))
    ((not (file-name-absolute-p filename)) filename)
    ((org-file-remote-p filename) (concat "file:/" filename))
    (t
     (let ((fullname (expand-file-name filename)))
       (concat (if (string-prefix-p "/" fullname) "file://" "file:///")
           fullname)))))

Just replace "file:///" into "file://".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.