[l2h] counter for figures

Ross Moore ross at ics.mq.edu.au
Tue Feb 11 20:47:03 CET 2003

Hello Christian,

> hello Ross,
> here is one example of a code:

You are mixing physical and logical markup,
to place the caption side-by-side with the image.

In HTML the <CAPTION> can only be placed above or below,
so the use of \parbox just gets in the way.

Adjust your coding as follows:
 & \parbox[b]{.45\textwidth}{%
\caption[Struktur des H$_2$O$_2$-Molek\"uls.]
 {\small Struktur des H$_2$O$_2$-Molek\"uls. \newline
 Die vier Atome des Molek\"uls bilden eine verdrillte Kette.
 Durch die Verdrillung wird die Abstossung der freien Elektronenpaare der
 Sauerstoffatome verrringert. Die noch vorhandene Abstossung ist die
 Ursache f\"ur die geringe Bindungsenergie der O--O-Bindung.}%
 }% end of \parbox

This should not change the result from LaTeX,
and it lets LaTeX2HTML see just:

\caption[Struktur des H$_2$O$_2$-Molek\"uls.]

and do something sensible with it.
The figure number for the caption will be correct provided the caption
can be matched with what has been written into the .aux file for the
whole job, when processed by LaTeX.

BTW, did you consider using  \begin{tabular}{cp{.45\textwidth}}
or  \begin{tabular}{cb{.45\textwidth}}
along with  \usepackage{array}  and/or  \usepackage{tabularx}  ?

> The small picture is placed inside a tabular to get the caption
> on the right free space. The parbox makes an image of the caption.

Logically it is not a caption, but simply a picture.
This will upset the book-keeping for the document-structure.

> The current figure number in the latex version is 70, in LaTeX2HTML
> it is No 9 (due to previous similar occurences). No 70 is missing
> in the l2h, No 71 is ok again.

The #9 comes from counting \caption occurrences within the images.tex
file. It is not related to the numbering of figures within the HTML,
since not all figures have their captions processed this way.

LaTeX2HTML has not been programmed to adjust the {figure} and {table}
counters for each image, since this could easily conflict with the
image-reuse mechanism. 

Perhaps the LaTeX coding for an image could be scanned for '\caption'
and the counters set when this occurs. But doubtless there are cases
where this would conflict with something else.

Personally, I think it best that you adjust your LaTeX source to avoid
including the values of counters inside images --- the counter value
is *not* part of the content of the figure, but merely part of the
book-keeping which governs the overall document structure.

> The URL of the resulting HTML page is
> http://www.cci.ethz.ch/vorlesung/de/al2/node35.html
> Each time the caption is displayed as an image, the
> "image caption counter" is used instead of the figure counter.
> All "image captions" are listed in images.aux:

The "image caption counter", as you call it, is the value of the {figure}
counter for the images.tex run.  It is not part of the sequential numbering
of images for the job as a whole.
Besides, it is not being displayed within HTML <CAPTION> ... </CAPTION>  tags,
which is where captions belong.
> \@writefile{lof}{\contentsline {figure}{\numberline {9}{\ignorespaces
> Struktur des H$_2$O$_2$-Molek\"uls.}}{1474}}

Perfect, if this file was the .aux for the whole job.
Then the captions could be matched...

> images.aux: END
 ... but LaTeX2HTML never looks at images.aux ;
there is nothing in there that could be of any use.

> Hope this explains the situation.

Yes; it explains perfectly why you get what you described.

Hopefully you understand my explanation, and appreciate the value in
adjusting your document source.  Interesting problem!

All the best,

	Ross Moore

> Christian Mensing
> -- 
> Christian Mensing
> Lab. f_r Anorg. Chemie   
> http://www.inorg.chem.ethz.ch/group/mensing.html
> ETH H_nggerberg HCI H107  mailto:mensing at inorg.chem.ethz.ch
> CH 8093 Z_rich            tel: +41 (0)1 632 2894, fax: +41 (0)1 632 1149

More information about the latex2html mailing list