[l2h] latex-definition for css

Ross MOORE Ross MOORE <ross@ics.mq.edu.au>
Wed, 19 May 1999 13:03:32 +1000 (EST)


> In the cascading style sheets resulting from latex2html, I would like
> to have the background color specified as well as the layout
> definition for <h1>, <h2>,... tags.  
 
There are many ways to set the background color, using LaTeX2HTML.
It can be done by setting an attribute for the <BODY> tag
  e.g.
	\usepackage{color}\pagecolor{...color specification...}
 or with the  \bodytext  command  from  html.sty .

Alternatively, it can be set in the CSS stylesheet,
with an entry such as
	BODY  { background-color: #ccffcc }

This is simple enough to edit yourself, after the job,
or beforehand if you then set  $STYLESHEET  to contain
a relative path to the preprepared stylesheet,
say in the same dorectory as your LaTeX source;
e.g.
	 $STYLESHEET = '../mystyles.css';

Note the .. since the HTML files are usually created in a 
subdirectory of the source directory.


> Could you please tell me which orders are to be included into the
> latex-file?

The automatically generated stylesheet can have information added
``on the fly'', as follows:

In the document preamble:

	\usepackage{html}

In the document body, put commands like:

\htmlsetstyle[DIV]{myclass}{ background-color: \#ccffcc }

to create the entry:

  DIV.myclass { background-color: #ccffcc }
 

So the command you want should be:

  \htmlsetstyle[BODY]{}{ background-color: \#ccffcc }


*However* this gives

  BODY. { background-color: #ccffcc }

which does *not* work because of the '.'
You need to have:

  BODY { background-color: #ccffcc }



To make the given LaTeX code work correctly,
a 1-line edit of the latex2html script is required.

In the code block starting:  sub process_htmlstyles {
replace the line
    $class = "$pre_tags.$class";
with
    $class = $pre_tags.($class ?'.':'').$class;

 
There is also a command:  \htmladdtostyle 
to add extra CSS properties without killing previous settings.
However this has the same problem with pure tags,
which is also fixed by the suggested edit.


Note that if you set  $STYLESHEET  then the results of
\htmlsetstyle  and  \htmladdtostyle  will not be applied.
Currently LaTeX2HTML uses just a single stylesheet;
no attempt has been made to exploit cascading yet.



Hope this helps,

	Ross Moore



> Thank you,
> Claudia
> 
> -- 
> D i p l .    M a t h .    o e c .    C l a u d i a    S c h r e m m e r
> Prakt. Informatik IV      www.informatik.uni-mannheim.de/informatik/pi4
> Wirtschaftsinformatik III                      www.wifo.uni-mannheim.de
> Telephone +49 (0)621/292-3381               Telefax +49 (0)621/292-5745