This section describes HEVEA functionalities that extends on plain LATEX, as defined in [LATEX]. Most of the features described here are performed by default.
Normally, HEVEA does not recognise constructs that are specific to TEX. However, some of the internal commands of HEVEA are homonymous to TEX macros, in order to enhance compatibility. Note that full compatibility with TEX is not guaranteed.
The \def
construct for defining commands is supported.
It is important to
notice that HEVEA semantics for \def
follows TEX semantics.
That is, defining a command that already
exists with \def
succeeds.
Delimiting characters in command definition are somehow supported. Consider the following example from the TEX Book:
\def\Look{\textsc{Look}} \def\x{\textsc{x}} \def\cs AB#1#2C$#3\$ {#3{ab#1}#1 c\x #2} \cs AB {\Look}{}C${And \$}{look}\$ 5.
It yields: And $lookabLookLook cx5.
Please note that delimiting characters are supported as far as I
could, problems are likely with delimiting characters which include
spaces or command names, in particular the command name \{
.
One can include \{
in a command argument by using the grouping
characters {
… }
:
\def\frenchquote(#1){\guillemotleft~\emph{#1}~\guillemotright{} (in French)} he said \frenchquote(Alors cette accolade ouvrante {``\{''}~?).
Yields: he said « Alors cette accolade ouvrante “{” ? » (in French).
Another issue regards comments: “%” in arguments may give undefined behaviours, while comments are better avoided while defining macros. As an example, the following code will not be handled properly by HEVEA:
\def\x% #1{y}
Such TEX source should be rewritten as \def\x#1{y}
.
Another source of incompatibility with TEX is that substitution of macros parameters is not performed at the same moment by HEVEA and TEX. However, things should go smoothly at the first level of macro expansion, that is when the delimiters appear in source code at the same level as the macro that is to parse them. For instance, the following source will give different results in LATEX and in HEVEA:
\def\cs#1A{``#1''} \def\othercs#1{\cs#1A} \othercs{coucouA}
LATEX output is “coucou”A, while HEVEA output is “coucouA”. Here is HEVEA output: “coucouA” Please note that in most situations this discrepancy will make HEVEA crash.
HEVEA also processes a
limited version of \let
:
\let
macro-name1 = macro-name2
The effect is to bind macro-name1 to whatever macro-name2
is bound to at the time \let
is processed. This construct may
prove very useful in situations where
one wishes to slightly modify basic commands.
See sections 10.3 and B.2 for examples of using
\let
in such a situation.
It is possible to escape scope and to make global definitions
and bindings by using the TEX construct \global
.
The \global
construct is significant before
\def
and \let
constructs.
Also note that \gdef
is equivalent to \global\def
.
The \newif\if
name, where name is made of letters
only, creates three macros:
\if
name, \
nametrue
and
\
namefalse
.
The latter two set the name condition to true and
false, respectively.
The \if
name command tests the condition name:
\if
name\else
\fi
Text text1 is processed when name is
true, otherwise text2 is processed.
If text2 is empty, then the \else
keyword can be
omitted.
Note that HEVEA also implements LATEX ifthen package and that TEX simple conditional macros are fully compatible with LATEX boolean registers. More precisely, we have the following correspondences:
TEX | LATEX | |
\newif\if name | \newboolean{ name} | |
\ nametrue | \setboolean{ name}{true} | |
\ namefalse | \setboolean{ name}{false} | |
\if name text1\else
text2\fi | \ifthenelse{\boolean{ name}}{ text1}{ text2} |
HEVEA implements the macros \unskip
and \endinput
.
It also supports the \csname
… \endcsname
construct.
If one strictly follows the LATEX manual, only commands with no
arguments can be defined inside other commands.
Parameters (i.e. #
n) occurring inside command bodies
refer to the outer definition, even when they appear in nested
command definitions.
That is, the following source:
\newcommand{\outercom}[1]{\newcommand{\insidecom}{#1}\insidecom} \outercom{outer}
yields this output:
Nevertheless, nested commands with arguments are allowed.
Standard parameters #
n still refer to the outer
definition, while nested parameters ##
n refer to the
inner definition.
That is, the source:
\newcommand{\outercom}[1]{\newcommand{\insidecom}[1]{##1}\insidecom{inner}} \outercom{outer}
yields this output:
Date and time support is not enabled by default, for portability and simplicity reasons.
However, HEVEA source distribution includes a simple (sh) shell script xxdate.exe that activates date and time support. The hevea command, should be invoked as:
# hevea -exec xxdate.exe ...
This will execute the script xxdate.exe, whose output is then
read by HEVEA.
As a consequence, standard LATEX counters year
,
month
, day
and
time
are defined and
LATEX command \today
works properly.
Additionally the following counters and commands are defined:
Counter weekday | day of week, 0…6 (e.g. 3) | |
Counter Hour | hour, 00…11 (e.g. 02) | |
Counter hour | hour, 00…23 (e.g. 14) | |
Counter minute | minute, 00…59 (e.g. 58) | |
Counter second | second, 00…619(e.g. 26) | |
Command \ampm | AM or PM (e.g. PM) | |
Command \timezone | Time zone (e.g. CEST) | |
Command \heveadate | Output of the date Unix command, (e.g. Wed May 17 14:58:26 CEST 2017) | |
Note that I chose to add an extra option (and not an extra
\@exec
primitive) for security reasons. You certainly do
not want to enable HEVEA to execute silently an arbitrary program
without being conscious of that fact.
Moreover, the hevea program does not execute
xxdate.exe by default since it is difficult to write such
a script in a portable manner.
Windows users should enjoy the same features with the version of xxdate.exe included in the Win32 distribution.
Loading the fancysection.hva file will radically change the style of sectional units headers: they appear over a green background, the background color saturation decreases as the sectioning commands themselves do (this is the style of this manual). Additionally, the document background color is white.
Note : Fancy section has been re-implemented using style-sheets. While it respects the old behaviour, users are encouraged to try out style-sheets for more flexibility. See Section 9 for details.
The fancysection.hva file is intended to be loaded after
the document base style.
Hence the easiest way to load the fancysection.hva file
is by issuing \usepackage{fancysection}
in the document preamble.
To allow processing by LATEX, one may for instance create
an empty fancysection.sty file.
As an alternative, to use fancy section style in doc.tex whose base style is article you should issue the command:
# hevea article.hva fancysection.hva doc.tex
You can also make a doc.hva file that contains the two lines:
\input{article.hva} \input{fancysection.hva}
And then launch hevea as:
# hevea doc.hva doc.tex
Sectioning command background colours can be changed by redefining the corresponding colours (part, chapter, section,…). For instance, you get various mixes of red and orange by:
\input{article.hva} \input{fancysection.hva} \definecolor{part}{named}{BrickRed} \definecolor{section}{named}{RedOrange} \definecolor{subsection}{named}{BurntOrange}
(See section B.14.2 for details on the named color model that is used above.)
Another choice is issuing the command
\colorsections{
hue}
, where
hue is a hue value to be interpreted in the HSV model.
For instance,
\input{article.hva} \input{fancysection.hva} \colorsections{20}
will yield sectional headers on a red-orange background.
HEVEA distribution features another style for fancy sectioning commands: the undersection package provides underlined sectional headers.
At the time of this release, Windows support for symbols through Unicode is not as complete as the one of Linux, which I am using for testing HEVEA.
One of the most salient shortcomings is the inability to display sub-elements
for big brackets, braces and parenthesis, which HEVEA normally
outputs when it processes \left[
, \right\}
etc.
We (hopefully) expect Windows fonts to display more of Unicode easily in a foreseeable future. As a temporary fix, we provide a style file winfonts.hva. Authors concerned by producing pages that do not look too ugly when viewed through Windows browsers are thus advised to load the file winfonts.hva. For instance they can invoke HEVEA as:
# hevea winfonts.hva ...
At the moment, loading winfonts.hva only changes the rendering of LATEX big delimiters, avoiding the troublesome Unicode entities. As an example, here are some examples of rendering.
|
More generally, it remains authors responsibility to be careful not to
issue too refined Unicode entities. To that aim, authors that target
a wide audience should first limit themselves to the most common
symbols (e.g. use \leq
[≤]
in place of \preceq
[≼]) and, above all,
they should control the rendering of their documents using several browsers.
MathJax support is enabled by loading the mathjax package. Two operating mode modes are provided: explicit and automatic. Notice that HEVEA distribution includes a innocuous mathjax.sty for LATEX compatibility — see also Sec. C.4.2.
Explicit mode is enabled when \usepackage{mathjax}
appears in the document preamble,
or when HEVEA is invoked as “hevea mathjax.hva
…”.
Basic consists in one environment displayjax
and one command \textjax
.
The environment is appropriate for displayed maths.
As an example, the following source
A displayed formula: \begin{displayjax} \frac{\pi}{4} = \left[1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} + \cdots + \frac{(-1)^n}{2n+1} + \cdots \right] \end{displayjax}
is displayed as follows:
The \textjax
command is appropriate for inline mathematical contents.
For instance, the following source
``A nice inline formula: \textjax{\frac{\pi}{4} = \left[1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} + \cdots + \frac{(-1)^n}{2n+1} + \cdots \right]}.''
is typeset as: “A nice inline formula: \(\frac{\pi}{4} = \left[1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} + \cdots + \frac{(-1)^n}{2n+1} + \cdots \right]\).”
Advanced support consists in the mathjax environment. Source code
enclosed in \begin{mathjax}\ldots\end{mathjax}
will be
reproduced into output for the MathJax script to handle it.
However, HEVEA does not start any other action.
Thanks to this feature, users can have any (recognised by MathJax)
displayed math environment processed by MathJax. For instance,
the following source
\begin{mathjax} \begin{eqnarray*} z^2 & = & x^2 + y^2\\ \end{eqnarray*} \end{mathjax}
will be displayed as:
Finally, notice that a document that uses the explicit MathJax
constructs can be processed by LATEX, provided
it loads the mathjax.sty file present in HEVEA distribution.
This can be done simply by having the line \usepackage{mathjax}
in
teh document preamble. Then, HEVEA and LATEX will react appropriately
(see sections 2.3.2 and B.5.2).
Automatic mode is enabled when \usepackage[auto]{mathjax}
appears in the document preamble,
or when HEVEA is invoked as “hevea mathjaxauto.hva
…”.
In automatic mode, HEVEA will pass all mathematical text to MathJax. This mode seems by far the most practical, but beware:
\mbox
, are not handled
by MathJax.
By default HEVEA insert a reference to the “default”
MathJax script
with “default” configuration parameters.
Advanced users can change this setting by redefining the \jax@meta
command, which must contain the appropriate <script>
element.
See the file html/mathjax.hva
for details.