abo-abo / org-download

Drag and drop images to Emacs org-mode
1.08k stars 78 forks source link

export issue with org-download-method directory #151

Open wang1zhen opened 3 years ago

wang1zhen commented 3 years ago

Here is my configuration (in Doom Emacs) for org-download:

(after! org-download
  (setq org-download-method 'directory
        org-download-image-dir "."
        org-download-heading-lvl 0
        org-download-timestamp "%Y-%m-%d_%H-%M-%S_")
  )

when I paste an image into an org file, everything seems to be fine, yet if I export the org-file to latex, the images are treated as URLs instead of graphics. Is it possible to fix?

the left buffer shows the org file and the right buffer shows the latex buffer: 图片

abo-abo commented 3 years ago

Looks like an issue in Org to LaTeX export.

I tried to reproduce by recreating the same Org document and using the image you attached.

Here's what I got in LaTeX:

\includegraphics[width=.9\linewidth]{org-download/2021-01-05_20-13-12_103504956-e5f30480-4e93-11eb-9ee9-f981da441aed.png}

Your issue is that _ gets transformed into \_ during export. Maybe somewhere in your config there's a setting for this.

wang1zhen commented 3 years ago

Thank you, yes this might be an issue with org-mode export, and it works if I use the attach method. I'll try to figure out the actual problem later.

图片

alinmear commented 2 years ago

I am having issue with the directory org-download-method on export too.

(require 'org-download)
(setq-default
 org-download-method 'directory
 org-download-image-dir "images"
 org-download-heading-lvl nil
 org-download-timestamp "%Y%m%d-%H%M%S_")

tried export to html and to pdf. On both exports no images are shown. I only see the reference to the image.

zhyzky commented 1 year ago

Same problerm here. Only effects on [[download:]] link, [[attachment:]] link seems work well. Any fix for this?

zhyzky commented 1 year ago

Same problerm here. Only effects on [[download:]] link, [[attachment:]] link seems work well. Any fix for this?

Hope this could help someone. I've found it's caused by doom emacs which changes some origin org-download settings. Following code revert this change.

  (setq org-download-link-format "[[file:%s]]\n"
        org-download-abbreviate-filename-function #'file-relative-name)
  (setq org-download-link-format-function #'org-download-link-format-function-default)
danielkrajnik commented 1 year ago

@zhyzky thank you very much, I've spent 6 hours trying to solve this issue. Your snippet fixed it!