ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Commands with arguments with MetaPost
@ 2012-04-25 16:15 Troy Henderson
  2012-04-25 16:45 ` Alan BRASLAU
  2012-04-25 16:55 ` Rogers, Michael K
  0 siblings, 2 replies; 3+ messages in thread
From: Troy Henderson @ 2012-04-25 16:15 UTC (permalink / raw)
  To: ntg-context

I would like to be able to do something like this

\def\foo#1{
    \startMPcode
        fill (0,0)--(598,0)--(598,50)--(0,50)--cycle withcolor green;
        label.rt(btex #1 etex),(50,25);
  \stopMPcode
}

and then use this in my ConTeXt document by

\foo{Some text}

However, my syntax seems to be incorrect, and I would appreciate any
help in fixing it.

Thanks,

Troy Henderson
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Commands with arguments with MetaPost
  2012-04-25 16:15 Commands with arguments with MetaPost Troy Henderson
@ 2012-04-25 16:45 ` Alan BRASLAU
  2012-04-25 16:55 ` Rogers, Michael K
  1 sibling, 0 replies; 3+ messages in thread
From: Alan BRASLAU @ 2012-04-25 16:45 UTC (permalink / raw)
  To: ntg-context

On Wed, 25 Apr 2012 11:15:10 -0500
Troy Henderson <thenders@gmail.com> wrote:

> I would like to be able to do something like this
> 
> \def\foo#1{
>     \startMPcode
>         fill (0,0)--(598,0)--(598,50)--(0,50)--cycle withcolor green;
>         label.rt(btex #1 etex),(50,25);
>   \stopMPcode
> }
> 
> and then use this in my ConTeXt document by
> 
> \foo{Some text}
> 
> However, my syntax seems to be incorrect, and I would appreciate any
> help in fixing it.
> 

\framed [frame=off,background=color,backgroundcolor=green,width=598,height=50]
	{Some text}

(Of course, you need to put correct dimensions for the width and height
and also set an offset.)

Untested, so the syntax may be not quite correct.

You might want to use
\setupframedtext
and
\startframedtext
\stopframedtext
if you will be doing this often.
There is probably also a way to define a named framed text.

Alan
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Commands with arguments with MetaPost
  2012-04-25 16:15 Commands with arguments with MetaPost Troy Henderson
  2012-04-25 16:45 ` Alan BRASLAU
@ 2012-04-25 16:55 ` Rogers, Michael K
  1 sibling, 0 replies; 3+ messages in thread
From: Rogers, Michael K @ 2012-04-25 16:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Apr 25, 2012, at 12:15 PM, Troy Henderson wrote:

> I would like to be able to do something like this
>
> \def\foo#1{
>    \startMPcode
>        fill (0,0)--(598,0)--(598,50)--(0,50)--cycle withcolor green;
>        label.rt(btex #1 etex),(50,25);
>  \stopMPcode
> }
>


Looks like a misplaced parenthesis:

       label.rt(btex #1 etex,(50,25));

  - Michael

________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-25 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25 16:15 Commands with arguments with MetaPost Troy Henderson
2012-04-25 16:45 ` Alan BRASLAU
2012-04-25 16:55 ` Rogers, Michael K

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).