[l2h] Relative/Absolute paths of images and failure when the images are accessed by the variable $TEXINPUTS

Ross Moore ross at ics.mq.edu.au
Wed Jan 20 23:02:32 CET 2010

Hello Mark,

On 21/01/2010, at 6:27 AM, Mark Duke wrote:

> Hi All,
> I use pdflatex and latex2html to convert my tex files into pdf and  
> html . My goal is to use exactly the same tex files for both  
> programs and to keep the use of the environments {latexonly} and  
> {htmlonly} to a minimum. I use a lot of screenshots which are in  
> png (fine for pdflatex) format to avoid having to convert them  
> during the latexh2mtl run. I previously used eps files, but the  
> conversion quality was not great and seeing as I have them in png  
> format then there is no need to convert them during a latex2html  
> run. I have managed to generate html files using the png files as  
> input, but only when the png files were located in the same  
> directory as the tex files. I want to access my png files by adding  
> the respective directories via the $TEXINPUTS variable.

Have you thought about using symbolic links to your images?
Do a 1st run of  LaTeX2HTML, using the  -no_images  switch so that
it creates the target directory, but does not generate any images.
Then go into that directory and create symbolic links to all of
your PNG graphics.
Now your  \htmladdimg  commands can use relative links to the images,
without worrying about whether they will be accessible on the web.

> If the files are accessed in this way, i.e. not in the same  
> directory as the tex files, then latex2html tries to convert them  
> and fails. Does anyone know why it tries to convert them? With eps  
> files they were converted to png's with names such as img1.png,  
> img2.png etc. Is it possible to access png files via the $TEXINPUTS  
> or do they have to be placed into the directory where the tex files  
> are located?
> The other question I had is to do with the paths to the images.  
> When the png files are parallel to tex files then the translator  
> works fine with the exception that the paths to the images which  
> are included are absolute, e.g in the generated html the pictures  
> are referenced as follows:
> node2.html: SRC="/scratch/simdoc_build/pdflatex_8904/develop/extern/ 
> install/all_in_one//install_lic_install_configure_ini_tab.png"
> Is it possible somehow to tell the translator that the paths should  
> be relative? Is there a latex2html option which I haven't seen? The  
> icons (relative path in the variable $ICONSERVER) and converted  
> equations are accessed how I want them via relative paths, e.g.:
> node2.html: SRC="../icons/crossref.png"></A>.
> node2.html: SRC="img1.png"
> The best solution for me would be if the translator copied the png  
> files directly into the directory where the html is generated

   Using symbolic links achieves the same thing, without making 2nd  
copies of the files.

> and they were given the names img1.png, img2.png etc. This would be  
> similar to how the translator behaves with eps files, but obviously  
> without having to convert them from eps to png using the tool  
> 'pstoimg'. Do you know if this is possible? The translator I am  
> using is not the newest, 'This is LaTeX2HTML Version 2K.1beta  
> (1.62)'. Maybe a newer translator has this functionality?
> Thank you very much for your help.
> Best regards,
> Mark

Hope this helps,


Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the latex2html mailing list