From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/45161 Path: news.gmane.org!not-for-mail From: "Wolfgang Schuster" Newsgroups: gmane.comp.tex.context Subject: Re: Colored labels with MetaPost in MkII Date: Wed, 29 Oct 2008 08:32:25 +0100 Message-ID: <115224fb0810290032u17d9128ape445775348888825@mail.gmail.com> References: <115224fb0810240148o31a5b87blacbac5bc7caca9a@mail.gmail.com> <115224fb0810270128u5e70796ek5d0a34f2ac6579f8@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1225265675 10073 80.91.229.12 (29 Oct 2008 07:34:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Oct 2008 07:34:35 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Wed Oct 29 08:35:36 2008 connect(): Connection refused Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Kv5aP-0008UK-1b for gctc-ntg-context-518@m.gmane.org; Wed, 29 Oct 2008 08:35:25 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B0FA91FC03; Wed, 29 Oct 2008 08:34:16 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17591-01-14; Wed, 29 Oct 2008 08:33:33 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 01DDB1FC44; Wed, 29 Oct 2008 08:33:09 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6B8BA1FC39 for ; Wed, 29 Oct 2008 08:33:07 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 16818-04-10 for ; Wed, 29 Oct 2008 08:32:33 +0100 (CET) Original-Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.184]) by ronja.ntg.nl (Postfix) with ESMTP id 0E5441FC44 for ; Wed, 29 Oct 2008 08:32:26 +0100 (CET) Original-Received: by nf-out-0910.google.com with SMTP id c10so1176607nfd.44 for ; Wed, 29 Oct 2008 00:32:25 -0700 (PDT) Original-Received: by 10.102.234.20 with SMTP id g20mr1472920muh.71.1225265545401; Wed, 29 Oct 2008 00:32:25 -0700 (PDT) Original-Received: by 10.103.215.10 with HTTP; Wed, 29 Oct 2008 00:32:25 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:45161 Archived-At: On Tue, Oct 28, 2008 at 3:47 PM, Aditya Mahajan wrote: > On Mon, 27 Oct 2008, Wolfgang Schuster wrote: > >> On Fri, Oct 24, 2008 at 2:15 PM, Aditya Mahajan 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 ___________________________________________________________________________________