Difference between revisions of "System Macros/Mnemonics and Aliases"

From Wiki
Jump to navigation Jump to search
m (fixed the \unprotect)
m (→‎Mnemonics and aliases: Added all mnemonics)
Line 6: Line 6:
  
 
<texcode>
 
<texcode>
\catcode'\@=\@@letter
+
\chardef\@@escape      =  0
 +
\chardef\@@begingroup  =  1
 +
\chardef\@@endgroup    =  2
 +
\chardef\@@mathshift  =  3
 +
\chardef\@@alignment  =  4
 +
\chardef\@@endofline  =  5
 +
\chardef\@@parameter  =  6
 +
\chardef\@@superscript =  7
 +
\chardef\@@subscript  =  8
 +
\chardef\@@ignore      = 9
 +
\chardef\@@space      = 10
 +
\chardef\@@letter     = 11
 +
\chardef\@@other      = 12  \chardef\other  = 12
 +
\chardef\@@active      = 13  \chardef\active = 13
 +
\chardef\@@comment    = 14
 
</texcode>
 
</texcode>
  
Line 15: Line 29:
 
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>.
 
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>.
  
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!
+
{{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>.
 
These are constant counters, corresponding to <code>0</code>, <code>1</code> and <code>-1</code>.

Revision as of 01:42, 1 December 2006

< Prev: Fundamentals | Top: System Macros | Next: Scratch Variables >

Mnemonics and aliases

In ConTeXt we sometimes manipulate the <catcodes> of certain characters. Because we are not that good at numbers, we introduce some symbolic names. This makes it easier to key in things like this:

\chardef\@@escape      =  0
\chardef\@@begingroup  =  1
\chardef\@@endgroup    =  2
\chardef\@@mathshift   =  3
\chardef\@@alignment   =  4
\chardef\@@endofline   =  5
\chardef\@@parameter   =  6
\chardef\@@superscript =  7
\chardef\@@subscript   =  8
\chardef\@@ignore      =  9
\chardef\@@space       = 10
\chardef\@@letter      = 11
\chardef\@@other       = 12   \chardef\other  = 12
\chardef\@@active      = 13   \chardef\active = 13
\chardef\@@comment     = 14

If you don't understand the names of the macros, you can look them up in the TeXbook.

Two of these symbolic names are actually used so often that they even have non-protected aliases: \other and \active.

We often need a space as defined in Plain TeX. Because ConTeXt cannot be sure that \space is not redefined, it internally uses an alias: \normalspace.


NOTE: When dealing with ConTeXt, please remember to never (re-)define macros that start with \normal.... Weird, unexpected things can, and probably will, occur!

These are constant counters, corresponding to 0, 1 and -1.


NOTE: Beware: if you want to have access to @, !, and ? in macronames, use
\unprotect
\def\My@@MAcro{..}
\protect

instead of manipulating the catcode of @ directly. Protection macros handle nested usage.

< Prev: Fundamentals | Top: System Macros | Next: Scratch Variables >