|
"http://www.w3.org/TR/REC-html40/loose.dtd">
Customizing HEVEA
# hevea macros.hva mydoc.texThe general idea is as follows: one redefines LATEX constructs in macros.hva, using internal commands. This requires a good working knowledge of both LATEX and HTML. Usually, one can avoid internal commands, but then, all command redefinitions interact, sometimes in very nasty ways.
\renewenvironment{quote} {\@open{BLOCKQUOTE}{}\@style{EM}} {\@close{BLOCKQUOTE}}The same effect can be achieved without using any of the internal commands: \let\oldquote\quote \let\oldendquote\endquote \renewenvironment{quote}{\oldquote\em}{\oldendquote}In some sense, this second solution is easier, when one already knows how to customize LATEX. However, this is less safe, since the definition of \em can be changed elsewhere.
HEVEA default rendering of type style changes is described in section B.15.1. For instance, the following example shows the default rendering for the font shapes: \itshape italic shape \slshape slanted shape \scshape small caps shape \upshape upright shapeBy default, \itshape is italics, \slshape is maroon
italics, \scshape is navy blue color and \upshape is no
style at all.
All shapes are mutually exclusive, this means that each shape
declaration cancels the effect of other active shape declarations.
For instance, in the example, small caps shapes is navy blue and not
navy blue italics.
If one wishes to change the rendering of some of the shapes (say small caps), then one should redefine the old-style \sc declaration.
For instance, to render small caps as bold fonts, one should
redefine \sc by \renewcommand{\sc}{\@style{B}} in
macros.hva.And now, the shape example above gets rendered as follows: Redefining the old-style \sc is compatible with the cancelation
mechanism, redefining \scshape is not.
Thus, redefining directly LATEX 2e \scshape with
\renewcommand{\scshape}{\@style{B}} would yield:
Hence, redefining old-style declarations using internal commands should yield satisfactory output. However, since cancelation is done at the HTML level, a declaration belonging to one component may sometimes cancel the effect of another that belongs to another component. Anyway, you might have not noticed it if I had not told you.
\title command
takes an extra optional argument (which HEVEA should ignore
anyway).
However, HEVEA can process the document as it stands.
One solution to insert the following lines into macros.hva:
\input{article.hva}% Force document class ``article'' \let\oldtitle=\title \renewcommand{\title}[2][]{\oldtitle{#2}}The effect is to replace \title by a new command which
calls HEVEA \title with the appropriate argument.
\newcommand .
That is, users can define commands with an optional argument.
Such a feature permits to write a \epsfbox command that
has the same interface as the LATEX command and
echoes itself as it is invoked to the image file.
To do this, the HEVEA \epsfbox command has to check
whether it is invoked with an optional argument or not.
This can be achieved as follows :
\newcommand{\epsfbox}[2][!*!]{% \ifthenelse{\equal{#1}{!*!}} {\begin{toimage}\epsfbox{#2}\end{toimage}}%No optional argument {\begin{toimage}\epsfbox[#1]{#2}\end{toimage}}}%With optional argument \imageflush}
Links to included images are generated by the \imageflush
command, which calls the \imgsrc command :
\newcommand{\imageflush}[1][] {\@imageflush\stepcounter{image}\imgsrc[#1]{\jobname\theimage\heveaimageext}}That is, you may supply a HTML-style attribute to the included image, as an optional argument to the \imageflush command.By default, images are GIF images, stored in ``.gif'' files. HEVEA provides direct support for the alternative PNG image file format. It suffices to invoke hevea as:
# hevea png.hva mydoc.tex
Then imagen must be run as:
# imagen -png mydoc
Beware that transparent colors are not shown correctly by my browser for PNG images, while they work as advertised for GIF images. This does not harm as long as the final HTML document has a white background color (see Section B.2). |