ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Geert Verhaag <verhaaggchm@ziggo.nl>
Subject: Re: Struggling with startuseMPgraphic and string argument!
Date: Thu, 17 Sep 2020 10:01:39 +0200	[thread overview]
Message-ID: <77ccf844-93f2-009a-42e4-6e307b56bb0c@xs4all.nl> (raw)
In-Reply-To: <25c339a4-6507-db95-b4f1-752db5e86867@ziggo.nl>

On 9/16/2020 4:32 PM, Geert Verhaag wrote:
> Hi,
> 
> I'm trying to pass a string argument value to an MPgraphic but it 
> doesn't seem to work:
> 
> Tried the following:
> 
> \startuseMPgraphic{name}{lbl}
>    pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ;
> \stopuseMPgraphic
> 
> \starttext
>    \useMPgraphic{name}{lbl=1}
> \stoptext
> 
> The above works as expected!
> 
> But the following doesn't:
> 
> \startuseMPgraphic{name}{lbl}
>    pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ;
> \stopuseMPgraphic
> 
> \starttext
>    \useMPgraphic{name}{lbl=abc}
> \stoptext
> 
> It yields:
> 
>   1 \startuseMPgraphic{name}{lbl}
>   2       pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ;
>   3     \stopuseMPgraphic
>   4
>   5     %\startuseMPgraphic{name}fill fullcircle scaled 200pt withcolor 
> .625yellow ;\stopuseMPgraphic
>   6
>   7     \starttext
>   8      Example:
>   9 >>    \useMPgraphic{name}{lbl=abc}
> 10     \stoptext
> 11
> 
> <to be read again>
> a
> \m_meta_current_variable a-a
>                              bc
> <argument> ... \hbox {\scratchdimen \m_meta_current_variable
>                                                    sp}\ifzeropt \wd 
> \b_meta_v...
> \secondoftwoarguments #1#2b-#2
> 
> \9>>1 #1,2-\meta_prepare_instance_variable {#1}
> \syst_helpers_do_process_comm...
> \syst_helpers_do_process_comma_list ...rgument #1,
>                                                    ]\relax \global 
> \advance \...
> ...
> l.9   \useMPgraphic{name}{lbl=abc}
> 
> So it seems that only numbers can be passed not character strings! Why 
> is that? Is there a possibility to achieve this functionality?
magic:

\startuseMPgraphic{name}{s::lbl}
   pair a ; a := (3cm,3cm) ;label.top("\MPvariable{lbl}",a) ;
\stopuseMPgraphic

\starttext
   \useMPgraphic{name}{lbl=abc}
   \useMPgraphic{name}{lbl=def}
\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-09-17  8:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 14:32 Geert Verhaag
2020-09-17  8:01 ` Hans Hagen [this message]
2020-09-17 19:41 ` Geert Verhaag
2020-09-18  7:03   ` Hans Hagen
2020-09-18 11:48     ` Geert Verhaag

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=77ccf844-93f2-009a-42e4-6e307b56bb0c@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=verhaaggchm@ziggo.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).