[tex4ht] htlatex testa "html,imgdir:images/"

Michal Hoftich michal.h21 at gmail.com
Wed May 21 11:57:10 CEST 2014

Dear Ever,

it seems that `imgdir` option is only adding the parameter to `src`
attribute of images. So when you use `\includegraphics{world.png}` and
`imgdir:hello/`, `<img src="hello/world.png" ...>` will be produced. Image
`world.png` must be placed in directory `hello` by yourself, it isn't done
by `tex4ht`.

I've done some tests. Test file `test.tex`:

file `world.png` is placed in directory `hello`. Then I've created output
directory `out`. When I compiled test file with

htlatex test "xhtml,imgdir:hello/" "" " -dout/"

which should copy used files to the `out` directory, file `world.png`
wasn't copied at all. The cause of this is that `imgdir` only add the path
to generated html, not to the path used `\includegraphics`, so it cannot
find the image and the image isn't processed in the latter stages of the
compilation. This also means that image dimensions cannot be used in the
`<img>` element.

So in my opinion, it is better not to use `imgdir` option, for images in
subdirectories just use `\includegraphics{hello/world.png}`.  Also note
that if you use `-d` option for copying files to the output directory, all
output files will be copied to that directory, including images in
subdirectories. But paths in `<img>` elements will stay untouched, so
images won't be displayed.

Best regards,

2014-05-20 20:01 GMT+02:00 Ever Barbero <wva250 at gmail.com>:

> I have MikTeX freshly installed in c:\texmf\
> This works, and creates all the files, .html and .png, but all the .png
> files are left in the work directory:
> >htlatex testa
> But I cannot make this work:
> >htlatex testa "html,imgdir:images/"
> or
> >htlatex testa "html,imgdir:images\"
> or
> >htlatex testa "html,imgdir:./images/"
> or
> >htlatex testa "html,imgdir:.\images\"
> I tried creating the directory ./images/ myself, then I deleted it, no
> luck either way!
> What can I do?
> E. J. Barbero
> http://barbero.cadec-online.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tex4ht/attachments/20140521/9d7a200b/attachment-0001.html>

More information about the tex4ht mailing list