Changes

Jump to navigation Jump to search
general updates
== Mnemonics and aliases ==
In === Category codes === ConTeXt we sometimes manipulate manipulates the <''catcodes''> of certain characters. Because we are not that good at Catcode values have predefined meanings, but TeX expects them to be given as bare numbers, we introduce and the precise mapping of functionality to numbers is hard to remember. Therefore, ConTeXt introduces some symbolic names. This makes it easier to key in things like this:
<texcode>
</texcode>
All the The mnemonics that are defined are
<texcode>
Two of these symbolic names are actually used so often that they even have non-protected aliases: <code>\other</code> and <code>\active</code>.
 
We often need a space as defined in Plain TeX. Because ConTeXt cannot be sure that <code>\space</code> is not redefined, it internally uses an alias: <code>\normalspace</code>.
 
{{note|When dealing with ConTeXt, please remember to '''never''' (re-)define macros that start with <code>\normal...</code>. Weird, unexpected things can, and probably will, occur!}}
 
These are constant counters, corresponding to <code>0</code>, <code>1</code> and <code>-1</code>.
{{note|Beware: if you want to have access to @, !, and ? in macronames, use
</texcode>
instead of manipulating the catcode of @ directly. Protection The protection macros handle nested usage.}}  === Stored primitives and macros === ConTeXt often needs to use or redefine commands that are explained in the TeXbook (be they primitives, or macros from the plain format). ConTeXt sometimes defines commands with those names itself, and sometimes it cannot be sure that such commands are not redefined by a user, so it saves quite a large number of these commands internally under a different name. For this, it uses their canonical name, prefixed with <code>normal</code>.  An example: a command that is often needed is a space macro as defined in Plain TeX. Because ConTeXt cannot be sure that <code>\space</code> is not redefined, it uses the alias <code>\normalspace</code>. When dealing with ConTeXt, please refrain from (re-)defining macros that start with <code>\normal...</code>. Weird, unexpected things can - and probably will - happen if you do. The full list is too long to repeat here, but it includes at least: all of the <code>\if</code>-related statements, all of the kerning and glue related commands, all of the box typesetting commands, all of the font definition commands, and quite a few math commands like <code>\left</code> and <code>\right</code>, <code>\over</code>, and <code>\in</code>. === Numerical constants === Because using a single command is sometimes easier to handle in a macro than the actual digits of a number,there are a few constants predefined (some of which are inherited from the plain format): <texcode>\minusone = -1\zerocount = 0\plusone = 1 \@ne = 1\plustwo = 2 \tw@ = 2\plusthree = 3 \thr@@ = 3\plusfour = 4 \@iv = 4\plusfive = 5\plusten = 10\sixt@@n = 16\@cclv = 255 \@cclvi = 256\@xc = 90\plushundred = 100\@clxx = 180\plusthousand = 1000 \@m = 1000\plustenthousand = 10000 \@M = 10000\@MM = 20000</texcode> In cases where there is both a ''user'' command and an ''internal'' command, like in <code>\plusone</code> versus <code>\@ne</code>, use of the ''user'' command is prefered.
< '''Prev:''' [[System Macros/Fundamentals|Fundamentals]] | '''Top:''' [[System Macros]] | '''Next:''' [[System Macros/Scratch Variables|Scratch Variables]] >

Navigation menu