|
"http://www.w3.org/TR/REC-html40/loose.dtd">
A note on style
Paragraphs are rendered by a blank line and there is no paragraph indentation. HEVEA is a bit simplistic in breaking paragraphs and extra paragraph breaks may be present in the final HTML documents. This can usually be corrected by modifying the source, without altering LATEX output. For instance, some blank line before or after a comment or macro definition can be deleted. Space after macros with no argument is skipped (as in LATEX) --- however this is not true in math mode, as explained in section 3.2.1 below. Consider the following example: \newcommand{\open}{(} \newcommand{\close}{)} \open text opened by ``\verb+\open+'' and closed by ``\verb+\close+''\close.We get: In the output above, the space after \open does not
find its way to the output.More generally, HEVEA tries to emulate LATEX behavior in all situations, but discrepancies probably exist. Thus, users are invited to make explicit what they want. This is good practice anyway, because LATEX is mysterious here. Consider the following example, where the \tryspace
macro is first applied and then expansed by hand:
\newcommand{\bfsymbol}{\textbf{symbol}} \newcommand{\tryspace}[1]{#1 XXX} Some space: \tryspace{\bfsymbol}\\ No space: \bfsymbol XXXSpacing is a bit chaotic here, the space after symbol remains when #1 is substituted for it
by LATEX (or HEVEA).
Note that, if a space before ``XXX'' is wanted, then one should probably write: \newcommand{\tryspace}[1]{#1{} XXX}
HEVEA math mode is not very far from normal text mode, except that all letters are shown in italics and that space after macros is echoed. However, typesetting math formulas in HTML rises two difficulties. First, formulas contain symbols, such as Greek letters; second, even simple formulas do not follow the simple basic typesetting model of HTML.
\alpha\rightarrow\beta is typeset without spaces between
symbols, whereas \alpha \rightarrow \beta produces these spaces.
Outputting symbols is performed using an HTML extension: the now standard FACE attribute to the FONT
element instruct the browser to switch to a symbol font.
HEVEA assumes this choice for the symbol font to be
as shown by figure 1.A browser correctly displays HEVEA symbols when figure 1 resembles the HTML page located at symbol.html in HEVEA on-line documentation directory. Some browsers do not know about symbol fonts by default and need to be configured (see section C.2). For authors that do not want to generate symbols that cannot be shown by any browser, HEVEA offers a degraded mode that outputs text in place of symbols. HEVEA operates in this mode when given the -nosymb flag.
Replacement text is in English, unless
HEVEA is also given the -francais flag. In that case
replacement text is in French.
For instance. the ``Î'' symbol is replace by ``in'' (or by ``appartient
à'' if French mode is selected).
This is far from being satisfactory, but degraded mode may be
appropriate for documents than contain few symbols.
The main two operating modes of HEVEA are text mode and display mode. Text mode is the mode for typesetting normal text, when in this mode, text items are echoed one following the other and paragraph breaks are just blank lines, both in input and output. The so called displayed-paragraph environments of LATEX (such as center or quote) are rendered by HTML block-level elements (such as DIV or BLOCKQUOTE). Rendering is correct becauses both LATEX displayed environments and HTML block-level elements start a new line. Conversly, since opening a HTML block-level elements means starting a new line, any text that sould appear inside a paragraph must be translated using only HTML text-level elements. HEVEA chooses to translate in-text formulas that way. HEVEA display mode allows more control on text placement, since entering display mode means opening a HTML TABLE element and that tables allow to control the
relative position of their sub-elements.
Displays come in two flavor, horizontal displays and vertical
displays.
An horizontal display is a one-row table, while a vertical display is
a one-column table. These tables holds display sub-elements, displays
sub-elements being centered vertically in horizontal display mode and
horizontally in vertical display mode.Display mode is first opened by opening a displaymath environment
(e.g. by $$
or \[ ).
Then, sub-displays are opened by LATEX constructs which require
them.
For instance, a displayed fraction (\frac ) opens a vertical display.The distinction between text and display modes clearly appears while typesetting math formulas. An in-text formula such as $\int_1^2 xdx = \frac{3}{2}$ appears as:
ò12 xdx =3/2,
while the same formula has a better aspect in display mode:
Users should remember that HEVEA is not TeX or LATEX and that HEVEA author neither is D. E. Knuth nor L. Lamport. Thus, some formulas may be rendered poorly. For instance, two fractions with different denominator and numerator height look strange.
Users can get an idea on how HEVEA combines elements in display mode by giving the -v option comand line option twice, which
instructs HEVEA to add a
border to the TABLE elements introduced by displays.
By contrast with formulas, which HEVEA attempts to render with text-level elements only when they appear inside paragraphs, LATEX arrays always translate to the block-level element TABLE , thereby introducing non-desired line
breaks before and after in-text arrays.
As a consequence, in-text arrays yield an acceptable output, only while
alone in a paragraph.Consider the following source: This is a small array: \begin{tabular}{|cc|} \hline item-1 & item-2 \\ \hline\end{tabular}. Next sentence.We get: However, since in some sense, all HTML tables are displayed, the array and tabular environments implicitly open display
mode, thus allowing a satisfactory typesetting of formulas in
arrays. More precisely, array elements whose column format
specification is l , c or r are typeset in display
mode (see section B.10.2).
In the following (silly) example, HEVEA gets nervous because of the complicated length given as argument to \hspace :
\newlength{\mylength}\setlength{\mylength}{5pt} \begin{tabular}{c@{\hspace{\mylength}}c} Before & After \end{tabular}Running HEVEA on this input produces a warning: # hevea manual.tex ... manual.tex:507: Warning: \hspace with arg ``\mylength'' ...However the final rendering is correct: Note that all warnings can be suppressed with the -s (silent)
option.
When a warning reveals a real problem, it can often be cured by
writing a specific macro. The next two sections introduce HEVEA
macros, then section 4 describes how to proceed with
greater detail.
This scheme favors easy extension of program capabilities by users. However, predicting program behavior and correcting errors may prove difficult, since final output or errors may occur after several levels of macro expansion. As a consequence, users can tailor HEVEA to their needs, but it remains a subtle task. Nevertheless, happy LATEX users should enjoy customizing HEVEA, since this is done by writing LATEX code.
Therefore, there are many situations where HEVEA just cannot render the visual effect of LATEX constructions. Here some choices have to be made. For instance, the calligraphic letters ( \mathcal )
are rendered in red (<FONT COLOR=red> ), and the small caps
(\scshape ) are rendered in bold font (<B> ).If you are not satisfied with HEVEA rendering of text style declarations, then you can choose your own, by redefining the \cal and \sc
macros, using \renewcommand , the macro redefinition operator of
LATEX. The key point is that you need not worry about HEVEA
internals: just redefine the old-LATEX style text-style
declarations (i.e. \it , \sc , etc.) and everything should
get fine:
\renewcommand{\sc}{\Huge} \renewcommand{\cal}{\em}(See sections 4 and 5 on how to make such changes while leaving your file processable by LATEX, and section 9.2 for a more thourough descriton of customizing type styles). With such redefinitions, we get: Note that many of LATEX commands and environments are defined in the hevea.hva file that HEVEA loads before processing any input. These constructs are written using LATEX source code, in the end they invoke HEVEA internal commands. Other LATEX constructs, such as LATEX key constructs or HEVEA internal commands (see section 8.4), that require special processing are defined in HEVEA source code. However, the vast majority of these definitions can be overridden by a redefinition. This may prove useless, since there is little point in redefining core constructs such as \newcommand for instance. |