Thursday, 7 April 2011

gnuplot, eps, and latex

I work on multiple machines. One of them is running Window XP. Also I need to do plenty of latex document writing. Apparently there is no straight forward easy way to include eps into latex (I did not find one). So I need to convert them into pdf first. The problem I had with gnuplot was the eps figures it was generating were fine in Linux but were strange on Windows machine. I use GhostScript to view eps. Instead of full-fledge landscape mode, the graphs were always in lower left quarter of the full page.

This was very annoying because it had quite a bit of free space with it. Not to mention scaling and rotation issues when writing a paper. The same figure was fine in "evince" on Linux. So I need to get a quick way to figure out how to export graphs into pdf landscape mode without leaving any white space.

This was rather easy but took me some time to figure out. On package "texlive-latex" on Fedora, they have a utility command called epstopdf which does exactly the same thing.

Try it out. It is pretty handy. 


  1. Even pstopdf converts eps to pdf

    use this command "ps2pdf -dEPSCrop file.eps"

    -- Ashwin

  2. to include eps graphics, just use the usual \includegraphics{ }. Then compile with "latex" instead of "pdflatex". Then convert the "dvi" output to "pdf" with the command "dvipdf" and your pdf paper with an eps figure is ready.