Previous Up

B.17  Implemented Packages

HEVEA distribution includes .hva packages that are implementations of LATEX packages. Packages described in the “Blue Book” (makeidx, ifthen, graphics —and graphicx!—, color, alltt) are provided. Additionally, quite a few extra packages are provided. I provide no full documentation for these packages, users should refer to the first pages of the package documentation, which can usually be found in the book [LATEX-bis], in your local LATEX installation or in a TeX CTAN-archive.

At the moment, most package options are ignored, except for the babel package, where it is essential.

B.17.1  AMS compatibility

HEVEA amsmath package defines some of the constructs of the amsmath package. At the moment, supported constructs are the cases environment and matrix environments [LATEX-bis, Section 8.4], the environments for multi-line displayed equations (gather, split,…) [LATEX-bis, Section 8.5] and the \numberwithin command [LATEX-bis, Section 8.6.2].

HEVEA provides support for the amssymb symbols using Unicode. I found Unicode equivalent for most symbols. However, a few symbols remain undefined (e.g. \varsubsetneqq).

B.17.2  The array and tabularx packages

The array package is described in [LATEX-bis, Section 5.3] and in the local documentation of modern LATEX installations. It is a compatible extension of LATEX arrays (see B.10.2). Basically, it provides new column specifications and a \newcolumntype construct for user-defined column specifications. Table 1 gives a summary of the new column specifications and of how HEVEA implements them.

Table 1: Column specifications from the array package
m{width}  Equivalent to the p column specification (the width argument is ignored, entries are typeset in paragraph mode with paragraph breaks being reduced to a single line break), except that the entries are centered vertically.
b{width}  Equivalent to the p column specification, except that the entries are bottom-aligned vertically.
>{decl}  Can be used before l, c, r, p{}, m{} or b{}. It inserts decl in front of the entries in the corresponding column.
<{decl}  Can be used after l, c, r, p{}, m{} or b{}. It inserts decl after entries in the corresponding column.
!{decl}  Equivalent to @{decl}

Note that centered, top-aligned or bottom-aligned in the vertical direction, do not have exactly the same meaning in LATEX and in html. However, the aspect is the same when all columns agree w.r.t. vertical alignment. Ordinary column types (c, l and r) do not specify vertical alignment, which therefore becomes browser dependent.

The >{decl} and <{decl} constructs permit the encoding of TEX \cases macro as follows:


(This is an excerpt of the latexcommon.hva file.)

New column specifications are defined by the \newcolumntype construct:


