Re: [l2h] Already generated image inclusion
Hi Herb, Great to hear from you after so long. I just stumbled on this possible solution to a previously posted question of how to include an already generated (bitmap) image into both the html and ps versions of the document. It is not documented, but it works too well for it not to have been a designed feature. Yes. The latest versions of LaTeX2HTML have revamped graphics.perl and graphicx.perl via a new module graphics_support.perl written by Bruce Miller of NIST. In this example, my already generated images are in gif format, and are located in the snaps directory relative to my latex source. % % Allow the insertion of gif images from the snap directory. % \usepackage{graphicx} \DeclareGraphicsExtensions{gif} \DeclareGraphicsRule{.gif}{eps}{.bb}{`giftopnm #1|pnmtops -noturn -rle} \graphicspath{{snaps/}} \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} % \newcommand{\showimage}[3][0.9\textwidth]{% \setlength{\gifwidth}{#1} \begin{figure}[htb] \begin{center} \vspace{1ex} \includegraphics[width=\gifwidth]{#2.gif} \\ \caption{\label{#2}#3} \hrulefill\htmlrule \end{center} \end{figure} } Apparently, latex2html is smart enough to not attempt to convert an image with the .gif extension into PostScript. Instead, it simply inserts the image reference into the html file. The latex Bruce's coding allows support of many more graphics formats. It first determines whether a conversion is necessary or not, by looking at the filename suffix for whatever files it can find in the local directory having the correct prefix, then it makes use of many more of the various netpbm modules to do any required conversions or transformations. Essentially *all* of the options to LaTeX's \includegraphics command are supported, including rotations, scaling and cropping to a specified size. version instructs dvips to convert the gif to PostScript on the fly. It does, however, require you to precompute the size of the gif file in a nonbinary format that latex can read. You can do this in a makefile via %.bb: %.gif giftopnm $ | pnmtops -noturn -rle | grep BoundingBox $@ and listing the .bb files as dependencies to the .dvi file. You might try this with .png images by making the appropriate changes to the \showimage macro, and declaring a different GraphicsRule to convert png to ps. PS - I can see that a lot of improvements have been made to lates2html since the lst time I worked it. Ross, I'm glad to see that you're still very actively involved! It gets a bit of tinkering when someone reports abnormal behaviour which can be traced to being a real bug. (That doesn't happen very much anymore, thanks to the great work that has been put in over the years by many people, yourself included.) All the best, and have a great New Year Ross -- /---+---\ | Herbert Swan | Geoscience Operations | | Phillips Alaska, Inc. | | | 700 G Street | Phone: (907) 263-4043| | Anchorage, AK 99501 | Fax:(907) 265-1608| | Room: PTO 1340 | e-mail: [EMAIL PROTECTED] | \---+---/ ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html
Re: [l2h] already generated image inclusion
[EMAIL PROTECTED] wrote: \includegraphics[scale=\imgscale]{figs/4a_sbs-build-image1.\sbsext} What's \sbsext ? Why don't you just leave off the extension entirely let the graphics package choose? For latex/dvips it'll choose .ps or .eps; for latex2html it'll prefer a .gif, .jpg or .png if it can find one. ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html
Re: [l2h] already generated image inclusion
[EMAIL PROTECTED] wrote: Well, I think I spoke too fast. All my tests were local and were working. However, the problem is that the SRC arguments of the IMG tags are absolute ie something like /home/ben/oscar/doc/dev/install/figs/my_fig.png I'm not sure which problem you're reporting with which solution, since I seem to be only getting parts of the conversations out-of-sync. Ross is describing the powerfull, fully-general approach of conditionalizing the source so that you say explicitly what should go into the LaTeX runs vs. what should go into the HTML runs. I'm describing the much simpler approach using only the graphic(s|x) package; handy -- when it applies -- because the source works for any processor. The graphicx solution _should_ copy the source image to the destination directory -- it works for me. Certainly in the simple cases where the image is in the same directory as the tex, or a subdirectory, say figs, then \includegraphics{figs/my_fig} ought to work. When I originally wrote it ( ??? or did I add that feature to a local copy ??? ), I tried to preserve the local structure (eg. it would put my_fig.png in a subdirectory figs in the html destination directory), to avoid name conflicts. That doesn't seem to be in the currently distributed version -- maybe it was removed for portability, or maybe it wasn't in the version I submitted (Ross; does this ring any bells with you?). At any rate, currently, it'll just put the image in the same directory with the html -- but you're not seeing the image being copied at all ??? I would like to have a relative path (ie just figs/) so that it can work directly on the web server. Exactly what it _should_ do I tried to play with the prefix argument but without success. Is there a simple way to do it without to much sed-ing ? Ben ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html
Re: [l2h] already generated image inclusion
Hello, Ross is describing the powerfull, fully-general approach of conditionalizing the source so that you say explicitly what should go into the LaTeX runs vs. what should go into the HTML runs. Yes. This approach is working perfectly however it implies two things that I'm not sure I can/will have : 1) time to modify all the existing doc (several hundreds of pages and 50 or so files) 2) have every developper change to generate valid latex2html code. I'm describing the much simpler approach using only the graphic(s|x) package; handy -- when it applies -- because the source works for any processor. Yes and that is exactly what I was looking for ! The graphicx solution _should_ copy the source image to the destination directory -- it works for me. Certainly in the simple cases where the image is in the same directory as the tex, or a subdirectory, say figs, then \includegraphics{figs/my_fig} ought to work. The problem was completely solved when I mention my version of latex2html: latex2html -v This is LaTeX2HTML Version 2K.1beta (1.62) by Nikos Drakos, Computer Based Learning Unit, University of Leeds. Ross Moore suggest that I upgrade certain packages : $LATEX2HTMLDIR/styles/{graphics,graphicx,graphixx,graphics-support}.perl and after doing so, it worked exactly as expected and as you explained it to me : images are copied into the directory where l2h generate it's files and links are relative so that it can easily be transferred to the web server and fullt functionnal at tha point. Thank you very much for your help. Ben -- Benoit des Ligneris Etudiant au Doctorat -- Ph. D. Student Web :http://benoit.des.ligneris.net/ President du - GULUS - president http://www.gulus.org/ Mydynaweb Developpe(u)r: http://mydynaweb.net/ GPG/PGP Key http://benoit.des.ligneris.net/linux/gpg.txt ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html
Re: [l2h] already generated image inclusion
Hello, I'd like to use already generated images (png) in a converted latex2html document for the OSCAR project (oscar.sf.net). Original images are screenshots and are then converted to eps automatically. I wonder how to use the original images (png) into the HTML document rendered by latex2html. The default behavior is to convert images to png with a given scale factor which produce a poor quality output (png-eps-png !). \usepackage{html} \htmladdimg[options]{URL} It worked but I've got now another problem ! I don't wan't my images to be include twice (one automatically generated from the eps and the other one added with the \htmladdimg command). I tried to play with the \latex and \begin{latexonly}... commands and environments but without success. Most of the time, my figure environment are complex and include some subfigure but without success. However, after several trial and error, this solution is still not working ;-(( Here is a code sample of a typical figure with the: \begin{figure}[ht!] \htmladdimg{figs/4a_sbs-build-image1.png} \htmladdimg{figs/4b_sbs-build-image2.png} \htmladdimg{figs/4c_sbs-build-image3.png} \begin{latexonly} \begin{center} \centerline{ \includegraphics[scale=\imgscale]{figs/4a_sbs-build-image1.\sbsext} } \vspace{\imgvskip} \centerline{ \includegraphics[scale=\imgscale]{figs/4b_sbs-build-image2.\sbsext} \hspace{\imghskip} \includegraphics[scale=\imgscale]{figs/4c_sbs-build-image3.\sbsext} } \end{center} \end{latexonly} \caption{Step 2 -- Building the image.} \label{fig:sbs-build-image} \end{figure} However, it does not work at all : no figure is present in the HTML document. What is the proper procedure to have the awaited behavior ? Maybe I can now refine my initial question / feature request : Is it possible that, if an included image of the same name (but with a bitmap extension (.gif, .png, .jpg) is already present in the same directory of the image, latex2html use (and copy?) the bitmap image instead of an automatically generated bitmap image from the original (well, from LaTeX and LaTeX2Html point of vue !!). I think that this will allow documents that use eps generated images (ie from bitmap images like screenshots) to be directly usable with latex2html with a very good quality and without any modification/specific code to the original LaTeX document. Once again, if such a feature exists, I'm sorry for the rethinking and requestionning ! Ben -- Benoit des Ligneris Etudiant au Doctorat -- Ph. D. Student Web :http://benoit.des.ligneris.net/ President du - GULUS - president http://www.gulus.org/ Mydynaweb Developpe(u)r: http://mydynaweb.net/ GPG/PGP Key http://benoit.des.ligneris.net/linux/gpg.txt ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html
Re: [l2h] already generated image inclusion
Hello, \usepackage{html} \htmladdimg[options]{URL} It worked but I've got now another problem ! I don't wan't my images to be include twice (one automatically generated from the eps and the other one added with the \htmladdimg command). I tried to play with the \latex and \begin{latexonly}... commands and Yes; that is the right approach. But you can use the *conditional comments* : %begin{latexonly} ... ... ... %end{latexonly} which simplify the processing for LaTeX (since it just ignores them, and doesn't require the extra wrapping of an environment). environments but without success. Most of the time, my figure environment are complex and include some subfigure but without success. However, after several trial and error, this solution is still not working ;-(( Here is a code sample of a typical figure with the: \begin{figure}[ht!] \htmladdimg{../figs/4a_sbs-build-image1.png} \htmladdimg{../figs/4b_sbs-build-image2.png} \htmladdimg{../figs/4c_sbs-build-image3.png} ^^^ your images are in a subdirectory of the parent directory \begin{latexonly} \begin{center} \centerline{ \includegraphics[scale=\imgscale]{figs/4a_sbs-build-image1.\sbsext} } \vspace{\imgvskip} \centerline{ \includegraphics[scale=\imgscale]{figs/4b_sbs-build-image2.\sbsext} \hspace{\imghskip} \includegraphics[scale=\imgscale]{figs/4c_sbs-build-image3.\sbsext} } \end{center} \end{latexonly} \caption{Step 2 -- Building the image.} \label{fig:sbs-build-image} \end{figure} However, it does not work at all : no figure is present in the HTML document. What is the proper procedure to have the awaited behavior ? Your figures are 1-level higher in the directory tree, than where the HTML pages reside. You must include the extra ../ to account for this. \htmladdimg takes an arbitrary URL (could be anywhere on the web) as parameter, so it is up to you to get it right. Once again, if such a feature exists, I'm sorry for the rethinking and requestionning ! You need to think about the directory structure that results, after the LaTeX2HTML job has been done. Hope this helps, Ross Ben -- Benoit des Ligneris Etudiant au Doctorat -- Ph. D. Student Web :http://benoit.des.ligneris.net/ President du - GULUS - president http://www.gulus.org/ Mydynaweb Developpe(u)r: http://mydynaweb.net/ GPG/PGP Key http://benoit.des.ligneris.net/linux/gpg.txt ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html ___ latex2html mailing list [EMAIL PROTECTED] http://tug.org/mailman/listinfo/latex2html