Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to insert a figure using Sweave which is located in the path C:\Users\eccehomo\Documents\mi\fig1.png. I'm using the package knitrwhich has a function called fig.pathbut I'm getting many errors for such a simple thing! Here's one of the things I have tried:

<<fig1,fig=TRUE>>=
library(knitr)
f='C:/Users/eccehomo/Documents/mi/fig1.png'
@

\includegraphics{f}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Use \includegraphics{\Sexpr{f}}. LaTeX does not know the variables in R.

share|improve this answer
    
thanks for replying it worked! –  AP13 Jun 1 '13 at 7:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.