In this section we continue to Chapter 3 of the LaTeX-book, dealing with more advanced topics.
\textbf{\textit{BoldItalic}}
typesets the text in a
bold italic font. Different HTML browsers will display different
things.
The following old-style commands are also supported:
So you can writebut also{\it italic text}
You can use\textit{italic text}
\/
to separate slanted and non-slanted fonts (it
will be ignored in the HTML-version).
Hyperlatex complains about any other LaTeX commands for font changes,
in accordance with its general philosophy. If you
do believe that, say, \sf
should simply be ignored, you can easily
ask for that in the preamble by defining:
\W\newcommand{\sf}{}
Both LaTeX and HTML encourage you to express yourself in terms of logical concepts instead of visual concepts. (Otherwise, you wouldn't be using Hyperlatex but some WYSIWYG editor to create HTML.) In fact, HTML defines tags for logical markup, whose rendering is completely left to the user agent (HTML client).
The Hyperlatex package defines a standard representation for these logical tags in LaTeX--you can easily redefine them if you don't like the standard setting.
The logical font specifications are:
\htmllevel
is
html3.2
. The HTML font changes are relative to the HTML node's
basefont size. (\normalfont
being the basefont size,
\large
begin the basefont size plus one etc.) To set the basefont
size, you can use
where x is a number between 1 and 7.\html{basefont size=x}
\c
can be used
to put a cedilla on a letter `c' (either case), but on no other
letter. So the following is legal
Der K{\"o}nig sa\ss{} am wei{\ss}en Strand von Cura\c{c}ao und nippte an einer Pi\~{n}a Colada \ldotsand produces
Der König saß am weißen Strand von Curaçao und nippte an einer Piña Colada ...Not available in HTML are
Ji{\v r}\'{\i}
, or Erd\H{o}s
.
(You can tell Hyperlatex to simply typeset all these letters without
the accent by using the following in the preamble:
\newcommand{\HlxIllegalAccent}[2]{#2}
Hyperlatex also understands the following symbols:
oe \oe
å \aa
¿ ?`
OE \OE
Å \AA
¡ !`
æ \ae
ø \o
ß \ss
Æ \AE
Ø \O
§ \S
© \copyright
¶ \P
£ \pounds
\quad
and \qquad
produce some empty space.
Hyperlatex understands definitions of new commands with the
LaTeX-instructions \newcommand
and \newenvironment
.
\renewcommand
and \renewenvironment
are understood as well
(Hyperlatex makes no attempt to test whether a command is actually
already defined or not.) The optional parameter of LaTeX2e is also
implemented.
Note that it is not possible to redefine a Hyperlatex command that is
hard-coded in Emacs lisp inside the Hyperlatex converter. So
you could redefine the command \cite
or the verse
environment,
but you cannot redefine \T
. (But you can redefine most of the
commands understood by Hyperlatex, namely all the ones defined in
siteinit.hlx.)
Some basic examples:
\newcommand{\Html}{\textsc{Html}} \T\newcommand{\bad}{$\surd$} \W\newcommand{\bad}{\htmlimage{badexample_bitmap.xbm}} \newenvironment{badexample}{\begin{description} \item[\bad]}{\end{description}} \newenvironment{smallexample}{\begingroup\small \begin{example}}{\end{example}\endgroup}
Command definitions made by Hyperlatex are global, their scope is not
restricted to the enclosing environment. If you need to restrict their
scope, use the \begingroup
and \endgroup
commands to create a
scope (in Hyperlatex, this scope is completely independent of the
LaTeX-environment scoping).
Note that Hyperlatex does not tokenize its input the way TeX does.
To evaluate a macro, Hyperlatex simply inserts the expansion string,
replaces occurrences of #1
to #9
by the arguments, strips one
# from strings of at least two #'s, and then reevaluates
the whole. Problems may occur when you try to use %, \T
, or
\W
in the expansion string. Better don't do that.
\newtheorem
command declares a new "theorem-like"
environment. The optional arguments are allowed as well (but ignored
unless you customize the appearance of the environment to use
Hyperlatex's counters).
\newtheorem{guess}[theorem]{Conjecture}[chapter]
You can use figure
and table
environments and the
\caption
command. They will not float, but will simply appear
at the given position in the text. No special space is left around
them, so put a center
environment in a figure. The table
environment is mainly used with the tabular
environment. You can use the \caption
command to place a caption. The starred versions table*
and
figure*
are supported as well.
tabular
environment is available in Hyperlatex.
If you use \htmllevel{html2}
, then Hyperlatex has to display the
table using preformatted text. In that case, Hyperlatex removes all
the &
markers and the \\
or \\*
commands. The result is not
formatted any more, and simply included in the HTML-document as a
"preformatted" display. This means that if you format your source
file properly, you will get a well-formatted table in the
HTML-document--but it is fully your own responsibility.
You can also use the \hline
command to include a horizontal
rule.
If you use any \htmllevel
higher than html2
, then Hyperlatex can
use tags for making tables. Many column types are now supported, and
even \newcolumntype
is available. The | column type
specifier is silently ignored. You can force borders around your table
(and every single cell) by using \htmlattributes*{TABLE}{BORDER}
immediately before your tabular
environment. You can use the
\multicolumn
command. \hline
is understood and ignored.
The \htmlcaption
has to be used right after the
\
begin{tabular}
. It sets the caption for the HTML table. (In
HTML, the caption is part of the tabular
environment. However, you
can as well use \caption
outside the environment.)
If you have made the &
character non-special,
you can use the macro \htmltab
as a replacement.
Here is an example:
\begin{table}[htp] \T\caption{Keyboard shortcuts for \textit{Ipe}} \begin{center} \begin{tabular}{|l|lll|} \htmlcaption{Keyboard shortcuts for \textit{Ipe}} \hline & Left Mouse & Middle Mouse & Right Mouse \\ \hline Plain & (start drawing) & move & select \\ Shift & scale & pan & select more \\ Ctrl & stretch & rotate & select type \\ Shift+Ctrl & & & select more type \T\\ \hline \end{tabular} \end{center} \end{table}The example is typeset as follows:
Keyboard shortcuts for Ipe Left Mouse Middle Mouse Right Mouse Plain (start drawing) move select Shift scale pan select more Ctrl stretch rotate select type Shift+Ctrl select more type
Note that the netscape
browser treats empty fields in a table
specially. If you don't like that, put a single ~ in that field.
A more complicated example:
type style smart red short rather silly puce tall
To create certain effects you can employ the
\htmlattributes
command:
gnats gram $13.65 each .01 gnu stuffed 92.50 emu 33.33 armadillo frozen 8.99
As an alternative for creating cells spanning multiple rows, you could
check out the multirow
package.
A weak implementation of the tabbing environment is available if the HTML level is 3.2 or higher. It works using HTML <TABLE> markup, which is a bit of a hack, but seems to work well for simple tabbing environments.
The only commands implemented are \=
, \>
, \\
, and \kill
.
Here is an example:
while | n < (42 * x/y) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if | n odd | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
increment n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return TRUE
|
verbatim
environment and the \verb
command are
implemented. The starred varieties are currently not implemented.
(The implementation of the verbatim
environment is not the
standard LaTeX implementation, but the one from the verbatim
package by Rainer Schöpf).
Furthermore, there is another, new environment example
.
example
is also useful for including program listings or code
examples. Like verbatim
, it is typeset in a typewriter font
with a fixed character pitch, and obeys spaces and line breaks. But
here ends the similarity, since example
obeys the special
characters \
, {
, }
, and %
. You can
still use font changes within an example
environment, and you
can also place hyperlinks there. Here is
an example:
To clear a flag, use \begin{example} {\back}clear\{\var{flag}\} \end{example}
Note also that an example
environment is indented
automatically, while a verbatim
environment is not.
In the LaTeX document, you can set the amount of indentation by
setting \exampleindent
:
\setlength{\exampleindent}{4mm}
(The example
environment is very similar to the alltt
environment of the alltt
package. The differences are that example
is automatically indented and obeys the %
character.)