In org-mode, how to keep the original image path when using # + INCLUDE :?

I can use:

# + INCLUDED:

include the org file in another org file, which allows me to build, say, a website from various org files. I am exporting from a Cc Ce exporter to org-mode 7.5.

I could conduct a rather complicated publication in this way. This modular approach is fairly common, such as LaTeX and Texinfo Publications.

However, image links no longer work with org # + INCLUDEd files. It seems that there is a way that the path to the images is taken from both the org file that I export, and not from the actual org file that refers to the image.

The only ways I can solve this are:

  • use a flat file structure; or
  • make the image path from the link file (which I might not know in advance), and not myself.

None of them are truly sustainable.

How to tell org to use the correct image path from its own org file, and not the parent org file?

+4
source share
1 answer

From what I know about export, INCLUDE files are inserted into the document before export. Therefore, the content is part of the document before it begins to follow the paths for accessing any links to files (images).

After a little testing, you probably need to use absolute file paths. As you switch between Windows and Linux, the best option would be to use a consistent scheme starting from your home directory.

How can you make the link Org: [[~/path/to/image.jpg]] , which will work on both systems (provided that you installed% HOME% on Windows).

Option 1 is potentially an alternative (although I agree that it would not be perfect at all), while the second option would have obvious traps if you include the file in more than one future document.

+1
source

All Articles