B.8 Definitions, Numbering
B.8.1 Defining Commands
HEVEA understands command definitions given in LATEX style. Such
definitions are made using
\newcommand
, \renewcommand
and \providecommand
.
These three constructs accept the same arguments and have the same
meaning as in LATEX. However, HEVEA is more tolerant: if macro
name already exists, then a subsequent \newcommand{
name}
is ignored. If macro name does not exists, then
\renewcommand{
name}
performs a definition of name. In both cases, warnings are issued.
The behavior of \newcommand
allows to shadow document
definition, provided the new definitions are processed before the
document definitions.
This is easily done by grouping the shadowing definition in a
specific style file given as an argument to HEVEA.
By contrast, changes of base macros (i.e., the ones that HEVEA
defines before loading any user-specified file) must be performed
using \renewcommand
. Such personal (re)-definition can be made
in any user file.
HEVEA also accepts simple TeX style (using \def#1#2...
without delimiting
characters), with the same behavior as \newcommand
.
It is important to notice that HEVEA semantics for \def
departs significantly from TeX semantics. In particular, defining a
command that already exists with \def
fails in HEVEA,
whereas it succeeds in TeX.
Users are thus invited to use LATEX \renewcommand
for the purpose
of redefining commands.
HEVEA also processes a
limited version of \let
:
\let
macro-name =
macro-name
Scoping rules apply to macros, as they do in LATEX.
You can escape them by using the TeX constructs
\gdef
, \global\def
and \global\let
B.8.2 Defining Environments
HEVEA accepts environment definitions and redefinitions
by \newenvironment
and \renewenvironment
.
The support is complete and should conform
to [LATEX , Sections C.8.2].
In particular, environment names must contain letters only.
Environments define a scope both for commands and environment
definitions.
B.8.3 Theorem-like Environments
New theorem-like environments can also be introduced and redefined,
using \newtheorem
and \renewtheorem
.
Note that, by contrast with plain environments definitions,
theorem-like environment definitions are global definitions.
B.8.4 Numbering
LATEX counters are (fully ?) supported.
In particular, defining a counter cmd with
\newcounter{
cmd}
creates a macro
\the
cmd that outputs the counter value.
Then the \the
cmd command can be redefined.
For instance, section numbering can be turned into alphabetic style by:
\renewcommand{\thesection}{\alph{section}}
Note that TeX style for counters is not supported at all and that using
this style
will clobber the output.
B.8.5 The ifthen Package
The ifthen package is partially supported.
The one unsupported construct is the
\lengthtest
test expressions, which is
undefined.
As a consequence, HEVEA accepts the following example from the
LATEX manual:
\newcounter{ca}\newcounter{cb}%
\newcommand{\printgcd}[2]{%
\setcounter{ca}{#1}\setcounter{cb}{#2}%
Gcd(#1,#2) =
\whiledo{\not\(\value{ca}= \value{cb}\)}%
{\ifthenelse{\value{ca}>\value{cb}}%
{\addtocounter{ca}{-\value{cb}}}%
{\addtocounter{cb}{-\value{ca}}}%
gcd(\arabic{ca}, \arabic{cb}) = }%
\arabic{ca}.}%
For example: \printgcd{54}{30}
For example: Gcd(54,30) =
gcd(24, 30) = gcd(24, 6) = gcd(18, 6) = gcd(12, 6) = gcd(6, 6) = 6.
Additionally, a few boolean registers are defined by HEVEA.
Some of them are of interest to users.
- hevea
- Initial value is true.
The hevea.sty style file also defines this register with
initial value false.
- mmode
- This register value reflects HEVEA operating
mode, it is true in math-mode and false otherwise.
- display
- This register value reflects HEVEA operating
mode, it is true in display-mode and false otherwise.
- french
- This register value reflects the
-french
command line option internally (see Section C.1.1).
Finally, note that HEVEA also recognized à la TeX conditional
macros (see section B.16.1). Such macros are fully compatible
with the boolean registers of the ifthen package, as it is
the case in LATEX.