I am trying to insert images into an org-file using absolute paths (which include spaces) and a description, and then export them to PDF via LaTeX.
I am entering the link using C-c C-l
, which should deal with the spaces itself, and I have tried it with and without the file: prefix - although that shouldn't make a difference.
I have also tried inserting the link by selecting the file through emacs itself, using C-u C-c C-l
, but the results is the same.
I have also tried changing the path to escape the spaces, and using a URL style path, all to no avail.
The closest thing I can get to a solution so far is to not include a description, e.g. [[[file:path/to/file.png]]]
, which does insert the image, however it also inserts the full path as text, wrapped around the image.
Attempts so far:
Base link: /Home/Images/Emojis once extracted/example.png
[[file:/Home/Images/Emojis once extracted/example.png][Test1]]
[[file:/Home/Images/Emojis\ once\ extracted/example.png][Test2]]
[[/Home/Images/Emojis\ once\ extracted/example.png][Test3]]
[[file:///Home/Images/Emojis%20once%20extracted/example.png][Test4]]
[[file:/Home/Images/Emojis\ once\ extracted/example.png]] ## Test5
Here is a preview of the org buffer:
I have org-version 8.2.10 running in Emacs 24.5
Edit 1:
Using the org function C-u C-c C-l
(universal add link), and with no description, the image is placed in the pdf. However, if there are any spaces in the link to that file, then all characters following that space are also inserted to the pdf alongside the image.
Here is an example of the PDF output from this line of code in the org file:
#CAPTION: A funny image
[[file:/path/to_file 4.png]]
Edit 2:
If I escape the spaces in the path, there is an error (found in buffer: *Org PDF LaTeX Output*
, which is a package error, but says it cannot find the image and the following is produced in the PDF output:
Edit 3:
@John Kitchin 's answer below worked well for me. I also came across a customisation of his for drag-n-drop
functionality that also solves this problem and adds even better functionality. I recommend people check out the full-description with code and the accompanying video!