Conditional CompilationTopTrying it outGetting started

Contents

Index

A LaTeX subset -- Getting started

Starting with this section, we take a stroll through the LaTeX-book, explaining all features that Hyperlatex understands, additional features of Hyperlatex, and some missing features. For the LaTeX output the general rule is that no LaTeX command has been changed. If a familiar LaTeX command is listed in this manual, it is understood both by LaTeX and the Hyperlatex converter, and its LaTeX meaning is the familiar one. If it is not listed here, you can still use it by escaping into TeX-only mode, but it will then have effect in the printed output only.

Preparing an input file

There are ten characters that LaTeX and Hyperlatex treat specially:

      \  {  }  ~  ^  _  #  $  %  &

To typeset one of these, use

      \back   \{   \}  \~{}  \^{}  \_  \#  \$  \%  \&

(Note that \back is different from the \backslash command of LaTeX. \backslash can only be used in math mode, while \back can be used in any mode and is typeset in a typewriter font.)

Sometimes it is useful to turn off the special meaning of some of these ten characters. For instance, when writing documentation about programs in C, it might be useful to be able to write some_variable instead of always having to type some\_variable. This can be achieved with the \NotSpecial command.

In principle, all other characters simply typeset themselves. This has to be taken with a grain of salt, though. LaTeX still obeys ligatures, which turns ffi into `ffi', and some characters, like >, do not resemble themselves in some fonts . The only characters for which this is critical are <, >, and |. Better use them in a typewriter-font. Note that ?` and !` are ligatures in any font and are displayed and printed as ¿ and ¡.

Like LaTeX, the Hyperlatex converter understands that an empty line indicates a new paragraph. You can achieve the same effect using the command \par.

Dashes and Quotation marks

Hyperlatex translates a sequence of two dashes -- into a single dash, and a sequence of three dashes --- into two dashes --. The quotation mark sequences '' and `` are translated into simple quotation marks ".

Simple text generating commands

The following simple LaTeX macros are implemented in Hyperlatex:

Emphasizing Text

You can emphasize text using \emph or the old-style command \em. It is also possible to use the construction \begin{em} ...\end{em}.

Preventing line breaks

The ~ is a special character in Hyperlatex, and is replaced by the HTML-tag for "non-breakable space".

As we saw before, you can typeset the ~ character by typing \~{}. This is also the way to go if you need the ~ in an argument to an HTML command that is processed by Hyperlatex, such as in the URL-argument of \xlink.

You can also use the \mbox command. It is implemented by replacing all sequences of white space in the argument by a single ~. Obviously, this restricts what you can use in the argument. (Better don't use any math mode material in the argument.)

Footnotes

The footnotes in your document will be collected together and output as a separate section or chapter right at the end of your document. You can specify a different location using the \htmlfootnotes command, which has to come after all \footnote commands in the document.

Formulas

There is no math mode in HTML. (The proposed standard HTML 3 contained a math mode, but has been withdrawn. HTML-browsers that will understand math do not seem to become widely available in the near future.)

Hyperlatex understands the $ sign delimiting math mode as well as \( and \). Subscripts and superscripts produced using _ and ^ are understood.

Hyperlatex now has a simply textual implementation of many common math mode commands, so simple formulas in your text should be converted to some textual representation. If you are not satisfied with that representation, you can use the \math command:

  \math[HTML -version]{LaTeX-version}

In LaTeX, this command typesets the LaTeX-version, which is read in math mode (with all special characters enabled, if you have disabled some using \NotSpecial). Hyperlatex typesets the optional argument if it is present, or otherwise the LaTeX-version.

If, for instance, you want to typeset the ith element (the \math{i}th element) of an array as ai in LaTeX, but as a[i] in HTML, you can use

   \math[\code{a[i]}]{a_{i}}

By default, Hyperlatex sets all math mode material in italic, as is common practice in typesetting mathematics: "Given n points..." Sometimes, however, this looks bad, and you can turn it off by using \htmlmathitalic{0} (turn it back on using \htmlmathitalic{1}). For instance: 2n, but H-1. (In the long run, Hyperlatex should probably recognize different concepts in math mode and select the right font for each.)

It takes a bit of care to find the best representation for your formula. This is an example of where any mechanical LaTeX-to-HTML converter must fail--I hope that Hyperlatex's \math command will help you produce a good-looking and functional representation.

You could create a bitmap for a complicated expression, but you should be aware that bitmaps eat transmission time, and they only look good when the resolution of the browser is nearly the same as the resolution at which the bitmap has been created, which is not a realistic assumption. In many situations, there are easier solutions: If xi is the ith element of an array, then I would rather write it as x[i] in HTML. If it's a variable in a program, I'd probably write xi. In another context, I might want to write x_i. To write Pythagoras's theorem, I might simply use a^2 + b^2 = c^2, or maybe a*a + b*b = c*c. To express "For any eps> 0 there is a delta> 0 such that for |x - x0| < delta we have |f(x) - f(x0)| < eps" in HTML, I would write "For any eps > 0 there is a delta > 0 such that for |x-x0| < delta we have |f(x)-f(x0)| < eps."

Ignorable input

The percent character % introduces a comment in Hyperlatex. Everything after a % to the end of the line is ignored, as well as any white space on the beginning of the next line.

Document class

The \documentclass (or alternatively \documentstyle) and \usepackage commands are interpreted by Hyperlatex to select additional package files with definitions for commands particular to that class or package.

Title page

The \title, \author, \date, and \maketitle commands and the abstract environment are all understood by Hyperlatex. The \thanks command currently simply generates a footnote. This is often not the right way to format it in an HTML-document, use conditional translation to make it better.

Sectioning

The sectioning commands \chapter, \section, \subsection, \subsubsection, \paragraph, and \subparagraph are recognized by Hyperlatex and used to partition the document into nodes. You can also use the starred version and the optional argument for the sectioning commands. The optional argument will be used for node titles and in menus. Hyperlatex can number your sections if you set the counter secnumdepth appropriately. The default is not to number any sections. For instance, if you use this in the preamble

   \setcounter{secnumdepth}{3}

chapters, sections, subsections, and subsubsections will be numbered.

Note that you cannot use \label, \index, nor many other commands that generate HTML-markup in the argument to the sectioning commands. If you want to label a section, or put it in the index, use the \label or \index command after the \section command.

You will probably sooner or later want to start an HTML node without a heading, or maybe with a bitmap before the main heading. This can be done by leaving the argument to the sectioning command empty. (You can still use the optional argument to set the title of the HTML node.)

Do not use only a bitmap as the section title in sectioning commands. The right way to start a document with an image only is the following:

\T\section{An example of a node starting with an image}
\W\section[Node with Image]{}
\W\begin{center}\htmlimg{theimage.png}{}\end{center}
\W\htmlheading[1]{An example of a node starting with an image}

The \htmlheading command creates a heading in the HTML output just as \section does, but without starting a new node. The optional argument has to be a number from 1 to 6, and specifies the level of the heading (in article style, level 1 corresponds to \section, level 2 to \subsection, and so on).

You can use the commands \protect and \noindent. They will be ignored in the HTML-version.

Displayed material

The center, quote, quotation, and verse environment are implemented.

To make lists, you can use the itemize, enumerate, and description environments. You cannot specify an optional argument to \item in itemize or enumerate, and you must specify one for description.

All these environments can be nested.

The \\ command is recognized, with and without *. You can use the optional argument to \\, but it will be ignored.

There is also a menu environment, which looks like an itemize environment, but is somewhat denser since the space between items has been reduced. It is only meant for single-line items.

Hyperlatex understands the math display environments \[, \], displaymath, equation, and equation*.


March 23, 2010

Conditional CompilationTopTrying it outGetting started

Contents

Index