I am hoping someone here can give me a hint about this error. I am not really sure this is latex problem, but part of the software that I am using to process the latex document.

The setup is very simple. one eps file of a plot created from Mathematica software and then exported to eps.

One tex file that includes this graphics file. I want to make HTML of this using htlatex.


The eps file is valid, in the sense that I can open it using many apps and view it. gsview, etc..

I can run latex fine on it, and looking at the file .ps file, the image is there. pdflatex also work. Image is in the final pdf file.

Only htlatex foo.tex gives this error, in dvipng processing

>htlatex foo.tex 
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
System call: dvipng -T tight -x 1400 -D 72 -bg Transparent -pp 1:1 foo.idv 
-o foo0x.png
This is dvipng 1.14 Copyright 2002-2010 Jan-Ake Larsson
dvipng warning: DVI magnification of 1000 over-ridden by user (1400) 
GPL Ghostscript 9.06: Unrecoverable error, exit code 1
--- Warning --- System return: 36096
Entering foo.css
Entering foo.tmp

So, I am not sure why this error happens on this one .eps file generated by Mathematica.

Other eps files work with no problem with htlatex. I mean other eps files generated by other apps. Only the images exported by Mathematica to eps seem to give htlatex a problem.

Is it possible the type of eps file generated by Mathematica is not supported by dvipng?

Is this a problem with dvipng or with Mathematica not generating eps files with the right format? But then why I can open the eps file just fine with other applications?

I have put the above tex file and the .eps file in this folder at my site if someone would like to give it a try http://12000.org/tmp/v6/

When I open the eps file using text editor, it looks a little strange, as it seems to have some non-ascii chars in it,in the first line. But this is how it was generated. Here is a screen shot of top of the eps file.

enter image description here

The question is: What is the cause of this error from dvipng?

1 Answer 1


This is not pure *.EPS, but EPS with a preview. If you remove the text before %!PS-Adobe (and after %%EOF, if exists), all should work fine. And in the future you should generate EPS files without preview.

  • Thanks. I did not know there was eps with preview and one without it. I was simply using the Mathematica UI, and selecting the image on the screen, then right-click and selecting save as EPS. There was no option for preview or no preview. I changed now the way I am exporting the image and instead of using the UI and the mouse, now I export the image using the command Export["mma_e1.eps", plot] and now the eps file worked fine with htlatex ! the preview part is gone. (How a user was supposed to know this difference?). Now I know and will export images using the export command from now on.
    – Nasser
    Commented May 6, 2013 at 22:04
  • Having the same issues as well. Have many .pdf and some .eps in my converted_graphics folder, and very few are being picked up. There is an error message during run time of tex4ht, error #4, which is occurring for each .eps. My guess is that text4ht by default does not see .eps, or cannot handle them?
    – user62494
    Commented Jun 9, 2019 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .