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.
Lets start with a minimum working example to demonstrate the problem:
Here's an EPS Figure:
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.
- Open up Eclipse Preferences
- Click on Texlipse Builder Settings
- Click on PdfLatex program, and press the edit button
- Add –shell-escape to the argument list as the first argument.
- 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:
This should show you the directory where Ghostscript lives on your system. On my laptop it is:
Repeat the process with repstopdf:
Which on my system gives:
And with perl:
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.
- Open up Eclipse Preferences
- Go down to Environment, which is under Texlipse Builder Settings
- Click new to create a new environment variable
the key should be set to PATH. The value should be the three directories, separated by colons (:). For example, on my system:
- You’re done! Save the settings and everything should work.
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.