Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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 '12 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 '12 at 14:08

1 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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