[l2h] using includegraphics[] with image files having same names but in different folder?

Ross Moore ross at ics.mq.edu.au
Sun Dec 27 21:50:28 CET 2009


Hello Nasser,

On 27/12/2009, at 3:48 AM, Nasser M. Abbasi wrote:

> Using latex2html 2008.
>
> I just found a nasty problem. I am trying to convert a large latex  
> file to html using latex2html.
>
> I have lots of images in different folders. in my latex file I have  
> things like
>
> \includegraphics[]{A/e4.png}
> \includegraphics[]{B/e4.png}


> But because the image file itself is called the same (e4.png in  
> this example), even though there are different and in different  
> folders, one image will end up overwriting the other during the  
> conversion. I guess because l2h puts all the images during  
> conversion in one folder (the tmp folder). So in the final html  
> file, only one image is shown and duplicated.

No. This cannot be the reason, as LaTeX2HTML does no such copying.

Presumably those  \includegraphics  commands occur within some kind
of environment, such as a {figure} or {minipage} .
The image is then made of the whole environment, not just
of the included graphic (unless you take LaTeX2HTML-specific
steps to alter this behaviour).

Please show some examples from your source code,
showing exactly how these included images occur,
within (sub-)sections and environments.


Of most interest is the  graphics.pl  file.
This contains the HTML code used to include each image in
the final HTML pages. Each bit is associated to a database 'key'
which is constructed from the LaTeX source coding for the
image --- usually the whole environment.

It is this key that needs to be unique to get different images.


>
> So, this means, I have now to go and changes all image files names  
> in all the folders I have and make each unique file name!

Although this would be a solution, it should not actually be necessary.

>
> I have 100's of such images and have to edit the latex file and  
> make the corresponding changes as well.

How is your LaTeX source structured?
Do you have different chapters or sections in different files
(e.g., using the \include command), or have you thrown everything
in together?

Are the different graphics directories specific to different
sections? If so, then using LaTeX2HTML's "segmented document"
features would most certainly have avoided this problem.

>
> Is there a trick to make l2h handle such case? I am trying to avoid  
> having to do the renaming and editing if possible.

There are several possibilities.
But first we need to know exactly what is going wrong.
You have not provided enough information about your
coding to deduce the exact context in which something
is failing.


>
> My command is
>
> latex2html -split 4 -show_section_numbers -subdir -local_icons   
> mim.tex

The -subdir  should be redundant, as this is the usual default.

Whenever you have difficulties in the translation, then you
can get more information using  -debug <num>  (e.g. -debug 1 ).
The higher is <num> then the more extra information is written
to the log output.
In particular, the temporary files are not deleted, so you can
have a look at much of the intermediate information.

With graphics, also use the  -reuse 0  switch.
This will force all the images to be remade, as well as
having  -debug  retain the intermediate files.

>
> thank you,
> --Nasser


Hope this helps,

	Ross

------------------------------------------------------------------------
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