Sorry, in writing "http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl, which matches the Web address I cited above" (http://www.tex.ac.uk/faq/cgi-bin/texfaq2html?label=minxampl) I was wrong. Looking closely at those two Uniform Resource Locators (URLs) the second one has .../faq/... in it while the first one does not. So they don't match after all. Furthermore while online I found that I could enter the URL http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl into my Mozilla Firefox-18 Web browser and "reach" that corresponding Web page on the Internet. So another correction to my earlier writing is that by the entry of that single URL into a Web browser on January 17, 2013 I could directly reach the corresponding Web page. Sorry, I made those errors. I noticed the difference in those two URLs after I received an electronic-mail letter kindly written to me by Robin Fairbairns.

Another point is that I figured out that it may have been about 18-27 days before January 16, 2013 when I had trouble getting figures to be automatically numbered in a document. So that is more precise than "weeks or months" that I mentioned in my next-earlier electronic-mail letter in this "chain" of electronic-mail letters.

Pat
--------------------------------------------------
From: "Pat Somerville" <l_pa...@hotmail.com>
Sent: Wednesday, January 16, 2013 7:22 PM
To: <latex2html@tug.org>
Subject: Re: [l2h] Wrong figure numbers in figure captions when I attempted to have my figures automatically numbered using ~\ref..... commands in my .tex file

Hello. Thanks, Les Kitchen and Robin Fairbairns, for kindly taking the time to write to me. I appreciate people like you who are willing to help other people! Sorry, my writing was admittedly not very historically specific.----If one can manage it, of course it's better to write on a topic when it is fresh in one's mind and experience rather than to wait for weeks to months later like I tried to do. Unfortunately while online clicking on the hyperlink http://www.tex.ac.uk/faq/cgi-bin/texfaq2html?label=minxampl, kindly provided to me, did not "take" me to the corresponding Web page on the Internet. While online after clicking on that hyperlink I received the message "The requested URL /faq/cgi-bin/texfaq2html was not found on this server." But regardless of that message, I found a way to reach the content on that Web page:

1)  On the Internet "go" to the Web page http://www.tex.ac.uk/.
2)  Click on the hyperlink reading "UK TUG FAQ."
3) On the ensuing Web page under "Documentation and Help" click on the hyperlink reading 'How to make a "minimal example".' Then while there on the Internet from the address bar of my Mozilla Firefox-18 Web browser I copied and pasted here the Uniform Resource Locator (URL) http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl, which matches the Web address I cited above.

So I think this is a case in which that final Web page could not be reached from the Internet by inputting just the final URL into a Web browser. Instead, as I outlined above, I had to click on some hyperlinks on other Web pages in order to reach it.

I figured out how to "reach" that Web page after I had already written most of what is below this paragraph in this write-up. I hope you don't mind; but my approach in tackling the problem of having automatically numbered figures in a LaTeX2HTML-produced, .html (HyperText Markup Language) output file has turned out to be very different than providing you with a minimal example of my failing LaTeX code, as recommended on the above Web page. Nevertheless the "Building-up" and "Hacking-down" approaches discussed on that Web page do appear to be valid approaches toward "homing in" on the cause of a problem in LaTeX code. So at least for the benefit of other people, thanks, Robin Fairbairns, and/or whoever kindly prepared the contents of the above Web page, for preparing them. You or someone wrote on the cited Web page, "First, preparing a minimum document very often leads you to the answer, without all the fuss of posting and looking for responses."---When and if that happens, that would demonstrate that your procedure is or procedures are very good toward finding the causes of problems in LaTeX code!

Here are the versions and/or times of release or production of the codes LaTeX and LaTeX2HTML to which my writing below applies:

LaTeX2e, September 24, 2009
LaTeX2HTML version 2008, version 1.71
.
Gratefully I have a solution for having figures automatically numbered in a .html file mostly produced by the code LaTeX2HTML in conjunction with the code LaTeX plus some final editing of the HTML source code in that file. Les mentioned using the command \caption. I learned that it is a part of LaTeX's figure environment, as in an environment which begins with \begin{figure} and ends with \end{figure} (But I think there may be a separate software package called "caption" invoked by the command \usepackage{caption} with which I experimented recently, but finally did not use in my solution.). I found a good posting at http://www.math.uiuc.edu/~hildebr/tex/tips-figures.html on the Internet which includes the following LaTeX commands:

\documentclass{amsart}
\usepackage{graphicx}
.
.
\begin{document}
.
.
\begin{figure}
\centering
\includegraphics{sineplot}
\caption{Plot of the function $sin x$}
\label{sineplot}
\end{figure}

Figure \ref{sineplot} shows a plot of %just an example of textual reference to the figure in the document
.
.
\end{document}

