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

From Wiki
Jump to navigation Jump to search
m
m (fixed the \unprotect)
Line 6: Line 6:
  
 
<texcode>
 
<texcode>
\catcode'@\@@letter
+
\catcode'\@=\@@letter
 
</texcode>
 
</texcode>
  
Line 19: Line 19:
 
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>.
  
{{note|Beware: if you want to have access to @ ! and ? in macronames, use  
+
{{note|Beware: if you want to have access to @, !, and ? in macronames, use  
  
 
<texcode>
 
<texcode>
 
\unprotect
 
\unprotect
 
\def\My@@MAcro{..}
 
\def\My@@MAcro{..}
\unprotect
+
\protect
 
</texcode>
 
</texcode>
  

Revision as of 19:23, 29 November 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:

\catcode'\@=\@@letter

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.

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 >