I have a big set of eps images and I need to place them into an OpenOffice (odt) document. I wrote a simple script that creates a tex file containing these eps images and now I'm trying to convert it to odt format with:

mk4ht oolatex eps-images.tex

The problem is that all the images are converted to png format, thus becoming (ugly) bitmaps instead of (nice) vector images.

Reading the manpage of mk4ht, I see that there is an option to skip image conversion:

-p     Do not convert pictures

but this option doesn't apply directly to mk4ht but has to be passed to one of its sub-scripts: t4ht.

Looking at the conversion process with ps afxu (under Linux), the sequence of nested commands is:

\_ /usr/bin/perl /usr/bin/mk4ht oolatex eps-images.tex
   \_ sh -c /usr/share/tex4ht/htlatex eps-images.tex "xhtml,ooffice" "ooffice/! -cmozhtf" "-cooxtpipes -coo"
       \_ /bin/sh /usr/share/tex4ht/htlatex eps-images.tex xhtml,ooffice ooffice/! -cmozhtf -cooxtpipes -coo
           \_ t4ht -f/eps-images.tex -cooxtpipes -coo
               \_ sh -c dvipng -T tight -x 1400 -D 72 -bg Transparent -pp 40:40 eps-images.idv -o eps-images19x.png
                   \_ dvipng -T tight -x 1400 -D 72 -bg Transparent -pp 40:40 eps-images.idv -o eps-images19x.png

So the question is: how can I get a -p option down there to t4ht?

EDIT1: Thanks to CV Radhakrishnan for its answer! We're getting closer, but it still doesn't work.

If I run the command:

mk4ht oolatex eps-images ' '  ' '  ' -p'

starting from scratch, only with tex files in the main folder, the output of the last two scripts is:

tex4ht.c (2009-01-31-07:33 kpathsea)
tex4ht -f/eps-images 
--- warning --- Can't find/open file `ooffice/!.dvi'
--- error --- Can't find/open file `ooffice/!.dvi'
t4ht.c (2009-01-31-07:34 kpathsea)
t4ht -f/eps-images 
--- warning --- Can't find/open file `eps-images.lg'

and no odt file is created. So the -p option actually reaches the t4ht command, but something in the middle is still missing and the script doesn't complete.

Conversely, if I first run:

mk4ht oolatex eps-images

thus creating all the png images, and then run:

mk4ht oolatex eps-images ' '  ' '  ' -p'

all the png images are embedded into the final odt file (that is corrupt, however). So, it seems that someone in the middle still uses/needs the png images.

EDIT2: found another small hint here.

Conditional bitmap conversion for imported graphic files

Q. How to avoid the conversion of eps files to PNG’s, included through the \includegraphics{...} command’, each time the source file is run across tex4ht.

Compile your source with the command line ‘ htlatex filename "html,info" ’, and check the log file for the information provided there. In particular, the ‘\Configure{graphics*} {wmf} ...’ example may be adapted for dealing with eps files, where a conditional conversion is requested within the ‘\Needs{"..."}’ command (possibly indirectly through a call to a script for doing he job).

Can someone improve this solution?

  • See my answer here for a hint on how to achieve what you want. I'm still curious which vector format and which conversion utility you intend to use -- I couldn't get to work neither of PDF, SVG or EPS. Please share your experience!
    – krlmlr
    Dec 14, 2012 at 13:47
  • I was just trying to avoid the PNG conversion. I had EPS files at the beginning and I was trying to build a ODT file with EPS files within. Unfortunately I didn't manage to reach this goal and I've given up. As soon as I have some spare time I'll give a try to your method, thank you!
    – Avio
    Dec 14, 2012 at 14:08

2 Answers 2


The syntax for mk4ht is as given below:

mk4ht command file option1 option2 option3

command could be htlatex or mzlatex or oolatex of any one of the scripts provided by tex4ht.

option1 is passed on to tex4ht.sty (like html, xhtml, mathml ...)

option2 is passed on to tex4ht.env and tex4ht binary, the post-processor of *.dvi output.

option3 is those which are passed on to t4ht binary which creates images, css and executes shell specific stuff.

So your command will be:

mk4ht oolatex eps-images ' '  ' '  ' -p'

Please take care of the space before -p which is important.


I have an improvement to the answer - but still not the perfect solution probably.

I have used the configuration approach of krlmlr suggested here and it worked.:

(It is also probably the same thing suggested by your "hint")

I just wrote a configuration file, called my.cfg:

          \Picture[pict]{\csname Gin@base\endcsname.eps}

Then I ran

mk4ht oolatex test "my" " " " -p"

I got a test.odt file with the .eps image embedded, without conversion.

The only problem is that the image looked very small, as width and height were not specified. I looked at the content.xml file inside test.odt (which is just a .zip file really).

In the content.xml file, the lines which draw the image looked like this:

 text:name="fig" text:style-name="Figure"><text:p text:style-name="bigskip"/>

<!--l. 9
--><text:p text:style-name="Text-body"> <draw:frame draw:name="prova.eps" text:anchor-type="as-char" draw:z-index="0"><draw:image xlink:href="Pictures/prova.eps" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/><!--draw:name="pict"  


which is different compared to what you get when you let it convert the image:

 text:name="fig" text:style-name="Figure"><text:p text:style-name="bigskip"/>

<!--l. 9
--><text:p text:style-name="Text-body"><draw:frame draw:name="test0x.png" text:anchor-type="as-char" draw:z-index="0" svg:width="411pt" svg:height="195pt"><draw:image xlink:href="Pictures/test0x.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/><!--draw:name="  " 
name="test0x.png" src="prova.eps" svg:width="411.03561pt" svg:height="195.22935pt"  


Also, I've noticed that when including the unconverted eps image, you get a long pause when you first open the document and the zoom function also works very slowly.

So maybe it's not a good idea to embed .eps images into .odt.

I also noticed that when you manually create an .odt file and insert an eps image, the zoom works smoothly - but if you close the document and re-open it, then you get a long loading at the start and the zoom stutters. So this is probably an OpenOffice problem and not something related to the way we insert eps images via tex4ht.

Anyway, besides performance problems, the problem which still awaits a solution is: how do we get eps images into .odt with proper size (width/height)?

However, the main question is answered: use a configuration file and the -p option.

ADDENDUM (on why -p doesn't work you):
Notice that I used " " instead of ' ' in the mk4ht command.
Using ' ' actually gave me an error (different from yours).
Also, I notice in your output tex4ht -f/eps-images
Why that instead of tex4ht eps-images ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.