[Tex/LaTex] Avoid eps to png conversion using mk4ht oolatex

conversionepsopen-officepngtex4ht

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 
  -i/usr/share/texmf/tex4ht/ht-fonts/ 
  ooffice/! 
  -cmozhtf 
--- 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 
  -p 
  -cooxtpipes 
  -coo 
(/usr/share/texmf/tex4ht/tex4ht.env)
--- 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?

Best Answer

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.