ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Colored labels with MetaPost in MkII
@ 2008-10-24  8:48 Wolfgang Schuster
  2008-10-24 13:15 ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2008-10-24  8:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

what is the best method to format MetaPost labels in MkII with \doattributes.

\setupcolors[state=start]

\def\labelstyle{bold}
\def\labelcolor{red}

\starttext
\startMPcode
label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
\stopMPcode
\stoptext

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
___________________________________________________________________________________


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

* Re: Colored labels with MetaPost in MkII
  2008-10-24  8:48 Colored labels with MetaPost in MkII Wolfgang Schuster
@ 2008-10-24 13:15 ` Aditya Mahajan
  2008-10-24 13:32   ` Wolfgang Schuster
  2008-10-27  8:28   ` Wolfgang Schuster
  0 siblings, 2 replies; 6+ messages in thread
From: Aditya Mahajan @ 2008-10-24 13:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 24 Oct 2008, Wolfgang Schuster wrote:

> Hi all,
>
> what is the best method to format MetaPost labels in MkII with \doattributes.

\startMPenvironment[global]
> \setupcolors[state=start]
>
> \def\labelstyle{bold}
> \def\labelcolor{red}
\stopMPenvironment

This gives you only bold label.

> \starttext
> \startMPcode
> label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
> \stopMPcode
> \stoptext

Tex colors do not work inside textext. Try

label(textext("\startcolor[red] red \stopcolor"), origin) ;

One way to get around this is to use \sometxt.

label(\sometxt{\doattributes{label}{style}{color}{Label}},(5cm,0)) ;

But then you have to be careful about the differences between \sometxt in 
MKII and MKIV (which I need to  summarize on the wiki).

Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: Colored labels with MetaPost in MkII
  2008-10-24 13:15 ` Aditya Mahajan
@ 2008-10-24 13:32   ` Wolfgang Schuster
  2008-10-27  8:28   ` Wolfgang Schuster
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2008-10-24 13:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Oct 24, 2008 at 3:15 PM, Aditya Mahajan <adityam@umich.edu> wrote:
> On Fri, 24 Oct 2008, Wolfgang Schuster wrote:
>
>> Hi all,
>>
>> what is the best method to format MetaPost labels in MkII with \doattributes.
>
> \startMPenvironment[global]
>> \setupcolors[state=start]
>>
>> \def\labelstyle{bold}
>> \def\labelcolor{red}
> \stopMPenvironment
>
> This gives you only bold label.

I try to avoid this.

>> \starttext
>> \startMPcode
>> label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
>> \stopMPcode
>> \stoptext
>
> Tex colors do not work inside textext. Try
>
> label(textext("\startcolor[red] red \stopcolor"), origin) ;
>
> One way to get around this is to use \sometxt.
>
> label(\sometxt{\doattributes{label}{style}{color}{Label}},(5cm,0)) ;

This helped me.

> But then you have to be careful about the differences between \sometxt in
> MKII and MKIV (which I need to  summarize on the wiki).

I use different code for MkII and MkIV and could use the best for each file.

Thanks and regards,
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
___________________________________________________________________________________


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

* Re: Colored labels with MetaPost in MkII
  2008-10-24 13:15 ` Aditya Mahajan
  2008-10-24 13:32   ` Wolfgang Schuster
@ 2008-10-27  8:28   ` Wolfgang Schuster
  2008-10-28 14:47     ` Aditya Mahajan
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2008-10-27  8:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Oct 24, 2008 at 2:15 PM, Aditya Mahajan <adityam@umich.edu> wrote:
> On Fri, 24 Oct 2008, Wolfgang Schuster wrote:
>
>> Hi all,
>>
>> what is the best method to format MetaPost labels in MkII with \doattributes.
>
> \startMPenvironment[global]
>> \setupcolors[state=start]
>>
>> \def\labelstyle{bold}
>> \def\labelcolor{red}
> \stopMPenvironment
>
> This gives you only bold label.
>
>> \starttext
>> \startMPcode
>> label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
>> \stopMPcode
>> \stoptext
>
> Tex colors do not work inside textext. Try
>
> label(textext("\startcolor[red] red \stopcolor"), origin) ;
>
> One way to get around this is to use \sometxt.
>
> label(\sometxt{\doattributes{label}{style}{color}{Label}},(5cm,0)) ;
>
> But then you have to be careful about the differences between \sometxt in
> MKII and MKIV (which I need to  summarize on the wiki).

Here is a new example where I can't even use \sometxt.

\setupcolors[state=start]

\def\labelstyle{bold}
\def\labelcolor{red}

\starttext
\resetMPdrawing
\startMPdrawing
label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
label(\sometxt{\doattributes{label}{style}{color}{Label}},origin) ;
\stopMPdrawing
\MPdrawingdonetrue
\getMPdrawing
\stoptext

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
___________________________________________________________________________________


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

* Re: Colored labels with MetaPost in MkII
  2008-10-27  8:28   ` Wolfgang Schuster
@ 2008-10-28 14:47     ` Aditya Mahajan
  2008-10-29  7:32       ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2008-10-28 14:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 27 Oct 2008, Wolfgang Schuster wrote:

