Arbitrary Tags and Attributes

For version 97.1 of LATEX2HTML there is a new command which provides an extremely flexible way to include HTML 3.2 tags, along with any values for the “attributes” of that tag, if desired.
HTMLcode[attribs]{tag}
HTMLcode[attribs]{tag}{contents}
When the tag also needs a closing tag (e.g <I>...</I>) the contents must be given, enclosed in braces. Both the opening and closing tags then will be placed correctly.

Warning: In version 97.1 this command was actually called HTML. However style files may well define HTML to mean something else, like a styled version of the HTML acronym. So in version 98.1 the name has been changed to HTMLcode.

If no other definition of HTML exists, then this command will be defined, to work the same as HTMLcode.

An important aspect of this is that any of the tag, attribs and contents may be given wholly by expanding a LATEX macro, or may contain arbitrary macros, perhaps including other HTMLcode commands. The following tableThe contents of Figure ex:HTMLcode was constructed using this feature; its LATEX source follows.


Figure: Example use of macros for raw HTML code.
 

A listing of the different text styles available in HTML 3.2
  • a simple test of “bold-face”, using <B> .
  • a simple test of “italics”, using <I> .
  • a simple test of “teletype-text”, using <TT> .
  • a simple test of “underlining”, using <U> .
  • a simple test of “strikeout”, using <STRIKE> .
  • a simple test of “emphasis style”, using <EM> .
  • a simple test of “strong style”, using <STRONG> .
  • a simple test of “code style”, using <CODE> .
  • a simple test of “citation style”, using <CITE> .
  • a simple test of “definition style”, using <DFN> .
  • a simple test of “sample style”, using <SAMP> .
  • a simple test of “keyboard style”, using <KBD> .
  • a simple test of “variable style”, using <VAR> .


\newcommand{\myalign}{center}
\newcommand{\mylist}{UL}
\newcommand{\myitem}[2]{\HTMLcode[disc]{LI}{\simpletest{#1}{#2}}}
\newcommand{\simpletest}[2]{%
 \HTMLcode{#1}{ a simple test of “#2”,} using \HTMLcode{CODE}{<#1>} .}
\newcommand{\tableopts}{10,border=5}

\newcommand{\tablelist}[4][left]{\HTMLcode[#1]{DIV}{
\HTMLcode[\tableopts]{TABLE}{
\HTMLcode[bottom]{CAPTION}{
#3
}\HTMLcode{TR}{\HTMLcode{TD}{
\HTMLcode{#2}{
#4
}}}
}}\HTMLcode[all]{BR}}

\tablelist[\myalign]{\mylist}{%
\textbf{A listing of the different text styles available in HTML 3.2}}{%
\myitem{B}{bold-face}
\myitem{I}{italics}
\myitem{TT}{teletype-text}
\myitem{U}{underlining}
\HTMLcode[circle]{LI}{\simpletest{STRIKE}{strikeout}}
\myitem{EM}{emphasis style}
\myitem{STRONG}{strong style}
\myitem{CODE}{code style}
\myitem{CITE}{citation style}
\myitem{DFN}{definition style}
\HTMLcode[square]{LI}{\simpletest{SAMP}{sample style}}
\HTMLcode[square]{LI}{\simpletest{KBD}{keyboard style}}
\myitem{VAR}{variable style}}


The above code demonstrates many aspects of the way HTML commands can be used.
\begin{htmllist}\htmlitemmark{GreenBall}
\item [nesting: ]
\Lc{HTML} commands c...
...yway,
more compact code would have rendered the same on-screen.)
\end{htmllist}


Some further aspects of the use of this HTML command are not apparent from the above example.


\begin{htmllist}\htmlitemmark{RedBall}
\item [invalid \Meta{tag}\,: ]
If a \Meta...
...ribute being required to be changed from its default setting.
\par\end{htmllist}