[l2h] problem with translating ps figures

Ross Moore ross at ics.mq.edu.au
Wed Jan 18 01:50:13 CET 2006


Hi Robert,

On 18/01/2006, at 3:39 AM, rpgoldman at sift.info wrote:

>>>>>> "RM" == Ross Moore <ross at ics.mq.edu.au> writes:

>     RM> If you already have .gif or .jpg or .png  images, then it's
>     RM> easy enough to use "conditional" coding, with the  \htmladdimg
>     RM> command giving links for the HTML files.
>
>     RM> For example,
>
>     RM> %begin{latexonly}
>     RM>   \includegraphics{figs/myimage.ps}
>     RM> %end{latexonly}
>     RM> \htmladdimg[... options ...]{../figs/myimage.gif}


> I apologize for bothering you all again, but this doesn't seem to work
> for me.  Here's an example of what I do:
>
> \begin{figure}
>   \htmlimage{notransparent}
>   \begin{center}
> \begin{latexonly}
>     \epsfig{file=opal-inheritance.ps,width=.9\textwidth}
> \end{latexonly}
>     \htmladdimg{../gifs/opal-inheritance.gif}
>   \end{center}
> \caption{ ... }
> \tag{opalInheritance}
> \end{figure}

Ahh.
This requires also an empty \begin{makeimage}...\end{makeimage}
to tell LaTeX2HTML to *not* make an image of the whole
environment.  This is discussed in the manual.
e.g.

    \begin{figure}
     \begin{center}
      \begin{makeimage}
      \end{makeimage}
      %begin{latexonly}
        \epsfig{file=opal-inheritance.ps,width=.9\textwidth}
      %end{latexonly}
      \htmladdimg{../gifs/opal-inheritance.gif}
     \end{center}
    \caption{ ... }
    \tag{opalInheritance}
    \end{figure}


BTW, is \tag the same as \label ?
If this causes problems, then you may need a local definition
for this, in your document's preamble:

\begin{htmlonly}
  \newcommand{\tag}[1]{\label{#1}}
\end{htmlonly}


>
> This yields LaTeX output that's just fine.  But when I use LaTeX2HTML,
> I get the following HTML generated:
>
> <DIV ALIGN="CENTER"><A NAME="1032"></A>
> <TABLE>
> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 2.1:</STRONG>
> The ...  object.</CAPTION>
> <TR><TD><IMG
>  WIDTH="14" HEIGHT="10" BORDER="0"
>  SRC="img1.png"
>  ALT="\begin{figure}\begin{center}
> \htmladdimg{../gifs/opal-inheritance.gif}
> \end{center}
> \end{figure}"></TD></TR>
> </TABLE>
> </DIV>

Yes. It tried to make an image of everything, except the
  \caption  and  {latexonly}  parts.

This is the normal behaviour, since there could be things
in there that cannot be easily translated into HTML.

Some figures have HTML-interpretable stuff as well as
non-interpretable stuff. For these, there is the
  \begin{makeimage}
   ...
  \end{makeimage}
which limits what goes into the image, and uses the usual
paragraphing rules for anything else.

In your case, you do not want any image at all, but have
a translation into HTML of everything else
  (i.e., the \htmladdimg  part ).
For this you need a {makeimage} environment having empty
contents.  LaTeX2HTML finds that there is no image to make
so leaves it out completely.

BTW, the \htmlimage{...}  command is redundant, since there is to
be no new image created. It's purpose is to declare special effects
to be used when making the image --- but there is to be none.

>
>
> I.e., it seems to ignore my \latexonly command, try to translate the
> image anyway, and ignores my htmladdimg.  Am I committing some howler
> here?  Any suggestions will be very much appreciated!

A common mistake, yes --- but not a howler.


Hope this helps,

	Ross

>
> Best,
> R
>
>
>
> -- 
> Robert P. Goldman
> Senior Scientist
> Smart Information Flow Technologies (d/b/a SIFT, LLC)
>
> 211 N. First St., Suite 300
> Minneapolis, MN 55401
>
> Voice:	(612) 384-3454
> Email:    rpgoldman at SIFT.info

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




More information about the latex2html mailing list