Changes

Jump to navigation Jump to search
1,925 bytes removed ,  09:17, 1 August 2006
[[System_Macros/Scratch_Variables]]
== Expansion control == When in unprotected mode, to be entered with <code>\unprotect</code>, one can use <code>\@EA</code> as equivalent of <code>\expandafter</code>. <code>\@EAEA</code> expands to two expandafters, <code>\@EAEAEA</code> to three, and the last one expands to <code>\@EA\@EAEAEA\@EA</code>. Sometimes we pass macros as arguments to commands that don't expand them before interpretation. Such commands can be enclosed by <code>\expanded</code>, like: <texcode>\expanded{\setupsomething[\alfa]}</texcode> Such situations occur for instance when <code>\alfa<[System_Macros/code> is a commalist or when data stored in macros is fed to index of list commands. If needed, one should use <code>\noexpand</code> inside the argument. Later on we will meet some more clever alternatives to this command. These two commands make macros more readable by hiding a lot of <code>\expandafter</code>'s. They expand the arguments after the first command. <texcode>\expandoneargafter \command{\abc}\expandtwoargsafter\command{\abc}{\def}\fullexpandoneargafter \command{\abc}\fullexpandtwoargsafter\command{\abc}{\def}</texcode> These commands expect the arguments to be macros. When expansion of a macro gives problems we can precede it by <code>\unexpanded</code>, like so: <texcode>\unexpanded\def\somecommand{... ... ...}</texcode> (if you are not familiar with ConTeXt: this is the same command as <code>\protect</code> in LaTeX). It seems that protection is one of the burdens of developers of packages, so maybe that's why in e-TeX protection is solved in a more robust way. ConTeXt uses that (more robust) solution if it is available, and otherwise tries it's best to emulate it using rather tricky macros. Expansion problems can get quite complex. There are some other internal macros that can help harnassing it, but it is fairly unlikely that you will need them. If you believe you do, read the [[source:syst-gen.tex| syst-gen.texExpansion_Control]] source code.
== Argument grabbing and handling ==

Navigation menu