Including image-files via knitr::include_graphics()
errors out if path is relative to project-root, but document-location is not at root
#10226
Replies: 1 comment
-
I have found a bad hotfix for this issue: By organising images relative to the notes which embed them, these notes get correctly rendered during single-renders, as well as directory- and project-wide renders to both html and pdf. The downside is that an image which is required elsewhere will have to be duplicated across multiple directories - and moving files around becomes substantially more frustrating. For these reasons, I'd much rather understand why the above is not working, and how I can rectify this in a more stringent manner. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hello,
I feel like I am going crazy.
Assume I have a website-project, and within it I have a file
file.qmd
at root-level:The image exists under the path described, relative to the project root.
This renders correctly in html and pdf when executing
quarto render .\file.qmd
.If I create an identical file in e.g.
experiments/file.qmd
, and repeat the process, this file is no longer found, and the following error is issued when converting to pdf:When trying to convert to html, I don't receive an error, but the resulting webpage will not render the image:

Contrary to that, when I target the root-level file
file.qmd
, it converts successfully to both html and pdf:To my understanding, with the config-setting
execute-dir: project
, paths should be reconstructed from the project's root-level. I don't understand<root>/assets/obsidian-assets/photobox_overview_gfa_coords.jpg
, norCan someone help me make sense of this?
Thank you.
Sincerely,
~Gw
Project yaml:
The logfile contains:
LaTeX Warning: File `assets/obsidian-assets/photobox_overview_gfa_coords.jpg' not found on input line 224. ! Unable to load picture or PDF file 'assets/obsidian-assets/photobox_overview_gfa_coords.jpg'.
I am running quarto v.1.5.52.
A reprex for this issue can be found at https://github.com/Gewerd-Strauss/quarto-cli-10226. Refer to its readme for reproduction steps.
Beta Was this translation helpful? Give feedback.
All reactions