Prev Up Next
Go backward to 10.5 Changing the formatting of footnotes
Go up to 10 Controlling Hyperlatex
Go forward to 10.7 Making characters non-special

10.6 Setting Html attributes

If you are familiar with HTML, then you will sometimes want to be able to add certain HTML attributes to the HTML tags generated by Hyperlatex. This is possible using the command \htmlattributes. Its first argument is the name of an HTML tag (in capitals!), the second argument can be used to specify attributes for that tag. The declaration can be used in the preamble as well as in the document. A new declaration for the same tag cancels any previous declaration, unless you use the starred version of the command: It has effect only on the next occurrence of the named tag, after which Hyperlatex reverts to the previous state.

All the HTML-tags created using the \html-command can be influenced by this declaration. There are, however, also some HTML-tags that are created directly in the Hyperlatex kernel and that do not look up any attributes here. You can only try and see (and complain to me if you need to set attribute for a certain tag where Hyperlatex doesn't allow it).

Some common applications:

HTML 3.2 allows you to specify the background color of an HTML node using an attribute that you can set as follows. (If you do this in init.hlx or the preamble of your file, all nodes of your document will be colored this way.)

   \htmlattributes{BODY}{BGCOLOR="#ffffe6"}

The following declaration makes the tables in your document have borders.

   \htmlattributes{TABLE}{BORDER}

A more compact representation of the list environments can be enforced using (this is for the itemize environment):

   \htmlattributes{UL}{COMPACT}

The following attributes make section and subsection headings be centered.

   \htmlattributes{H1}{ALIGN="CENTER"}
   \htmlattributes{H2}{ALIGN="CENTER"}

Otfried Schwarzkopf, September 2, 1997

Prev Up Next