[l2h] Bug or glitch when using colors ?

Ross Moore ross@ics.mq.edu.au
Sun, 29 Jul 2001 00:25:53 +1000 (EST)


> Hi,
> 
> I'm using the latex-package "color" by invoking
> \usepackage{color} and later calling \textcolor{yellow}{text in yellow color} etc. in my LaTeX-source.
> 
> I ran into some difficulties using latex2html with -html_version 4.0:
> 
> The css-file contained multiple definitions of the same color (really a lot - one for each call of \textcolor{}{} ).
> Here is a small example:
> 
> #hue11672  { color: #ff0000;  }
> #hue11674  { color: #ff0000;  }
> #hue11676  { color: #ff0000;  }
> #hue11678  { color: #ff0000;  }

No; these are not definitions of a color.
These are styles attached to particular elements, via 
e.g.
    <SPAN ID=#hue11672> ... some text... </SPAN>

Each ID must be *unique*.
this is quite different to a style attached to a "CLASS",
e.g. via
     <SPAN CLASS="red-text"> ... some text ... </SPAN>

> #hue11692  { color: #00cc00  }
> #hue11694  { color: #ffcc00;  }
> #hue11696  { color: #00cc00;  }
> #hue11698  { color: #ffcc00;  }
> #hue11700  { color: #00cc00;  }
> #hue11702  { color: #ffcc00;  }
> #hue11704  { color: #ff0000;  }
> 
> Obviously each time I invoked a color, a new hue was generated.

A hue is not generated.
A style-entry for a particular ID is generated.
This is caused by using \textcolor with $USING_STYLES being non-empty,
which is the default with HTML 4.0.
Other \text.... commands also generate IDs automatically.


> Since I'm no Pearl programmer, I don't know how to change the color.pearl -file to avoid this behaviour.

Why would you want to ?
It's the only way that you will get coloured text, since there is no
direct color tag used with HTML 4.0.

> 
> The idea should be, to note in each line of the css-file the color for which the hue stands as a comment.
> Then when a new \textcolor-command is found in the source during a latex2html-run, the css-file  should be checked, if this color is already coded. 
> This would eliminate a problem, which is arising now, when introducing a new color after a previous latex2html-run. Then quite curious coloring-effects may happen, if the existing css-file is not deleted before the new latex2html-run.

Yes; because if you do not delete the previous CSS file, then the generated IDs
may no longer match.

You can update your documents using a Makefile.
Ensure that the .css file is removed before running latex2html .

It was decided a long time ago that having LaTeX2HTML remove the CSS file
automatically is *not* a good idea, since you may wish to edit the CSS
separately, or set $STYLESHEET to point to some other CSS file that
is used with many documents, not just one.


> 
> DIV.navigation  {   }
> #hue11  { color: #ff0000;  }
> #hue13  { color: #0000ff;  }
> #hue7  { color: #ff0000;  }
> #hue9  { color: #0000ff;  }
 
 
> Inserting the outcommented lines in the testfile and running latex2html again,
> I got the same lines in the css-file !!

Yes; the CSS is not rewritten if there is one already there.
You need to delete it completely to have the CSS updated for
the updated HTML pages.


> Together with the html-file:
> <P>Farbtest:
> 
> <SPAN ID="hue7">red</SPAN> 
> 
> <SPAN ID="hue9">blue</SPAN> 
> 
> <SPAN ID="hue11">green</SPAN> 
> 
> <SPAN ID="hue13">red</SPAN>normaler Text 
> 
> <SPAN ID="hue15">red</SPAN><SPAN ID="hue17">blue</SPAN>
> 
> <P>
> 
> the result was a completely incorrect color-rendering!!!
 
 
 
> Can anyone reproduce this behaviour on his machine?
> Is any workaround known? (I'll have to go for hand-editing the css-file, if not.)

Delete the CSS whenever you do substantial edits.
Or use a Makefile, with methods to do the deletion automatically.


Hope this helps,

	Ross Moore

 
> Thanks for any hints!
> 
> Ralf Scholl
> SkillsOnline
> Heidelberg
> Germany
> 
>