2 Style files
LATEX style files are files that are not intended to produce output, but
define document layout parameters, commands, environments, etc.
2.1 Standard base styles
The base style of a LATEX document is the argument to the
\documentclass
command (\documentstyle
in old style).
Normally, the base style of a document defines the structure and
appearance of the whole document.
HEVEA knows about two LATEX base styles,
article and book.
Additionally, the report base style is recognized and
considered equivalent to book and the
seminar base style for making slides is recognized and
implemented by small additions on the article style.
Base style style is implemented by an HEVEA specific
style file whose name must be style.hva
.
More precisely, HEVEA interprets
\documentclass{
style}
by attempting to load
the file style.hva
(see section C.1.1 on where
HEVEA searches for files).
Thus, at the moment, HEVEA distribution includes the files,
article.hva, book.hva, etc.
2.2 Other base styles
Documents whose base style is not recognized by HEVEA can be
processed when the unknown base style is a derivation of a
recognized base style.
Let us assume that mydoc.tex uses an exotic
base style such as acmconf. Then, typing
hevea mydoc.tex
will yield an error, since
HEVEA cannot find the acmconf.hva file:
# hevea.opt mydoc.tex
mydoc.tex:1: Warning: Cannot find file: acmconf.hva
mydoc.tex:1: Error while reading LaTeX: No base style
Adios
This situation is avoided by invoking HEVEA with the known
base style file article.hva as an extra argument:
# hevea article.hva mydoc.tex
The extra argument instructs
HEVEA to load its article.hva
style file before processing mydoc.tex
It will then ignore the document base style specified by
\documentclass
(or \documentstyle
).
Observe that the fix above works because the acmconf and
article base styles look the same to the document (i.e., they define
the same macros).
More generally, most base styles that are neither
article nor book are in fact variations
on either two of them.
However, such styles usually provides extra macros.
If users documents use these macros, then users should also instruct
HEVEA about them (see section 4.1).
Finally, it is important to notice that
renaming a base style file style.cls
into
style.hva
will not work in general.
As a matter of fact, base style files are TeX and not LATEX source and
HEVEA will almost surely fail on TeX-ish input.
2.3 Other style files
A LATEX document usually loads additional style files (using
\input
or \usepackage
, or by giving optional arguments to \documentstyle
).
HEVEA simply ignores \usepackage
and optional arguments to
\documentstyle
, but it attempts to load a file given as argument
to \input
.
(You can see what files HEVEA loads or attempts to load by using
the -v
option.)
A simple situation is when HEVEA is not happy with just a few macros
in a style file.
As it is often the case, assume that the document mydoc.tex has a
\input{macros.tex}
instruction in its preamble, where
macros.tex gathers custom definitions.
Hopefully, only a few macros give rise to trouble: macros that performs fine
typesetting or TeXish macros.
Such macros need to be rewritten, using basic LATEX
constructs (section 4 gives examples of macro-rewriting).
The new definitions are best collected in a style file,
macros.hva for instance.
Then, mydoc.tex is to be translated by issuing the command:
# hevea macros.hva mydoc.tex
The file macros.hva is processed before
mydoc.tex (and thus before macros.tex).
As a consequence, the macro definitions in mymacros.tex
override the ones in macros.tex, since the latter are made
using \newcommand
or \def
(section B.8.1
explains how HEVEA handle macro definitions and redefinitions).
Another situation is when HEVEA fails to process a whole
style file. Usually, this means that HEVEA crashes on that style
file.
Then, you should also instruct
HEVEA not to load the faulty file, by issuing the command:
# hevea macros.hva -e macros.tex mydoc.tex
Of course, macros.hva must now contain replacements for
all the useful macros of macro.tex.
Note that another solution to instruct LATEX to load a file and
HEVEA not to load it is to use \usepackage
or optional
arguments to \documentstyle
, which HEVEA
ignores.
2.4 The hevea.hva file
The hevea.hva resides in HEVEA library and is loaded
before any other file specified by users.
It contains the definitions
of most LATEX core commands and environments,
HEVEA can be customized by redefining these constructs
using \renewcommand
or \renewenvironment
(see section 3.5).