![]() | ![]() | ![]() | Carrying on | Contents | Index |
In this section we continue to Chapter 3 of the LaTeX-book, dealing with more advanced topics.
Hyperlatex understands the following physical font specifications of LaTeX2e:
In LaTeX2e font changes are
cumulative--\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 write
{\it italic text}
but also
\textit{italic text}
You can use \/
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:
Hyperlatex understands the LaTeX declarations
to change the type size. 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.)
Hyperlatex recognizes all of LaTeX's commands for making accents.
However, only few of these are are available in HTML. Hyperlatex will
make a HTML-entity for the accents in ISO Latin 1, but will
reject all other accent sequences. The command \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 \ldots
and 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.
If you use \providecommand
, Hyperlatex checks whether the command
is already defined. The command is ignored if the command already
exists.
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}{\htmlimg{badexample_bitmap.xbm}{BAD}} \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.
The \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.
The tabular
environment is available in Hyperlatex.
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
\xmlattributes*{table}{border="1"}
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:
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
\xmlattributes
command:
gnats | gram | $13.65 |
each | .01 | |
gnu | stuffed | 92.50 |
emu | 33.33 | |
armadillo | frozen | 8.99 |
multirow
package in the contrib directory.
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
|
The 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}
(The example
environment is very similar to the alltt
environment of the alltt
package. The difference is that example
obeys the %
character.)
![]() | ![]() | ![]() | Carrying on | Contents | Index |