[l2h] Problem with colors

Ross Moore ross@ics.mq.edu.au
Fri, 26 Oct 2001 08:21:03 +1000 (EST)


> Hi everybody,
> 
> I am getting some weird behavior when trying to produce colored math. It
> seems that l2h somehow does not get the scope of the color command right.

Yes; that can be quite tricky.
There are several issues involved; not least of which is that the math
may require an image to be produced, using a LaTeX job (images.tex).
Your color commands need to be included in that job, along with scoping
commands to ensure that the colored portions are correctly contained.

Since {...}  are so common, these are *not* inserted into images.tex
Instead, you can use  \begingroup  and  \endgroup  to ensure scoping.

These *are* recognised by both LaTeX and LaTeX2HTML,
and are inserted into the correct place in images.tex so as to
capture declarative state-changes (i.e. of fonts, sizes, colors,
macro-definitions, etc.)


Delimiting large chunks of LaTeX-source with  { .... }  is *not*
good style for LaTeX. That is a TeX hack; not logical markup.
You should be using a proper LaTeX environment,
or the \begingroup ... \endgroup construction.


> Try the little example included below. Has anybody seen this before? Or is
> there a more simple, systematic way of doing this? I tried \textcolor
> instead of \color, but it does not change the color of the math.

If it is indeed only scoping problems, the  \begingroup ... \endgroup
should fix it for the images. 
Remember to remove old images before re-running your job, else there
may not be any replacement images generated.


For colored text, via stylesheets (using HTML 4.0 and later),
you still may not see the correct colors in the web-browser.
This could be because the  <jobname>.css  file hasn't been updated
with the stylesheet properties generated by your latest edits.
Like with images, the  .css  file is not automatically re-generated
with every run. Simply remove it manually, then rerun your job.



Hope this helps,

	Ross Morre


 
> Cheers,
> 	Carsten.
> 	
> ---------------------------------------------------------------------
>                      Carsten Detlefs                  
>     ESRF BP220                          e-mail: detlefs@esrf.fr
>     6 rue Jules Horowitz                 Phone: +33 4 76 88 25 56
>     F-38043 Grenoble, France               Fax: +33 4 76 88 25 42
> ---------------------------------------------------------------------
> 
> \documentclass[12pt]{article}
> 
> \usepackage{html}
> \usepackage{color}
> 
> \begin{document}
> 
> black text, $\mathrm{black\ math}$ 
> 
> {\color{red} Red text (no math!)}
> 
> black text, $\mathrm{black\ math}$ 
> 
> {\color{red} Red text $\mathrm{red\ math}$}
> 
> black text, $\mathrm{black\ math}$ 
> 
> \begin{itemize} 
> \item black text in \texttt{itemize}, 
> $\textrm{black\ math\ in\ }\mathtt{itemize}$
> 
> \end{itemize} 
> 
> \end{document}
> 
> 
> 
> _______________________________________________
> latex2html mailing list
> latex2html@tug.org
> http://tug.org/mailman/listinfo/latex2html