ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Sharing color between MP and TeX
@ 2011-08-05  7:07 Procházka Lukáš Ing. - Pontex s. r. o.
  2011-08-05  7:36 ` Peter Rolf
  2011-08-05  7:38 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-08-05  7:07 UTC (permalink / raw)
  To: ConTeXt

Hello,

I'd need to use the same color for text and drawing inside a MP code.

The typical situation looks the following way:

----
\definecolor[COL][.7red]
\starttext
   \startMPcode
      label(btex \color[COL]{Some text} etex, (0, 0));
      color col; col := .7red;
      draw unitsquare scaled .5cm withcolor col;
   \stopMPcode
\stoptext
----

The problem is that the color must be defined twice - first as TeX's 'COL', later as MP's 'col'.

As far as I know, the 'COL' must be defined inside TeX code as colored text in MP is achieved *only* by calling TeX's "btex \a-color-family-command[a-color][some-text] etex".

So that's why I think the color must be defined in TeX.

But how to access the TeX's color in MP?

Thanks in advance.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___________________________________________________________________________________
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: Sharing color between MP and TeX
  2011-08-05  7:07 Sharing color between MP and TeX Procházka Lukáš Ing. - Pontex s. r. o.
@ 2011-08-05  7:36 ` Peter Rolf
  2011-08-05  7:38 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Rolf @ 2011-08-05  7:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 05.08.2011 09:07, schrieb Procházka Lukáš Ing. - Pontex s. r. o.:
> Hello,
> 
> I'd need to use the same color for text and drawing inside a MP code.
> 
> The typical situation looks the following way:
> 
> ----
> \definecolor[COL][.7red]
> \starttext
>   \startMPcode
>      label(btex \color[COL]{Some text} etex, (0, 0));
>      color col; col := .7red;
>      draw unitsquare scaled .5cm withcolor col;
>   \stopMPcode
> \stoptext
> ----
> 
> The problem is that the color must be defined twice - first as TeX's
> 'COL', later as MP's 'col'.
> 
> As far as I know, the 'COL' must be defined inside TeX code as colored
> text in MP is achieved *only* by calling TeX's "btex
> \a-color-family-command[a-color][some-text] etex".
> 
> So that's why I think the color must be defined in TeX.
> 
> But how to access the TeX's color in MP?
>
\MPcolor{tex color name}

Best wishes,  Peter

> Thanks in advance.
> 
> Best regards,
> 
> Lukas
> 
> 

___________________________________________________________________________________
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: Sharing color between MP and TeX
  2011-08-05  7:07 Sharing color between MP and TeX Procházka Lukáš Ing. - Pontex s. r. o.
  2011-08-05  7:36 ` Peter Rolf
@ 2011-08-05  7:38 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2011-08-05  7:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 5-8-2011 9:07, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> Hello,
>
> I'd need to use the same color for text and drawing inside a MP code.
>
> The typical situation looks the following way:
>
> ----
> \definecolor[COL][.7red]
> \starttext
> \startMPcode
> label(btex \color[COL]{Some text} etex, (0, 0));
> color col; col := .7red;
> draw unitsquare scaled .5cm withcolor col;
> \stopMPcode
> \stoptext
> ----
>
> The problem is that the color must be defined twice - first as TeX's
> 'COL', later as MP's 'col'.
>
> As far as I know, the 'COL' must be defined inside TeX code as colored
> text in MP is achieved *only* by calling TeX's "btex
> \a-color-family-command[a-color][some-text] etex".
>
> So that's why I think the color must be defined in TeX.
>
> But how to access the TeX's color in MP?

it's all in the metafun manual and also in example code ...

withcolor \MPcolor{COL} ;

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://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:[~2011-08-05  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05  7:07 Sharing color between MP and TeX Procházka Lukáš Ing. - Pontex s. r. o.
2011-08-05  7:36 ` Peter Rolf
2011-08-05  7:38 ` Hans Hagen

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