The word "sineplot" has two functions in the above code: 1) It is the name of a figure file, for example sineplot.eps or sineplot.jpg, without both its extension, for example eps or jpg, and the period separating "sineplot" from, for example, eps or jpg. 2) It is the label assigned to the figure in the above code. I made some minor changes to the above LaTeX procedure:

\documentclass[a4paper,12pt]{article}
In the file name I might have included the .eps (Encapsulated PostScript) extension. I may have used the format \caption[....]{....} with the caption text between the brackets repeated within the braces. Also I may have included a width option in the \includegraphics command, as in the form of something like \includegraphics[width=5.99in]{myfigure.eps}. And I might have had a tilde in textual references as in the form "in Fig.~\ref{FigureLabel}". Also I read that the software package called graphicx may possibly conflict with other software packages; so somewhere along in my recent experimenting I placed graphicx first in my list of software packages I had listed in \usepackage{graphicx,..,..,.....}. Eventually I switched to using \begin{center} and \end{center}, but perhaps not in this early stage.

My working document in my experimenting reported here contained text and LaTeX commands on which an execution of latex and latex2html.... commands had failed to produce correct figure numbers in the .html output file produced by LaTeX2HTML. Often for my tests I ran a latex command three times and a latex2html command twice on the same .tex, LaTeX file. Something close to the above procedure, using the \caption instead of the \parbox command for figure captions, gratefully produced good figure numbering in the DeVice Independent (.dvi) output file produced by a command of the form "latex MyLaTeXFile.tex". But unfortunately in the .html output file produced by LaTeX2HTML the references in text to figures using commands of the form \ref{FigureLabel} resulted in the wrong figure numbers; and the figure numbers were missing in the figure captions.

Given the kind writing of Robin Fairbairns to me, in an attempt to obtain good LaTeX2HTML output I decided to switch to putting my figure captions within the braces of a \parbox command; for a period of time I abandoned the use of the \caption command. But unfortunately I did not have success that way in a .html file. From http://www.cv.nrao.edu/~abridle/l2h4nrao/l2h4nrao.pdf for LaTeX2HTML I saw the following set of commands:

\begin{figure}{thp}
\begin{center}
\includegraphics[width=4in]{fig1}
\caption{Captiontext}
\label{fig:labeltext}
\end{center}
\end{figure}
.
And within that write-up, written by probably A. Bridle, I found the important statement:

"Note that the \label command must come after, or within, the caption command for Figures and Tables, in order to generate the correct reference."

That statement was supported by the results of my experiments with LaTeX code in the use of LaTeX2HTML. That is I could not obtain correct figure numbers in the LaTeX2HTML, .html output file unless in my .tex, LaTeX file I had a \caption.. command immediately preceding a command of the form \label{MyFigureLabel}. So the use of the word "must" in A. Bridle's above writing seems very appropriate to me.

Comparing captions placed within \parbox, LaTeX commands to captions placed within \caption commands I prefer the right- and left-justified appearance of the captions in the corresponding .html file with the captions placed within \parbox commands; from my experience captions within \caption commands in the corresponding .html output file were centered, but with left and right "edges" of the lines of text that were often not vertically aligned.---This latter effect was often noticeable in multiline captions in a .html output file produced by LaTeX2HTML.

Secondly by experience I found that I should also include specifications for the heights of my figures within my \includegraphics commands. So in my .tex, LaTeX file I tried a set of commands similar to the ones below, placing my figure captions within \parbox commands, and also having an empty \caption{} command so as to obtain the correct figure numbers in the LaTeX2HTML, .html, output file in both text and figure captions:

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx,.......}
.
\begin{document}
.
.
As shown in Fig.~\ref{MyFigureLabel} ....
\vspace{1cm}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=5.99in,height=3.56in]{MyFigure.eps}
\parbox{\linewidth}{\small\setlength{\baselineskip}{2.6ex}Fig.~\ref{MyFigureLabel}. Here is where I would place my caption to the Figure.}
\caption{}
\label{MyFigureLabel}
\end{center}
\end{figure}
\vspace{5 mm}
\noindent More text here
.
.
\end{document}

I changed some names in the above lines of code to names different from the ones which actually appeared in my .tex, LaTeX file. Note that to obtain both the abbreviation "Fig." and the figure number within my figure caption in the output, .html file, within my \parbox command in my .tex, LaTeX file I have text and a command of the form "Fig.~\ref{MyFigureLabel}. Here is..."

