On Feb 24, 2010, at 5:37 PM, Ray Brownrigg wrote:

> On Thu, 25 Feb 2010, Lars Bishop wrote:
>> Hi,
>> 
>> I'm new in Latex and I'm trying to include an R chart into a Latex
>> document.
>> 
>> This is what I'm doing:
>> 
>> 1) In R: save the chart as a a Postcript in a folder C:/xxx/Density.eps
>> 
>> 2) In Latex (using TexWorks on windows xp) :
>> 
>> In the preambule:
>> 
>> \documentclass[11pt]{article}
>> \usepackage{graphicx}
>> \begin{document}
>> 
>> blah..blah…blah
>> 
>> \begin{figure}
>> \centering
>> \includegraphics{C:/xxx/Density.eps}
>> \label{fig:Density}
>> \end{figure}
>> 
>> --This is the Error Message I'm getting:
>> 
>> LaTeX Warning: File `R:/MarsTH/Studies/Misc/LIA QA/R/Density.eps' not found
>> on
>> 
>> input line 26.
>> 
>> ! LaTeX Error: Unknown graphics extension: .eps.
>> 
> I've seen that message (recently, but on a Mac) when running pdflatex.
> 
> Are you sure you don't have an option set that specifies using pdflatex 
> rather than latex?
> 
> HTH,
> Ray


Remove the ".eps" extension in your LaTeX code:

 \includegraphics{C:/xxx/Density}
  

Also, be sure that you have created the EPS file using the correct arguments to 
postscript() as noted in the help file:

  postscript("Density.eps", onefile = FALSE, horizontal = FALSE, 
             paper = "special", width = XXX, height = XXX)
  
   Your Plotting Code

  dev.off()


As Ray noted, be sure that you are using 'latex' and not 'pdflatex' to process 
the .tex file, as the latter will expect PDF files and not EPS files. 
Typically, unless you are using special postscript markup in LaTeX (such as 
PSTricks), you can create PDF plot files in R (using pdf()) and then process 
the result with pdflatex. It saves some intermediate processing steps using 
dvips and ps2pdf.

For more information on including EPS figures in LaTeX documents, there is a 
great document available here:

  http://www.ctan.org/tex-archive/info/epslatex/english/

You want to download epslatex.pdf.

HTH,

Marc Schwartz

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to