Am 15.03.2009 um 16:15 schrieb Wei-Wei Guo:
I just finished reading the 'System_Macros'. I still don't get the
meaning
of '\??pb @lang@' in the following codes:
\def\lang#1%
{\def\biblanguage{#1}%
\ifcsname \??pb @l...@#1\endcsname
\expanded{\mainlanguage[\getvalue{\??pb @l...@#1}]}%
\expanded{\language[\getvalue{\??pb @l...@#1}]}%
\fi \ignorespaces}
In \lang[zh], for example, '\??pb @lang@' will be expanded to
\@@pblangen,
will it? Is \??pb a command? Is '\??pb @lang@' a command? Why can
there be
a whitespace in '\??pb @lang@'?
\lang{zh} forms in the \ifcsname ... \endcsname the command
\@@p...@lang@zh
and looks if the commands is defined, if this is true the language is
switched to chinese.
Sorry for some many questions. I'm so confused and don't know what to
search in wiki, manuals, etc..
The \??bp at the begin of the macro is ConTeXt's system to create a
namespace.
To understand I have to go a little bit away from the above macro and
will
explain it on ConText's command to create key-val list. With the
internal
command \getparameters is used to create key-val-lists, this is done
with
\getparameters[mycommand][width=1cm,height=2cm,align=right]
This creates the commands \mycommandwidth with the value 1cm,
\mycommandheight
with the value 2cm and \mycommandalign with the value right. The text
in the
first brace is the namespace which is used as prefix for each created
command.
To optimize this operation and save a little bit of TeX's register we
replace
'mycommand' with '\mycommand' which expand itself \mycommand, to make
this
system more consystem ConTeXt use the convetion to use namespaces with
two
question marks and two (or more) letter like the above \??bp, you can
more
of this tricks in a article from Hans [1].
The space after '\??bp' and the \lang macro above is necessary because
TeX
thinks otherwise '@lang@' is a part of the '\??bp' command and to
prevent
this Taco puts the space there.
As a normal user you don't want to write macros or as beginner in
ConTeXT
programming you don't have to care about this but it's good to know
why are
things done in this way to understand system macros.
[1] http://www.ntg.nl/maps/22/27.pdf
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________