|
"http://www.w3.org/TR/REC-html40/loose.dtd">
Making HEVEA and LATEX both happy
HEVEA and LATEX treat files differently. Here is a summary of the main differences:
\input{ latexonly}
in the source and to invoke HEVEA as follows:
# hevea -e latexonly...Having heveaonly loaded by HEVEA only is more simple: it suffices to invoke HEVEA as follows: # hevea heveaonly...Finally, if one has an HEVEA equivalent style.hva for a LATEX style file style.sty, then one should load the file as follows: \usepackage{ style}
Writing an HEVEA-specific file file.hva is the method of choice for supplying command definitions to HEVEA only. Users can then be sure that these definitions are not seen by LATEX and will not get echoed to the image file (see section 6). The file file.hva can be loaded by either supplying the command-line argument file.hva, or by \usepackage{ file} from inside the document.
Which method is better depends
on whether it is choosed to override or to replace the document
definition.
In the command-line case,
definitions from file.hva are processed before the
ones from the document and will override them, provided
the document definitions are made using \newcommand (or
\newenvironment ).
In the \usepackage case, HEVEA loads file.hva
at the place where LATEX loads file.sty, hence
the definitions from file.hva replace
the definitions from file.sty in the strict sense.
latexonly , verblatex , htmlonly , rawhtml ,
toimage and verbimage environments:
As an example, this is how some text can be typeset in purple by HEVEA and left alone by LATEX: We get: \begin{htmlonly}% \purple purple rain, purple rain% \end{htmlonly} \begin{latexonly}% purple rain, purple rain% \end{latexonly}% \ldotsWe get: purple rain, purple rain ... It is impossible to avoid the spurious space in HEVEA output for the source above. This extra spaces comes from the newline character that follows \end{htmlonly} . Namely this
construct must appear in a line of its own for
LATEX to recognize it. Anyway, better control over spaces
can be achieved
by using the hevea boolean register
or comments, see sections 5.2.3
and 5.3.Also note that environments define a scope and that style changes (and non-global definitions) are local to them. For instance, in the example above, ``...'' appears in black in HTML output. However, as an exception, the environments image and verbimage do not create scope. It takes a little practice of HEVEA to understand why this is convenient.
More specifically, \end{ env} macros
are recognized and their env argument is tested against
the name of the environment whose opening macro \ env
opened the latexonly environment.
In that case, macro expansion of \end env is performed and
any further occurrence of \end{ env'} is tested
and may get expanded if it matches a pending
\begin{ env'}
construct.This enables playing tricks such as: \newenvironment{latexhuge} {\begin{latexonly}\huge} {\end{latexonly}} \begin{latexhuge} This will appear in huge font in \LaTeX{} output only. \end{latexhuge}LATEX output will be: While there is no HEVEA output. Since HEVEA somehow analyses input that is enclosed in the latexonly environment, it may choke. However, this environment is intended to select processing by LATEX only and might contain arbitrary source code. Fortunately, it remains possible to have input processed by LATEX only, regardless of what it is, by enclosing it in the verblatex environment. Inside this environment, HEVEA performs no other action than looking for \end{verblatex} . As a consequence,
the \begin{verblatex} and \end{verblatex} constructs
may only appear in the main flow of text or inside the same macro body,
a bit like LATEX verbatim environment.Relations between toimage and verbimage are similar. Additionally, formal parameters # i are replaced by
actual arguments inside the toimage environment
(see end of section 6.3 for an example of this feature).
Boolean registers are provided by the ifthen package (see [LATEX, Section C.8.5] and section B.8.5 in this document). Both the hevea.sty style file and HEVEA define the boolean register hevea. However, this register initial value is false for LATEX and true for HEVEA. Thus, provided, both the hevea.sty style file and the ifthen packages are loaded, the ``purple rain'' example can be rephrased as follows: We get: {\ifthenelse{\boolean{hevea}}{\purple}{}purple rain, purple rain}\ldotsWe get: purple rain, purple rain... Another choice is using the TeX-style conditional macro \ifhevea (see Section B.16.2.4):
We get: {\ifhevea\purple\fi purple rain, purple rain}\ldotsWe get: purple rain, purple rain...
%HEVEA , while
LATEX treats these lines as comments.
Thus, this is a last variation on the ``purple rain'' example:
We get %HEVEA{\purple purple rain, purple rain% %HEVEA}% \ldots(Note how comments are placed at the end of some lines to avoid spurious spaces in the final output.) We get: purple rain, purple rain... Comments thus provide an alternative to loading the hevea package. For user convenience, comment equivalents to the latexonly and toimage environment are also provided:
%BEGIN ... and %END ... comments. However, no environment is opened and closed and no scope is
created while using comment equivalents. |