My situation is like this. I have a LaTeX file that I want to compile with pdflatex and tex4ht, which includes a package in another directory.

The file bug.tex contains:




Test: \aaa.


The file subdir/mypackage.sty contains:


and the file subdir/mypackage.4ht contains:


When I compile with pdflatex, I get Test: AAA. in the output. But when I compile with make4ht, I still get Test: AAA. instead of Test: BBB.

(When the package is in the working directory, it works as expected.)

This indicates to me that, when using tex4ht, the redefinition of input@path occurs, but when including packages, tex4ht doesn't search it for .4ht files.

Can anyone help me work around this?

Of course, you are probably thinking that I'm doing this wrong, and I should put the package in my texmf, or set $TEXINPUTS correctly, and you would be right. But I have a complex project that I will need to share with colleagues who I can't expect to use make, so it would be much better if I can manage everything from within the tex files.


tex4ht didn't support the \input@path by default. I've just added the support to the sources, so it should be included in TL soon. It was necessary to change some core macros that are not possible to modify using a .cfg file. So until the update is available, you can use the following workaround:


The \InputIfFileExists command searches the \input@path and includes the required file if it is found.

The result:

enter image description here

| improve this answer | |
  • This is great, thank you for making this change so quickly! – Alex Watson Sep 29 '19 at 19:47
  • @AlexWatson you are welcome. I didn't know about the \input@path before, so it was also something new for me :) – michal.h21 Sep 29 '19 at 19:55

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.