[l2h] listings and figures

Manuel Carro boris@aaron.ls.fi.upm.es
Wed, 09 Oct 2002 17:56:06 +0200


    Hello.  I have a couple of questions regarding problems and how I
solved them.  I have been using LaTeX2HTML quite heavily ovr the last
years, and although I am very happy with it, the latest version
exhibited an unexpected behavior in a couple of points.  I am using
LaTeX2HTML Version 2002-2-1 (1.70).

    The problems (and solutions) where:

    * pstoimg was giving seek errors; I traced this back to the .ps
files for every image being generated as just black rectangles.
Eventually I discovered that images.tex was including
\usepackage[usenames,dvips]{color} while, at the same time I was using
in the main file \usepackage{colordvi} (included from a .tex file).
The combination of both two was confusing the image generation.  I
solved this by defining

$LOAD_LATEX_COLOR = " ";
$LATEX_COLOR = " ";

in the l2hconf.pm file _AND_ by commenting the line 6845 in the
LaTeX2HTML script to read

#	$LOAD_LATEX_COLOR = "\n\\usepackage[dvips]{color}";

    Is the latter needed?  Any other recomendation?  I would prefer
not touching the source code ---even in this very slight form.


    * One of the documents I want to convert to HTML has quite a lot
of \begin{listing}{}...\end{listing}.  These are (after the
modifications above) converted to images and rendered quite nicely;
but blank lines are translated into '\par' commands.  While this is OK
for (most of) LaTeX code, the listings environment interprets them as
strings (and not LaTeX code) and they appear verbatim in the final
figures.  I could bug the listings environment into interpreting LaTeX
code, but then I would have to escape all underscores, instead of just
cutting and pasting.  I fiddled around (again) with LaTeX2HTML and
changing the line

    s/((\%|$comment_mark\d*)|.)(\r*\n[ \t]*){2,}[ \t]*/$1\n\\par \n/og;

in the subroutine substitute_pars to

    s/((\%|$comment_mark\d*)|.)(\r*\n[ \t]*){2,}[ \t]*/$1\n\n/og;

(i.e., forgetting about the \par command) solved the listings
problems, but sometimes different paragraphs in the LaTeX code do not
appear as such in the HTML output.  Any hint on how to tell LaTeX2HTML
not to preprocess code which from which an image is going to be
generated?  I looked at the places where verbatim appears, and they
are a lot...


    Thanks for all and any help.  
-- 
+--------------------------------------------------------------------------+
|Manuel Carro -- Facultad de Informática -- U. Politécnica de Madrid (UPM) |
|  Email: mcarro@fi.upm.es --- Ph: +34-91336-7455 --- FAX: +34-91336-7412  |
|http://lml.ls.fi.upm.es/~boris --- http://clip.dia.fi.upm.es/Software/Ciao|