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

Nasser M. Abbasi nma at 12000.org
Sun Dec 27 22:11:25 CET 2009


Hello Ross;

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


I'll try to make a small example to show the problem, but I need time since 
this is a large tree and large tex file. But all the graphics including code 
looks like this:

\begin{center}
\includegraphics[]

{e1/matlab/e1.png}

\end{center}



....



\begin{center}

\includegraphics[]

{e1/maple/e1.png}

\end{center}



I actually spent the last 6 or so hrs changing all the file names and the 
tex file making the names of the images unique. So the problem now do not 
exist. But I can reproduce it again.




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

Ok. Thanks for this info.

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

It starts like this
\documentclass[12pt]{article}%
\usepackage{html}

\usepackage{amsmath}

\usepackage{amsfonts}

\usepackage{amssymb}

\usepackage{graphicx}



Then just lots of



\section{bla bla}

\section{bla bla}

\section{bla bla}



etc...



and inside each section is where I include the images, with same name, but 
from different folders.


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

Yes. inside EACH section, I do
\begin{center}
\includegraphics[]

{e1/matlab/e1.png}

\end{center}



....



\begin{center}

\includegraphics[]

{e1/maple/e1.png}

\end{center}


Where in the above, "e1" corresponds to section "1". And I have folders 
called "e1" , "e2" , etc....
So within a section, the image names will be the same, but in different 
folders.

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

Thanks, I will try to repoduce it again.

--Nasser
>
> 



More information about the latex2html mailing list