> On Fri, Oct 24, 2008 at 2:15 PM, Aditya Mahajan <adityam@umich.edu> wrote:
>> On Fri, 24 Oct 2008, Wolfgang Schuster wrote:
>>
>>> Hi all,
>>>
>>> what is the best method to format MetaPost labels in MkII with \doattributes.
>>
>> \startMPenvironment[global]
>>> \setupcolors[state=start]
>>>
>>> \def\labelstyle{bold}
>>> \def\labelcolor{red}
>> \stopMPenvironment
>>
>> This gives you only bold label.
>>
>>> \starttext
>>> \startMPcode
>>> label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
>>> \stopMPcode
>>> \stoptext
>>
>> Tex colors do not work inside textext. Try
>>
>> label(textext("\startcolor[red] red \stopcolor"), origin) ;
>>
>> One way to get around this is to use \sometxt.
>>
>> label(\sometxt{\doattributes{label}{style}{color}{Label}},(5cm,0)) ;
>>
>> But then you have to be careful about the differences between \sometxt in
>> MKII and MKIV (which I need to  summarize on the wiki).
>
> Here is a new example where I can't even use \sometxt.

Sometxt does not work appear to work with \startMPdrawing (there is 
no output at all). I think that the reason is that MPdrawing simply writes 
stuff to the MPfile without doing the extra work needed for sometxt.

I will call this is a bug, but I do not know if Hans wants to work on 
TeX-MP interaction in MKII now.

> \setupcolors[state=start]
>
> \def\labelstyle{bold}
> \def\labelcolor{red}
>
> \starttext
> \resetMPdrawing
> \startMPdrawing
> label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
> label(\sometxt{\doattributes{label}{style}{color}{Label}},origin) ;
> \stopMPdrawing
> \MPdrawingdonetrue
> \getMPdrawing
> \stoptext

It may be possible to write your macros without \start-stop-MPdrawing. 
Everything inside \start-stop MP(code|graphic) is first parsed by TeX, so 
you can do things like

\newif\ifcircle \circletrue

\startMPcode
draw \ifcircle fullcircle \else fullsquare \fi xyscaled (5cm,5cm) ;
\stopMPcode

So, instead of writing stuff to MP using start-stop MPdrawing, you can 
simply set some flags in conditionals and chardefs, and then write one 
MP(graphic|code) to write one MP file. This strategy will not work for all 
cases, but can be useful for some.

Aditya

___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: Colored labels with MetaPost in MkII
  2008-10-28 14:47     ` Aditya Mahajan
@ 2008-10-29  7:32       ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2008-10-29  7:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Oct 28, 2008 at 3:47 PM, Aditya Mahajan <adityam@umich.edu> wrote:
> On Mon, 27 Oct 2008, Wolfgang Schuster wrote:
>
>> On Fri, Oct 24, 2008 at 2:15 PM, Aditya Mahajan <adityam@umich.edu> wrote:
>>> On Fri, 24 Oct 2008, Wolfgang Schuster wrote:
>>>
>>>> Hi all,
>>>>
>>>> what is the best method to format MetaPost labels in MkII with \doattributes.
>>>
>>> \startMPenvironment[global]
>>>> \setupcolors[state=start]
>>>>
>>>> \def\labelstyle{bold}
>>>> \def\labelcolor{red}
>>> \stopMPenvironment
>>>
>>> This gives you only bold label.
>>>
>>>> \starttext
>>>> \startMPcode
>>>> label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
>>>> \stopMPcode
>>>> \stoptext
>>>
>>> Tex colors do not work inside textext. Try
>>>
>>> label(textext("\startcolor[red] red \stopcolor"), origin) ;
>>>
>>> One way to get around this is to use \sometxt.
>>>
>>> label(\sometxt{\doattributes{label}{style}{color}{Label}},(5cm,0)) ;
>>>
>>> But then you have to be careful about the differences between \sometxt in
>>> MKII and MKIV (which I need to  summarize on the wiki).
>>
>> Here is a new example where I can't even use \sometxt.
>
> Sometxt does not work appear to work with \startMPdrawing (there is
> no output at all). I think that the reason is that MPdrawing simply writes
> stuff to the MPfile without doing the extra work needed for sometxt.
>
> I will call this is a bug, but I do not know if Hans wants to work on
> TeX-MP interaction in MKII now.
>
>> \setupcolors[state=start]
>>
>> \def\labelstyle{bold}
>> \def\labelcolor{red}
>>
>> \starttext
>> \resetMPdrawing
>> \startMPdrawing
>> label(textext("\doattributes{label}{style}{color}{Label}"),origin) ;
>> label(\sometxt{\doattributes{label}{style}{color}{Label}},origin) ;
>> \stopMPdrawing
>> \MPdrawingdonetrue
>> \getMPdrawing
>> \stoptext
>
> It may be possible to write your macros without \start-stop-MPdrawing.
> Everything inside \start-stop MP(code|graphic) is first parsed by TeX, so
> you can do things like
>
> \newif\ifcircle \circletrue
>
> \startMPcode
> draw \ifcircle fullcircle \else fullsquare \fi xyscaled (5cm,5cm) ;
> \stopMPcode
>
> So, instead of writing stuff to MP using start-stop MPdrawing, you can
> simply set some flags in conditionals and chardefs, and then write one
> MP(graphic|code) to write one MP file. This strategy will not work for all
> cases, but can be useful for some.

I droped now the MKII part of my module and rewrite parts of the code
with Lua, sometimes and easier and I could use start/stopMPcode with
calls to TeX for a few functions.

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
___________________________________________________________________________________


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

end of thread, other threads:[~2008-10-29  7:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-24  8:48 Colored labels with MetaPost in MkII Wolfgang Schuster
2008-10-24 13:15 ` Aditya Mahajan
2008-10-24 13:32   ` Wolfgang Schuster
2008-10-27  8:28   ` Wolfgang Schuster
2008-10-28 14:47     ` Aditya Mahajan
2008-10-29  7:32       ` Wolfgang Schuster

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