ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: What does "\c!" means?
Date: Sun, 15 Mar 2009 16:38:49 +0100	[thread overview]
Message-ID: <7C7AB787-E756-4130-93F4-F2F560488726@gmail.com> (raw)
In-Reply-To: <49BD1B85.2080009@gmail.com>


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 @lang@#1\endcsname
>        \expanded{\mainlanguage[\getvalue{\??pb @lang@#1}]}%
>        \expanded{\language[\getvalue{\??pb @lang@#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  
\@@pp@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
___________________________________________________________________________________


  reply	other threads:[~2009-03-15 15:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06 17:22 How to use my own BibTeX style (bst)? Wei-Wei Guo
     [not found] ` <436429714.24327@zju.edu.cn>
     [not found]   ` <49B2ACE1.5010800@gmail.com>
     [not found]     ` <6faad9f00903090800v44877263te205e056cb28d282@mail.gmail.com>
     [not found]       ` <49B5363D.4060700@elvenkind.com>
2009-03-12 16:38         ` Wei-Wei Guo
2009-03-12 18:29           ` Taco Hoekwater
2009-03-13  1:15             ` Wei-Wei Guo
2009-03-13  8:09               ` Taco Hoekwater
2009-03-13 10:27                 ` Wei-Wei Guo
2009-03-13 17:30                   ` Taco Hoekwater
2009-03-14  4:23                     ` Wei-Wei Guo
2009-03-14  4:32                     ` What does "\c!" means? Wei-Wei Guo
2009-03-14  7:22                       ` Alan Stone
2009-03-14  7:25                         ` Taco Hoekwater
2009-03-14 14:44                           ` Wei-Wei Guo
2009-03-15 15:15                           ` Wei-Wei Guo
2009-03-15 15:38                             ` Wolfgang Schuster [this message]
2009-03-15 16:01                             ` Hans Hagen
2009-03-16  5:13                               ` Wei-Wei Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7C7AB787-E756-4130-93F4-F2F560488726@gmail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).