[tex4ht] How to \includegraphics using absolute path with tex4ht?

Nasser M. Abbasi nma at 12000.org
Sun Oct 8 13:12:18 CEST 2023

On 10/8/2023 5:38 AM, Nasser M. Abbasi wrote:
> Is there a way to make copy_images adjust the "src=" automatically
> to new copy location?

I think there is a better solution to all of this. no need
to copy images and do any of this.

There are tools that automatically converts absolute path to relative path.
I only use Linux to build.


and so on.

So given the example I have


If make4ht can detect that the image path is absolute (i.e. it starts with /),
and since current directory is always known "." then it can do

     realpath --relative-to=. /mnt/g/public_html/my_notes/images/my_image

To automatically generate relative path and use that in the src= for the image
which could look now something like


as an example. I just tried it on a real path and it works


>realpath --relative-to=.  /mnt/g/public_html/my_notes/solving_ODE/current_version/images/king_billingham_otto_2003.svg


May be even lua can be used to automatically convert absolute path in
\includegraphics to relative one?




This will solve all the problem.


More information about the tex4ht mailing list.