Prev Up
Go backward to 10.7 Making characters non-special
Go up to 10 Controlling Hyperlatex

10.8 Extending Hyperlatex

As mentioned above, the documentclass command looks for files that implement LaTeX classes in the directory ~/.hyperlatex and the system-wide Hyperlatex directory. The same is true for the \usepackage{package} commands in your document.

Some basic support has been implemented for a few of these LaTeX packages. We first list the currently available packages, and then explain how you can use this mechanism to provide support for packages that are not yet supported by Hyperlatex.

10.8.1 The sequential package

Some people prefer to have the Next and Prev buttons in the navigation panels point to the sequentially adjacent nodes. In other words, when you press Next repeatedly, you browse through the document in linear order.

The package sequential provides this behavior. To use it, simply put

   \W\usepackage{sequential}
in the preamble of the document (or in your init.hlx file, if you want this behavior for all your documents).

10.8.2 The emulate package

Sometimes it is desirable to convert a given LaTeX-file into HTML with as little work as possible. Hyperlatex has not been designed for this, and by default many LaTeX-commands are not available in Hyperlatex. The emulate package contains (dummy) definitions for many of the missing LaTeX-commands. To convert a given LaTeX-document, simply add a

   \W\usepackage{emulate}
declaration in the preamble and try running Hyperlatex on the file.

Please do not take the existance of the emulate package as an indication that I want to turn Hyperlatex into a general LaTeX-to-HTML converter. I will accept contributions for the emulate package that allow Hyperlatex to deal with existing LaTeX code, but I don't plan to spend much time on providing such support myself, if it does not contribute to Hyperlatex's real goal: providing an environment that makes it easy to produce well-written documents in both printed and HTML form.

10.8.3 The frames package

If the package frames is enabled by putting a line

   \W\usepackage{frames}
in the preamble, Hyperlatex creates HTML-files using frames and JavaScript macros. Since it is using JavaScript 1.1, which is currently only supported by Netscape navigator 3.0 or higher, you should probably not enable this for documents available to the whole world (but you can try it for documents on your local network, if everybody is using the same browser).

There are two different layouts available. The alternative, simpler one can be used by using \W\usepackage[simple]{frames} in the preamble.

10.8.4 Xspace

Support for the xspace package is already built into Hyperlatex. The macro \xspace works as it does in LaTeX.

10.8.5 Longtable

The longtable environment allows for tables that are split over multiple pages. In HTML, obviously splitting is unnecessary, so Hyperlatex treats a longtable environment identical to a tabular environment. You can use \label and \link inside a longtable environment to create cross references between entries.

The macros \endhead and \endfirsthead are ignored by Hyperlatex. All other macros defined by the package have to be escaped.

Here is an example:

Language Codes (ISO 639:1988)
code language
aa Afar
am Amharic
ay Aymara
ba Bashkir
bh Bihari
bo Tibetan
ca Catalan
cy Welch

10.8.6 Tabbing

Peter D. Mosses has written a package that implements LaTeX's tabbing environment using HTML <TABLE> markup. This is a bit of a hack, of course, but seems to work well for simple tables, using only \=, \>, \\, and \kill.

To use it, simply put a line

   \W\usepackage{tabbing}
in your preamble. (There is no LaTeX package of this name, as the tabbing environment is part of standard LaTeX.)

10.8.7 Babel -- German

There is now some basic support for the german mode of the babel package. If you need support for a different language, try to implement it yourself by looking at the definition of the files german.el and german.hlx.

The german mode implements all the "-commands of the babel package. In addition, it defines the macros for making quotation marks. So you can easily write something like this:

Der König saß da und überlegte sich, wieviele Öchslegrade wohl der weiße Wein haben würde, als er plötzlich «Majesté» rufen hörte.
by writing:
  Der K"onig sa"z da  und "uberlegte sich, wieviele
  "Ochslegrade wohl der wei"ze Wein haben w"urde, als er pl"otzlich
  "<Majest\'e"> rufen h"orte.

10.8.8 Writing your own extensions

Whenever Hyperlatex processes a \documentclass or \usepackage command, it first saves the options--they can be retrieved in the Emacs lisp variable hyperlatex-options or as the Hyperlatex command \HlxOptions--, then tries to find the file package.hlx in either the .hyperlatex or the systemwide Hyperlatex directories. If such a file is found, it is inserted into the document at the current location and processed as usual. This provides an easy way to add support for many LaTeX packages by simply adding LaTeX commands.

To see how it works, have a look at the very simple longtable.hlx package, that provides support for LaTeX's longtable.sty package.

If you want to do something more ambitious, you may need to do some Emacs lisp programming. An example is babel.hlx, that makes the double quote character active using a piece of Emacs lisp code. The lisp code is embedded in the babel.hlx file using the \HlxEval command.

Note that Hyperlatex now provides rudimentary support for counters. The commands \setcounter, \newcounter, \addtocounter, \stepcounter, and \refstepcounter are implemented, as well as the \thecountername command that returns the current value of the counter. The counters are used for numbering sections, you could use them to number theorems or other environments as well.

If you write a support file for one of the standard LaTeX packages, please share it with us.


Otfried Schwarzkopf, September 2, 1997

Prev Up