From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Colored labels with MetaPost in MkII
Date: Tue, 28 Oct 2008 10:47:51 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.1.00.0810281030470.5080@nqv-yncgbc> (raw)
In-Reply-To: <115224fb0810270128u5e70796ek5d0a34f2ac6579f8@mail.gmail.com>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2008-10-28 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 8:48 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 [this message]
2008-10-29 7:32 ` Wolfgang Schuster
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=alpine.DEB.1.00.0810281030470.5080@nqv-yncgbc \
--to=adityam@umich.edu \
--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).