[l2h] Relative URLs in png/gif images

Herb W. Swan lanhws at expl.ak.ppco.com
Wed Jun 4 18:27:31 CEST 2003


Thanks, Ross, for your prompt reply.  I tried your suggestion, but
it fell a bit short of expectations:

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{html}
\DeclareGraphicsExtensions{png}
\DeclareGraphicsRule{.png}{eps}{.bb}{`pngtopnm #1|pnmtops -noturn -rle}
\newlength{\gifwidth}

%
%  The \showimage command displays a gif image in html,
%  and a PostScript version of it in the ps document.  The optional
%  argument 'width' overrides the natural width of the image.
%
%  Usage:  \showimage{image}{caption}
%          \showimage[width]{image}{caption}
%
%begin{latexonly}
\newcommand{\showpng}[4][0.9\textwidth]{%
    \setlength{\gifwidth}{#1}
    \begin{figure}[htb]
	\begin{center}
	    \vspace{1ex}
	    \includegraphics[width=\gifwidth]{#2.png} \\
	    \caption{\label{#2}#3}
	    \end{center}
	\end{figure}
    }
%end{latexonly}
\begin{htmlonly}
\newcommand{\showpng}[4][]{%
    \begin{figure}[htb]
	\begin{center}
	    \htmladdimg[center]{#4#2}
	    \caption{\label{#2}#3}
	    \end{center}
	\end{figure}
    }
\end{htmlonly}

\begin{document}
I'm going to include a png image right here:
\showpng{l2h}{The figure caption}{../}
\end{document}

% --------------------------------------------------------

What happened was that l2h still tried to "convert" the image with
pstoimg.  Of course it failed, since the image was empty as far as
LaTeX was concerned.

beagle% l2h test37
Note: Loading ./.latex2html-init
Note: Initialising with file: .latex2html-init
This is LaTeX2HTML Version 2002 (1.67)
by Nikos Drakos, Computer Based Learning Unit, University of Leeds.

Revised and extended by:
 Marcus Hennecke, Ross Moore, Herb Swan and others
...producing markup for HTML version 3.2



Loading /h/lanhws/l2h/versions/html3_2.pl

 *** processing declarations ***

Loading /h/lanhws/l2h/versions/latin1.pl
OPENING /h/lanhws/plano/text/www/test/test37.tex

Note: Working directory is /h/lanhws/plano/text/www/test/test37
Note: Images will be generated in /tmp/l2h9626

texexpand V2002 (Revision 1.11)



Loading /h/lanhws/l2h/styles/texdefs.perl...
Loading /h/lanhws/l2h/styles/article.perl
Loading /h/lanhws/l2h/styles/graphicx.perl
Loading /h/lanhws/l2h/styles/html.perl
Reading ...
%%%%%%%%%,++.
@@@@@

Reading aux file: /h/lanhws/plano/text/www/test/test37.aux ...
Processing macros ...++......
Translating ...
0/1:top of test37: for test37.html

 *** translating preamble ***
.......
 *** preamble done ***
;,.;

1/1:sectionstar:.."About this document ..." for node1.html
;;.

Writing image file ...

This is TeX, Version 3.1415 (C version 6.1)
(images.tex
LaTeX2e <1997/12/01> patch level 2


 *** processing 1 images ***

Generating postscript images using dvips ...
This is dvips 5.72 Copyright 1997 Radical Eye Software (www.radicaleye.com)
' TeX output 2003.06.04:1704' -> /tmp/l2h9626/image
(-> /tmp/l2h9626/image001) <texc.pro><special.pro><color.pro>[1]
Converting image #1
pstoimg: Error: "/h/lanhws/bin/sun5/pnmcrop < /tmp/l2h9626/p9644.pnm | /h/lanhws/bin/sun5/ppmquant -floyd 256 |
/h/lanhws/bin/sun5/pnmtopng -interlace  > img1.png" failed: Illegal seek

Error while converting image: No such file or directory

Doing section links ......
 *** Adding document-specific styles ***
Done.

--------------------------------------------------------

Not only that, but it didn't even make a link to my image:

I'm going to include a png image right here:

<DIV ALIGN="CENTER"><A NAME="l2h"></A><A NAME="27"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 1:</STRONG>
The figure caption</CAPTION>
<TR><TD></TD></TR>
</TABLE>
</DIV>
<BR><HR>
<!--Table of Child-Links-->

--------------------------------------------------------

I recall having tried several combinations of \begin{htmlonly},
\begin{latexonly}, etc. but the one which seemed to work best
was my original post.  It's one big disadvantage is that it
relies on a nonstandard LaTeX2HTML, and we both know that there
are too many of those floating about already!




--



 /-----------------------+-----------------------------------\
 | Herbert Swan          | Geoscience Operations             |
 | Phillips Alaska, Inc. |                                   |
 | 700 G Street          | Phone:  (907) 263-4043            |
 | Anchorage, AK  99501  | Fax:    (907) 265-1608            |
 | Room:  ATO 1370       | e-mail: lanhws at expl.ak.ppco.com   |
 \-----------------------+-----------------------------------/




More information about the latex2html mailing list