1

I have a question similar to this post.

I am trying to add a .jpg to a .Rnw file (compiling LaTex with RSweave and knitr). I've tried the following without success:

<<IMAG0387.jpg,fig=TRUE>>=
library(knitr)
f <- 'M:/QW Monitoring Team/GLRI toxics/Phase II/Wastewater Intensive/Sniffer/Leaf_Experiments/photos/IMAG0387.jpg'
@
\includegraphics{f}

I'm getting an error:

You can now run (pdf)latex on 'Sam_Report_Actual.tex'
Warning message:
file stem 'Sam_Report_Actual-IMAG0387.jpg' is not portable 
Running pdflatex.exe on Sam_Report_Actual.tex...failed

Note that Sam_Report_Actual is the name of the .Rnw file. I've checked C:\Program Files (x86)\MiKTeX 2.9\miktex\bin on my coputer and I have pdflatex.exe so I'm not sure what's going on. Suggestions?

  • Hay you tried the solution of the linked post? Test it with files and directories without any space or special character. – Fran Dec 11 '14 at 23:45
  • useful suggestion - but that doesn't solve it. – limno_sam88 Dec 16 '14 at 14:48
0

Sigh, since you have read the post that you linked to, why did you still write \includegraphics{f} (which is apparently wrong according to the answer to that post)?

Please post the full error message (presumably in Sam_Report_Actual.log), and avoid using absolute paths (always use relative paths if possible) and spaces in file paths (use _ or - instead).

  • Fixing the file path, that is, eliminating the use of _ and - in conjunction with the use of \includegraphics{\Sexpr{f}} helped solve the problem. – limno_sam88 Dec 16 '14 at 15:04

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.