The above solution produced the correct, automatically numbered figure numbers in both the text and figure captions of my output, .html file. But the inclusion of the empty \caption{} command had the unwanted result of producing, for example, "Figure 1:" right under my figure caption for that figure in both the LaTeX, .dvi and LaTeX2HTML, .html output files. By a few means with ideas from Web postings I tried to by LaTeX coding eliminate such unwanted displays in my .html, output file, but did not succeed in doing so (Perhaps some procedures posted on the Internet for eliminating something like "Figure 1:" in a figure caption might work in a .dvi output file produced by LaTeX; but my main goal was to find a working procedure for a .html, output file.).

Of course one can get rid of content he does not want in a .html file he produced by deleting that content from the HTML source code for the .html file.---And that is what I did in this case. I could open the .html output file produced by LaTeX2HTML in a text editor and delete lines, perhaps called HTML tags, of the following forms for each of my figures:

<CAPTION ALIGN="BOTTOM"><STRONG>Figure 8:</STRONG>
</CAPTION>
<TR><TD>

. After using a second text editor I eventually had the edited .html file saved as a text file in the 8-bit, Uniform Transformation Format (UTF-8) encoding. Then at last gratefully I could open that .html file in my Konqueror Web browser and see the following features that I wanted to see: 1) no, for example, "Figure 8:" underneath a caption to figure 8; 2) internal hyperlinks in text displaying the correct figure numbers; 3) for example, "Fig. 1. " at the beginning of a figure caption to figure 1 with the correct figure number there; and 4) the figure captions neatly right- and left-justified. One missing feature was that in having figure captions within \parbox commands, internal hyperlinks within a figure caption to another figure in my .html output file did not appear in the output, .html file. For example, an internal hyperlink to figure 8 in the caption to figure 9 was only displayed as Fig. 8 with the "8" appearing in black instead of the blue text one would often see in my installation of the Konqueror Web browser in the case of an internal hyperlink.

Perhaps someone knows of a better way to have figures automatically numbered in a .html, output file produced by LaTeX2HTML. For example, if someone knows of a way to have good-looking, left- and right-justified caption text confined to the width of a figure and located below it, then perhaps the caption could be included within the braces of a \caption{} command without the use of a \parbox command. And in that case editing the .html source code produced by LaTeX2HTML could be unnecessary.

Pat

--------------------------------------------------
From: "Robin Fairbairns" <robin.fairbai...@cl.cam.ac.uk>
Sent: Tuesday, January 15, 2013 12:07 PM
To: "Pat Somerville" <l_pa...@hotmail.com>
Cc: <latex2html@tug.org>
Subject: Re: [l2h] Wrong figure numbers in figure captions when I attempted to have my figures automatically numbered using ~\ref..... commands in my .tex file

Pat Somerville <l_pa...@hotmail.com> wrote:

Hello.  I tried to automatically number
figures using commands like "Fig.~\ref{....}" and in text and \label{...} commands within figure environments in my .tex file. I might have tried to
include figure captions within \caption and/or \parbox commands.
Anyhow, my figure numbers were incorrect in the figure captions.
Another variable is that I have been using both pdflatex and latex plus
latex2html commands in recent weeks; so there is a question whether I was
examining a Portable Document Format (.pdf) output file produced by a
pdflatex command or a .html file produced by executing a latex2html
command. Recently I gave up on getting the figure numbers within captions
correct by attempting to have the figures automatically numbered via
the use of ~\ref{....} commands.---That is I numbered the figures myself
everywhere within a .tex file.  Would someone please guide me or refer
me to a guide of consistent \caption or \parbox commands together with
~\ref{...} in text and \label{...} commands within figure environments for automatic figure numbering in text that will enable both the figure numbers within figure captions and the figure numbers within text to be correct? A desirable solution for the automatic numbering of figures within both the figure captions and the text of a document would be one which would work in a .tex file
with either pdflatex or latex2html commands.

this is either totally trivial (sequence should always be
 \caption{...}
 \label{...}
)

or totally impossible to diagnose with statements like

 I might have tried to include figure captions within \caption and/or
 \parbox commands.

captions would work within a \parbox but not with \caption.

tbh, this doesn't sound particularly specific to latex2html: i would
guess that if you feed rubbish to latex2html, you're _more_ likely to
get rubbish out than if you feed it to (la)tex.  in such a circumstance,
the (la)tex problem may be more amenable to comprehension.

the standard recommendation is that you produce a "minimal example" of a
problem.  this is described (for example) in
 http://www.tex.ac.uk/faq/cgi-bin/texfaq2html?label=minxampl
(there are different explanations all over the web).

post the minimal example and we might be able to help.  (those of us
owning crystal balls can probably see the solution without the minimal
example, but we ordinary mortals can only understand things that have
happened.)

roibn (anag)

_______________________________________________
latex2html mailing list
latex2html@tug.org
http://tug.org/mailman/listinfo/latex2html

Reply via email to