# Latex, Texlipse, and EPS Figures

I’m currently in the early stages of writing my PhD thesis. I’m writing it using LaTeX, and I’m trying to get the perfect build system and editing environment going. Yesterday I had a look at Texlipse, a plugin for Eclipse. There was one problem: EPS figures didn’t work.

In newish versions of Latex, if you use the epstopdf package, your images are converted on the fly, but this wasn’t  working in Texlipse. Luckily the fix is easy, and the rest of this post explains what to do.

\documentclass{minimal}
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage{graphicx}

\begin{document}

Here's an EPS Figure:

\includegraphics[height=5cm]{unisa}

\end{document}

Download unisa.eps, and try this yourself. On Ubuntu, I get output that looks like this:

If you look at the console output generated by TexLipse, you will see one of two problems, described below.

### Problem 1: Shell escape feature is not enabled

I encountered this problem on Ubuntu. If you see the following output:

pdflatex> Package epstopdf Warning: Shell escape feature is not enabled.

Then you have encountered this. The fix is quite easy.

1. Open up Eclipse Preferences
2. Click on Texlipse Builder Settings
3. Click on PdfLatex program, and press the edit button
4. Add –shell-escape to the argument list as the first argument.
5. You’re done! Rebuild your project and it should work fine.

### Problem 2: Cannot Open Ghostscript

I encountered this problem on OSX. Weird how the two systems have the same symptoms with different causes, but whatever. If you see the output:

pdflatex> !!! Error: Cannot open Ghostscript for piped input

Then you are suffering from problem 2. This problem is caused by the PATH environment variable not being set correctly when Texclipse runs pdflatex. Essentially, the Ghostcript program, gs, cannot be found by pdflatex. The fix is to add an environment variable to Texlipse’s builder settings so the path is corrected.

#### Step 1: Locate Ghostscript, Repstopdf, and Perl

Open up a terminal, and type:

which gs

This should show you the directory where Ghostscript lives on your system. On my laptop it is:

/usr/local/bin

Repeat the process with repstopdf:

which repstopdf

Which on my system gives:

/usr/texbin

And with perl:

which perl

gives me:

/opt/local/bin

The exact paths will depend on how you have installed these things. For example, Perl lives in /opt on my system because I installed it using macports. It doesn’t really matter. However, if you don’t have any of these packages installed, you will need to do so.

#### Step 2: Create the Environment Variable

Now that we know where the programs are installed, we need to create a PATH environment variable for Texlipse to use.

1. Open up Eclipse Preferences
2. Go down to Environment, which is under Texlipse Builder Settings
3. Click new to create a new environment variable
4. the key should be set to PATH. The value should be the three directories, separated by colons (:). For example, on my system:
5. You’re done! Save the settings and everything should work.

### Conclusions

If you complete the steps above, depending on what problem you had (you may have even had both), then you should see the correct output, which looks like this:

Well, I hope that helps someone. Its surprising that this error came up on both of my computers. Searching the internet finds others with the same problem, but as yet no solutions. This post should fix that.

Posted on June 15, 2011ResearchTags: eclipse, eps, epstopdf, figure, latex, mac, osx, texlipse, ubuntu