From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30043 Path: news.gmane.org!not-for-mail From: "Mojca Miklavec" Newsgroups: gmane.comp.tex.context Subject: Re: metafun & \sometxt: should black be "black" or "textcolor"? Date: Sun, 6 Aug 2006 19:02:53 +0200 Message-ID: <6faad9f00608061002k249ed9f6t659abfd24fe36fc7@mail.gmail.com> References: <6faad9f00608051932ie703df0j94c670536a0f156f@mail.gmail.com> <44D5ADBE.3010809@elvenkind.com> <6faad9f00608060426g7d389fb4k803f2725f02ceef3@mail.gmail.com> <44D5FEBB.8020808@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1154883813 12674 80.91.229.2 (6 Aug 2006 17:03:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 6 Aug 2006 17:03:33 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Aug 06 19:03:31 2006 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 ciao.gmane.org with esmtp (Exim 4.43) id 1G9m1o-0007ee-4j for gctc-ntg-context-518@m.gmane.org; Sun, 06 Aug 2006 19:03:04 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D556E1FFFB; Sun, 6 Aug 2006 19:03:03 +0200 (CEST) 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 22938-05; Sun, 6 Aug 2006 19:02:56 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A57E11FFED; Sun, 6 Aug 2006 19:02:56 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id BC94C1FFED for ; Sun, 6 Aug 2006 19:02:54 +0200 (CEST) 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 22939-05 for ; Sun, 6 Aug 2006 19:02:53 +0200 (CEST) Original-Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.189]) by ronja.ntg.nl (Postfix) with SMTP id AFA181FFEA for ; Sun, 6 Aug 2006 19:02:53 +0200 (CEST) Original-Received: by nf-out-0910.google.com with SMTP id x29so741363nfb for ; Sun, 06 Aug 2006 10:02:53 -0700 (PDT) Original-Received: by 10.78.180.18 with SMTP id c18mr2167018huf; Sun, 06 Aug 2006 10:02:53 -0700 (PDT) Original-Received: by 10.78.175.15 with HTTP; Sun, 6 Aug 2006 10:02:53 -0700 (PDT) Original-To: "mailing list for ConTeXt users" In-Reply-To: <44D5FEBB.8020808@elvenkind.com> Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 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:30043 Archived-At: On 8/6/06, Taco Hoekwater wrote: > Hi Mojca, > > Mojca Miklavec wrote: > > > > But the other \sometxt was indeed red - withcolor seems to work, but > > only conditionally. And I have some weird examples of two texts one > > after another. In some cases (if something else is drawn inbetween and > > a color changed twice), then the second text will be black. But it's > > quite unpredictable (that one might even be bug in my code, so I don't > > want to complain before I have an example). > > Ok, I looked into this again, and I was definately wrong. > > The actual problem appears to be that metapost does not write a > color switch for 'black' when it appears at the start of a file, What a pitty that metapost wasn't one of Knuth's programs ;) > it simply assumes the start color is black. This could be > considered a bug in MetaPost or a missing feature in ConTeXt > (i have not decided yet :-)). > > Quick fix: You can start your MP code with an explicit color > initialization. > > \startMPcode > special "0 setgray"; > ...... > \stopMPcode > > > A hack, I know. MetaPost should be able to distinguish between > draw p > and > draw p withcolor (0,0,0) > but currently it can't (because the structure is initialized > as (0,0,0)). It is not quite a bug either, because there may > well be MP code out there that depends on this. > In fact, probably code by Knuth, Hobby, Jacko, and Hans ;-) Well, now to be honest: color "zero" (not "0 setgray", but the first color in Gnuplot) is not supposed to be black, but should be "foreground color" according to the guidelines (not that other divices are configurable in that respect, but anyway). So it might indeed make more sense to inherit the "textcolor". What do you think? I spotted the problem when I was using a dark background with white text on it. I'm not sure if I indeed want black or not. I want to make the colors configurable anyway (which they're currently not, but I have to figure out how to do that first), probably with something like \defineconversion[color set x][white,red,yellow,green] \setupGNUPLOT[colorset=color set x] % or perhaps even something like "foregroundcolor|maincolor=white" So I actually liked the fact that the numbers on the plot were white without having to configure anything (red and green were clearly seen on the background), but the plot as a whole was useless since the borders were still black & invisible and on some plots some text was black as well (in a pseudo random way). So rather than using that hack I would prefer to ask: which color should I define in the module to make the border of the same color as "textcolor"? Or (a question for later, it's not on the top priority right now): how can I extract the color from \setupGNUPLOT[foregroundcolor=yellow] and store it to a variable "color gp_foregroundcolor;" defined in a module? Any other thoughts about it? > > A question for you or Hans: can please someone explain me in a few > > words what's the main strategy/philosophy behind \sometxt. I don't > > understand exactly how TeX processes it (and metapost > > shrinks/expands/shifts/colors) it inline. > > TeX typesets the argument of the \sometxt macro in a hbox and > writes its box dimensions to . > > To the metapost file, a zero-padded serial number is written > instead, and MP uses the dimensions it finds in > for the positioning of that label. > > ConTeXt then replaces the metapost label number with the TeX material > while interpreting the Metapost result. > > This is the short version, the actual situation is a little bit more > complex (not a whole lot though). The actual code is in meta-tex.tex > and mp-txts.mp Thanks for the wonderful explanation! Thank you again, Mojca