manual030.html 8.34 KB
 Ralf Treinen committed Oct 04, 2012 1 2 3 4   Ralf Treinen committed Jul 31, 2018 5 6 7   Ralf Treinen committed Oct 04, 2012 8 9 10 Definitions, Numbering  Ralf Treinen committed Jul 31, 2018 11 12 13   Ralf Treinen committed Oct 04, 2012 14 15 16 17 18 19 20 

B.8  Definitions, Numbering

B.8.1  Defining Commands

 Ralf Treinen committed Jul 31, 2018 24 25 26 27 



Scoping rules apply to macros, as they do in LATEX.  Ralf Treinen committed Oct 17, 2006 44 Environments and groups define a scope and command definition  Ralf Treinen committed Jul 31, 2018 45 are local to the scope they occur.

It is worth noticing that HEVEA also partly implements TEX definitions  Ralf Treinen committed Oct 04, 2012 46 (using \def) and bindings (using \let), see  Ralf Treinen committed Jul 31, 2018 47 section B.16.1 for details.

 Ralf Treinen committed Oct 04, 2012 48 49 

B.8.2  Defining Environments

 Ralf Treinen committed Jul 31, 2018 50 HEVEA accepts environment definitions and redefinitions  Ralf Treinen committed Oct 04, 2012 51 by \newenvironment and \renewenvironment.  Ralf Treinen committed Oct 17, 2006 52 The support is complete and should conform  Ralf Treinen committed Oct 04, 2012 53 54 55 56 to [LATEX, Sections C.8.2].

Environments define a scope both for commands and environment definitions.

B.8.3  Theorem-like Environments

 Ralf Treinen committed Oct 17, 2006 57 New theorem-like environments can also be introduced and redefined,  Ralf Treinen committed Oct 04, 2012 58 59 60 61 using \newtheorem and \renewtheorem.

Note that, by contrast with plain environments definitions, theorem-like environment definitions are global definitions.

B.8.4  Numbering

 Ralf Treinen committed Oct 17, 2006 62 LATEX counters are (fully ?) supported.  Ralf Treinen committed Jul 31, 2018 63 64 65 66 In particular, defining a counter cmd with \newcounter{cmd} creates a macro \thecmd that outputs the counter value. Then the \thecmd command can be redefined.  Ralf Treinen committed Oct 17, 2006 67 For instance, section numbering can be turned into alphabetic style by:  Ralf Treinen committed Oct 04, 2012 68 69 

\renewcommand{\thesection}{\alph{section}}

Note that TEX style for counters is not supported at all and that using  Ralf Treinen committed Jul 31, 2018 70 71 this style will clobber the output. However, HEVEA implements the calc package that makes using TEX style for counters  Ralf Treinen committed Apr 23, 2013 72 useless in most situations (see section B.17.3).

 Ralf Treinen committed Jan 31, 2013 73 

B.8.5  The ifthen Package

 Ralf Treinen committed Oct 04, 2012 74 

 Ralf Treinen committed Jul 31, 2018 75   Ralf Treinen committed Jan 31, 2013 76 The ifthen package is partially supported.  Ralf Treinen committed Oct 17, 2006 77 The one unsupported construct is the  Ralf Treinen committed Oct 04, 2012 78 \lengthtest test expression, which is  Ralf Treinen committed Jul 31, 2018 79 undefined.

As a consequence, HEVEA accepts the following example from the  Ralf Treinen committed Oct 17, 2006 80 LATEX manual:  Ralf Treinen committed Oct 04, 2012 81 

\newcounter{ca}\newcounter{cb}% 
Ralf Treinen committed Oct 17, 2006  82     83     84     85     86     87     88     89     90     91  \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} 
Ralf Treinen committed Jul 31, 2018  92     93     94                                                   

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.  Ralf Treinen committed Oct 17, 2006 95 Some of them are of interest to users.  Ralf Treinen committed Oct 04, 2012 96 

 Ralf Treinen committed Jan 31, 2013 97 98 hevea
Initial value is true. The hevea.sty style file also defines this register with  Ralf Treinen committed Jul 31, 2018 99 100 101 102 103 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.  Ralf Treinen committed Jan 31, 2013 104 
footer
Initial value is true.  Ralf Treinen committed Jul 31, 2018 105 106 107 When set false, HEVEA does not insert its footer “This document has been translated by HEVEA”.

Finally, note that HEVEA also recognised à la TEX conditional macros (see section B.16.1.4). Such macros are fully compatible  Ralf Treinen committed Jan 31, 2013 108 with the boolean registers of the ifthen package, as it is  Ralf Treinen committed Oct 04, 2012 109 110 the case in LATEX.

 Ralf Treinen committed Jul 31, 2018 111 112 113   Ralf Treinen committed Oct 04, 2012 114 115