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.

Lets start with a minimum working example to demonstrate the problem:

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

Broken PDFLatex output on Ubuntu

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:

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:

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:

gives me:

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:

EPS Figure working!

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.

 

Published by

Michael Marner

My name is Michael, and this is my website. I am currently working as a Research Fellow at the University of South Australia's Wearable Computer Lab. I am also the chair of the board and an announcer at Adelaide based community radio station Three D Radio 93.7FM.

6 thoughts on “Latex, Texlipse, and EPS Figures”

  1. Thanks a lot, Michael. Very helpful article. I had the same problem as you described on Mac OS X and you’ve just saved my day.

  2. I have tried to add the “–shell-escape” to the Arguments list (–shell-escape -interaction=nonstopmode –src-specials %input) but after this I cannot use Eclipse (I have Eclipse Indigo). The Eclipse is building the workspace and the progres is all time 80%. Can you help me?

  3. Here is the content from my console:

    running: /usr/local/texlive/2011/bin/universal-darwin/pdflatex –shell-escape -interaction=nonstopmode –src-specials specification.tex
    pdflatex> This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
    pdflatex> restricted \write18 enabled.
    pdflatex> entering extended mode
    pdflatex> ! I can’t find file `âshell-escape’.
    pdflatex> âshell-escape
    pdflatex> -interaction=nonstopmode –src-specials specification.tex
    pdflatex> (Press Enter to retry, or Control-D to exit)

    I don’t know while the “–shell-escape” is interpreted as a file and while the building workspace is still 80%.

  4. Pingback: brain.flush();
  5. Thanks Pawel!!! You saved my life. Adding the PATH environment variable to my Texlipse installation on Mac OSX 10.6.8 saved my life!!!!! I was near to become crazy :))

Leave a Reply

Your email address will not be published. Required fields are marked *