I have a document that is to be compiled in PDF (using pdflatex) and XHTML (using tex4ht). For the XHTML version, I wish to have the images linking to their source in a new window (target="_blank").

Now, this is perfectly possible by some fiddling with \HCode, but I prefer not having to write this every time when I include a graphic in my TeX source.

Is there a \Configure command I can use in my tex4ht config file, so that an a-tag is wrapped around the resulting img-tag automatically?

Note: I noticed \Configure{IMG}, but I assume that's for generated images, + there is not clear "image source" variable I can use.


1 Answer 1


Based on tex4ht faq:

Create custom config file:

        {\Link[\csname Gin@base\endcsname .png target="_blank"]{}{}%  
           \Picture[pict]{\csname Gin@base\endcsname .png
              \space width="40px" height="40px" }%  

compile with htlatex texfile customcfgfile

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.