Where col is one letter, the optional narg is a number (defaults to 0), and body is built up with valid column specifications and macro-argument references (#int). Examples are:

one & two & three & four \\
five & six & seven & eight \\ \hline

The column specification C means that entries will be typeset centered and using bold font, while the column specifications E{num} stands for num centered columns. We get:


HEVEA implements column specifications with commands defined in the \newcommand style. Thus, they have the same behaviour as regards double definition, which is not performed and induces a warning message. Thus, a column specification that is first defined in a macro.hva specific file, overrides the document definition.

The tabularx package [LATEX-bis, Section 5.3.5] provides a new tabular environment tabularx and a new column type X. HEVEA makes the former equivalent to tabular and the latter equivalent to p{ignored}. By contrast with the subtle array formatting that the tabularx package performs, this may seem a crude implementation. However, rendering is usually correct, although different.

More generally and from the html point of view such sophisticated formatting is browser job in the first place. However, the html definition allows suggested widths or heights for table entries and table themselves. From HEVEA point of view, drawing the border line between what can be specified and what can be left to the browser is not obvious at all. At the moment HEVEA choice is not to specify too much (in particular, all length arguments, either to column specifications or to the arrays themselves, are ignored). As a consequence, the final, browser viewed, aspect of arrays will usually be different from their printed aspect.

B.17.3  The calc package

The calc package enables using traditional, infix, notation for arithmetic operations inside the num argument to the \setcounter{name}{num} and \addtocounter{name}{num} constructs (see [LATEX-bis, Section A.4])

The calc package provides a similar extension of the syntax of the len argument to the \setlength and \addtolength constructs. HEVEA does not implement this extension, since it does not implement length registers in the first place.

B.17.4  Specifying the document input encoding, the inputenc package

The inputenc package enables LATEX to process a file according to various 8 bits encodings, plus UTF-8. The one used encoding is specified as an option while loading the package \usepackage[encoding]{inputenc}. At the moment, HEVEA recognises ten latin encodings (from latin1 to latin10), the koi8-r encoding, the ascii encoding, four windows encodings, the applemac encoding, and the utf8 encoding. It is important to notice that loading the inputenc package alters the html document charset. For instance if the latin9 input encoding is selected by:


Then, the document charset is ISO-8859-15, which is an enhanced version of ISO-8859-1 with some characters for Œ, œ and €. The rationale behind changing the output document charset at the same time as changing the input encoding is to allow non-ascii bytes in the input file to be replicated as themselves in the output file.

However, one can change the document charset (and the output translator) by using the internal command \@def@charset. For instance, one can specify latin1 encoding, while producing html pages in ascii:


See section 8.6 for a more thorough description of html charset management.

The inputenc package also provides the command \inputcoding{encoding} that changes the input encoding at any time. The argument encoding can be any of the options accepted by \usepackage[encoding]{inputenc}. The command \inputcoding of HEVEA follows the behaviour of its LATEX counterpart, it the sense that it obeys scope rules. Notice that \inputcoding does not change the document output encoding and charset.

B.17.5  More symbols

HEVEA implements the following packages: latexsym amssymb, textcomp (a.k.a. “Text companion”) and eurosym (a nice € symbol in LATEX).

B.17.6  The comment package

The comment package provides two commands, \excludecomment and \includecomment, for (re-)defining new environments that ignore their content or that do nothing. The comment environment is also defined as an environment of the first kind.

B.17.7  Multiple Indexes with the index and multind packages

HEVEA supports several simultaneous indexes, following the scheme of the index package, which is present in modern LATEX distributions. This scheme is backward compatible with the standard indexing scheme of LATEX.

Support is not complete, but the most useful commands are available. More precisely, HEVEA knows the following commands:

Declare an index. The first argument tag is a tag to select this index in other commands; ext is the extension of the index information file generated by LATEX (e.g., idx); ignored is ignored by HEVEA; and indexname is the title of the index. There also exists a \renewindex commands that takes the same arguments and that can be used to redefine previously declared indexes.
Perform \newindex{default}{idx}{ind}{Index}.
Act as the LATEX \index command except that the information extracted from arg goes to the tag index. The tag argument defaults to default, thereby yielding standard LATEX behaviour for the \index command without an optional argument. There also exists a stared-variant \index* that Additionally typesets arg.
Compute, format and output index whose tag is tag. The tag argument defaults to default.

The multind package is supported to some extend, but index is definitely to be preferred.

B.17.8  “Natural” bibliographies, the natbib package

LATEX version of natbib is present in modern installations.

Implementation is quite complete and compatible with version 8.0 of the natbib package (with the keyval style command \setcitestyle).

Unimplemented features are the sorting and compression of references. Automatic generation of an index of citations is handled, but the current implementation probably is quite fragile.

B.17.9  Multiple bibliographies

The multibib package

HEVEA provides a slightly incomplete implementation of the multibib package. The one non-implemented feature is the simultaneous definition of more than one bibliography. That is one cannot invoke \newcites as follows:

\newcites{suf1, suf2}{Title1, Title2}

Instead, one should perform to calls to the \newcites command:


The chapterbib package

A basic implementation is provided. At the moment, you can define one bibliography per included file and no toplevel bibliography. HEVEA implementation of this package recognises the option sectionbib and provides the command \sectionbib to change the sectioning command introduced by bibliographies.

B.17.10  Support for babel

B.17.10.1  Basics

HEVEA offers support for the LATEX package babel. When it reads the command


it loads babel.hva, and sends it the saved lang-list. The file babel.hva then looks at each language (say x) in it, and loads x.hva, which offers support for the language x. As in LATEX, the last language in the list is selected as default. As an example the command


would load babel.hva, then the files english.hva,french.hva,german.hva containing the respective definitions, and finally activate the definitions in german.hva and sets the current language to german.

B.17.10.2  Commands and languages

The following babel commands for changing and querying the language work as in LATEX :

  1. \selectlanguage : to change the language
  2. \iflanguage : to branch after comparing with current language

The language specific details are described in the corresponding .hva file, just as in the .sty file for LATEX. Users need to supply this file for their language, or modify/check the files if they are already supplied with the distribution. The list of languages is given below.


B.17.10.3  Writing hva files

The languages for which .hva files are available with the distribution are english, french, german, austrian and czech. These may need to be modified as not all accents and hyphenation techniques are supported.

They can be written/modified as simple TEX files (see the section  B.16.1.1 on writing TEX macros for details). As an example, one may also take a look at the file french.hva, which describes the details for french.

Note how all definitions are inside the definition for \french@babel, which is the command that \selectlanguage{french} would call. Similar commands need to be provided (i.e. \x@babel in \x.hva for language x).

Some definitions may involve specifying Unicode characters, for doing so, using the \@print@u is recommended (cf. Section 8.3). The definition of Unicode characters can be found at Most language specific Unicode characters can be found in the first few files.

B.17.11  The url package

LATEX source.

This package in fact provides a enhanced \verb command that can appear inside other command arguments. This command is named \url, but it can be used for any verbatim text, including DOS-like path names. Hence, one can insert urls in one’s document without worrying about LATEX active characters:

This is a complicated url: \url{}.

which gets typeset as: “This is a complicated url:”

The main use for the \url command is to specify urls as arguments to HEVEA commands for hyperlinks (see section 8.1.1):

\hevea{} home page is

It yields: “HEVEA home page is”.

However the \url command is fragile, as a consequence it cannot be used inside \footahref first argument (This is a LATEX problem, not an HEVEA one). The url package solves this problem by providing the \urldef command for defining commands whose body is typeset by using \url:


Such a source defines the robust command \heveahome as the intended url. Hence the following source works as expected:

Have a look at \footahref{\heveahome}{\hevea{} home page}

It yields: “Have a look at HEVEA home page”.

Using \url inside command definitions with a #i argument is a bad idea, since it gives “verbatim” a rather random meaning. Unfortunately, in some situations (e.g, no %, no #), it may work in LATEX. By contrast, it does not work in HEVEA. In such situations, \urldef should be used.

HEVEA implementation is somehow compatible at the “programming level”. Thus, users can define new commands whose argument is understood verbatim. The urlhref.hva style file from the distribution takes advantage of this to define the \url command, so that it both typesets an url and inserts a link to it.

Have a look at \url{}

It yields “Have a look at”. The urlhref.hva style file (which is an HEVEA style file and not a LATEX style file) can be adequate for bibliographic references, which often use \url for its typesetting power. Of course, loading urlhref.hva only makes sense when all arguments to \url are urls…

B.17.12  Verbatim text: the moreverb and verbatim packages

These two packages provide new commands and environments for processing verbatim text. I recommend using moreverb rather than verbatim, since HEVEA implementation is more advanced for the former package.

B.17.13  Typesetting computer languages: the listings package

I strongly recommend the listings package. Learning the user interface requires a little effort, but it is worth it.

HEVEA features a quite compatible implementation, please refer to the original package documentation. Do not hesitate to report discrepancies. Note that HEVEA does not produce very compact html in case you use this package. This can be cured by giving hevea the command-line option -O (see C.1.1.4).

The lstlisting environment is styled through an homonymous style class (see 9.2 and 9.3) and most lstlisting environments get translated to div elements with the appropriate \getenvclass{lstlisting} class, which, by default is lstlisting. A few points deserve mention:

  1. The definition of default style class lstlisting includes the important declarations font-family:monospace; and white-space:pre;, which, more or less, specify non-proportional font and mandatory line breaks. In case you replace lstlisting by another style class (by \setenvclass{lstlisting}{another one}), your alternate definition should probably feature an identical specification. Otherwise, rendering would be poor, as regards spacing and line breaks. Here is how specific listings are styled. We first define a new environment to typeset programs written in the C language, by using the command \lstnewenvironment:
    \lstdefinestyle{colors}{keywordstyle={\bf\color{blue}}, commentstyle={\em\color{magenta}}}
      {\setenvclass{lstlisting}{clisting}\lstset{language=C, style=colors}}
    The command \lstnewenvironment{name}{starting code}{ending code} is from the listings package, with similar semantics. In the starting code above, the fragment \setenvclass{lstlisting}{clisting} instructs HEVEA to use the style class clisting locally (notice that it could just be another name). The style class clisting is defined in the document preamble as follows:
    border-left:solid black;padding-left:2ex;margin-left:2ex;}
    Typesetting a C listing with a black border on the left is then as simple as:
    /* Compute, guess what! */
    int fact(int n) {
      int r = 1 ;
      for ( ; n > 0 ; n--) {
        r *= n ;
      return r ;
    The final result is:
    /* Compute, guess what! */ int fact(int n) { int r = 1 ; for ( ; n > 0 ; n--) { r *= n ; } return r ; }
  2. When listings are framed, that is, when some frame=… or background=… keyval specifications are active, they no longer get translated to div elements. Instead they get translated to one cell tables whose td and table elements are styled through style classes lstlisting and lstframe, respectively. Of course, those two style classes follow the usual \setenvclass/\getenvclass mechanism. That way, one can for instance center all framed listings by issuing the following declaration in the document preamble:
    Notice that the default style class lstframe is empty.
  3. Unfortunately the white-space:pre; style declaration is still a bit young, and some browsers implement it in rather incomplete fashion. This is particularly true as regards text copy-pasted from browser display. In case you want to provide your readers with easy copy-paste of listings, you can, by issuing the command \lstavoidwhitepre in the document preamble. Then, white-space:pre; is not used any longer: spaces get rendered by non-breaking space entities and line-breaks by <BR> elements, which significantly increase output size. However, as a positive consequence, display remains correct and text copy-pasted from browser display indeed possesses the line-breaks shown in display.

B.17.14  (Non-)Multi page tabular material

LATEX source for the longtable and supertabular packages.

Those two packages provide LATEX users with the possibility to typeset tabular material over several pages [LATEX-bis, Section 5.4]. Of course, HEVEA does not care much about physical pages. Thus the supertabular and longtable environments are rendered more or less as tabular environments inside table environments.

B.17.15  Typesetting inference rules: the mathpartir package

The mathpartir package, authored by D. Rémy, essentially provides two features:

  1. An environment mathpar for typesetting a sequence of math formulas in mixed horizontal and vertical mode. The environment selects the best arrangement according to the line width, exactly as paragraph mode does for words.
  2. A command \inferrule (and its starred variant) for typesetting inferences rules.

We give a short description, focussing on HEVEA-related details. Users are encouraged to refer to the original documentation of the package.

In the following, comments on rule typesetting apply to HEVEA output and not to LATEX output.

B.17.15.1  The mathpar environment

In its LATEX version, the mathpar environment is a “paragraph mode for formulas”. It allows to typeset long list of formulas putting as many as possible on the same line:

\begin{mathpar} A-Formula \and Longer-Formula \and And \and The-Last-One \end{mathpar}

In the example above, formulas are separated with \and. The LATEX implementation also changes the meaning of paragraph breaks (either explicit as a \par command or implicit as a blank line) to act as \and. It also redefines the command \\ as an explicit line-break in the flow of formulas.

\begin{mathpar} \int_0^2 xdx = \frac{3}{2} \\ \int_0^3 xdx = \frac{5}{2} \end{mathpar}

 xdx = 

 xdx = 

The HEVEA version is simplistic: Formulas are typeset in math display mode, \and separators always produce horizontal space, while \\ always produce line-breaks. However, when prefixed by \hva the meaning of explicit separators is reversed: that is, \hva\and produces a line-break, while \hva\\ produces horizontal space. Hence, we can typeset the previous example on two lines:

\begin{mathpar} A-Formula \and Longer-Formula \hva\and And \and The-Last-One \end{mathpar}

It is to be noticed that the LATEX version of the package defines \hva as a no-op, so as to allow explicit instructions given to HEVEA not to impact on the automatic typesetting performed by LATEX.

B.17.15.2  The inferrule macro

The \inferrule macro is designed to typeset inference rules. It should only be used in math mode (or display math mode). It takes three arguments, the first being optional, specifying the label, premises, and conclusions respectively. The premises and the conclusions are both lists of formulas, and are separated by \\. A simple example of its use is

  {one \\ two \\ three \\ or \\ more \\ premises}
  {and \\ any \\ number \\ of \\ conclusions \\ as \\ well}

which gives the following rendering:

one           two           three           or           more           premises
and           any           number           of           conclusions           as           well

Again, HEVEA is simplistic. Where LATEX performs actual typesetting, interpreting \\ as horizontal or vertical breaks, HEVEA always interpret \\ as an horizontal break. In fact HEVEA interpret all separators (\\, \and) as horizontal breaks, when they appear in the arguments of the \inferrule command. Nevertheless prefixing separators with \hva yields vertical breaks:

\inferrule {aa \hva\\ bb} {dd \\ ee \\ ff}
dd           ee           ff

The color of the horizontal rule that separates the premises and conclusions can be changed by redefining the command \mpr@hhline@color. This color must be specified as a low-level color (cf. Section B.14.2.2).

B.17.15.3  Options

By default, lines are centered in inference rules. However, this can be changed either by using \mprset{flushleft} or \mprset{center}, as shown below.

$$\mprset{flushleft} \inferrule {a \\ bbb \hva\\ ccc \\ dddd} {e \\ ff \hva\\ gg} $$
a           bbb  
ccc           dddd
e           ff 

B.17.15.4  Derivation trees

The mathpartir package provides a starred variant \inferrule*. In LATEX, the boxes produced by \inferrule and \inferrule* differ as regards their baseline, the second being well adapted to derivation trees. All this is irrelevant to HEVEA, but \inferrule* remains of interest because of its interface: the optional argument to the \inferrule* command is a list of key=value pairs in the style of keyval. This makes the variant command much more flexible.

keyEffect for value v
beforeExecute v before typesetting the rule. Useful for instance to change the maximal width of the rule.
leftPut a label v on the left of the rule
rightAs left, but on the right of the rule.
RightAs Left, but on the right of the rule.
labPut a label v above the inference rule, in the style of \inferrule.
vdotsRaise the rule by v and insert vertical dots, the length argument is translated to a number of line-skips.

Additionally, the value-less key center centers premises and conclusions (this is the default), while flushleft commands left alignment of premises and conclusions (as \mprset{flushleft} does). Other keys defined by the LATEX package exist and are parsed, but they perform no operation.

As an example, the code

\begin{mathpar} \inferrule* [Left=Foo] {\inferrule* [Right=Bar,width=8em, leftskip=2em,rightskip=2em,vdots=1.5em] {a \and a \and bb \hva\\ cc \and dd} {ee} \and ff \and gg} {hh} \hva\and \inferrule* [lab=XX]{uu \and vv}{ww} \end{mathpar}

produces the following output:

a           a           bb  Bar
cc           dd 

          ff           gg
uu           vv

B.17.16  The ifpdf package

This package should be present in modern latex installations. Basically, the package defines a boolean register pdf, whose value is true for tools that produce PDF (such as pdflatex) and false for tools that produce DVI (such as latex).

The hevea version of the package simply defines the boolean register pdf with initial value true. Command-line option -pdf is also added to imagen command-line options (by using the command \@addimagenopt, see Section 10.7). As a result, imagen will normally call pdflatex in place of latex.

In case standard latex processing in imagen is wished, one can issue the command \pdffalse after loading the ifpdf package and before \begin{document}. Then, no command line option is added. Hence, to achieve latex processing of the image file, while still loading the ifpdf package, one writes:


B.17.17  Typesetting Thai

HEVEA features an implementation of Andrew Seagar’s technique for Thai in LATEX, by the means of the package thai.hva in the distribution.

As regards input encoding, Thai users of HEVEA could (perhaps) use \usepackage[utf8]{inputenc}. However, the typesetting of Thai is more subtle than just proper characters. For that reason, Thai in LATEX is better performed by another technique, which HEVEA supports. See this specific document.

B.17.18  Hanging paragraphs

The hanging package is implemented. HEVEA implementation consists of no-ops, except for the hangparas environment, which is partially implemented. Assume the following usage of hangparas:

\begin{hangparas}{wd}{n}   …\end{hangparas}

where wd is a length that makes sense both for LATEX and CSS (typically 2ex). Then html output will reproduce LATEX output for n=1, regardless of the given value of argument n. That is, in any paragraph inside the environment, all lines except the first get indented by wd.

B.17.19  The cleveref package

The cleveref package attempts (and mostly succeeds) typesetting references cleverly. Its main feature is a \cref command that accepts several, comma separated, label references and typesets them as a list (which can be one-element long, of course) prefixed with sectional unit names. The HEVEA implementation is quite complete, but it does not support some of the subtleties of the LATEX implementations, especially as regards customisation.

B.17.20  Other packages

The fancyverb and colortbl packages are partly implemented.

The xspace package is implemented, in simple cases, rendering is satisfactory, but beware: HEVEA differs significantly from TEX, and discrepancies are likely.

The chngcntr package is implemented. This package provides commands to connect (and disconnect) counters once they are created (see

The import package is partially implemented: all starred commands are missing.

The booktabs package is implemented. This package provides nicer rulers in tables as specific commands. HEVEA defines those as no-ops.

Previous Up