From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30214 Path: news.gmane.org!not-for-mail From: "Mojca Miklavec" Newsgroups: gmane.comp.tex.context Subject: how to figure out the number of elements inside \defineconversion? Date: Thu, 10 Aug 2006 16:16:38 +0200 Message-ID: <6faad9f00608100716l5715b634p51f823f76ac51221@mail.gmail.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 1155219526 22691 80.91.229.2 (10 Aug 2006 14:18:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 10 Aug 2006 14:18:46 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Thu Aug 10 16:18:44 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 1GBBMn-00065q-R6 for gctc-ntg-context-518@m.gmane.org; Thu, 10 Aug 2006 16:18:34 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 66E701FED1; Thu, 10 Aug 2006 16:18:33 +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 18880-05-5; Thu, 10 Aug 2006 16:18:28 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 82A271FEB2; Thu, 10 Aug 2006 16:18:28 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 290F71FEB2 for ; Thu, 10 Aug 2006 16:18:26 +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 18880-05-4 for ; Thu, 10 Aug 2006 16:18:23 +0200 (CEST) Original-Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.228]) by ronja.ntg.nl (Postfix) with SMTP id 382D51FAA5 for ; Thu, 10 Aug 2006 16:18:22 +0200 (CEST) Original-Received: by wx-out-0506.google.com with SMTP id s12so399246wxc for ; Thu, 10 Aug 2006 07:18:22 -0700 (PDT) Original-Received: by 10.78.139.5 with SMTP id m5mr1319257hud; Thu, 10 Aug 2006 07:16:38 -0700 (PDT) Original-Received: by 10.78.175.15 with HTTP; Thu, 10 Aug 2006 07:16:38 -0700 (PDT) Original-To: "mailing list for ConTeXt users" 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:30214 Archived-At: Hello, I would like to \defineconversion and the use that set of symbols inside a metapost graphic. But I need to know the number of symbols, so that I can define enough "metapost images with symbols" in advance. I realise that there might be a problem since conversion can sometimes take an arbitrary number (using a command defined elsewhere), but if I could have a reasonable guess for conversions defined explicitely, that would already help a lot. (As a workaround and/or if there is no easy method to figure that out I can still hardcode "25" and wait until someone complains that that is not enough to satisfy his/her needs.) Thanks a lot, Mojca \startMPextensions numeric variant; variant = 1; vardef gp_the_symbol(expr n) = picture pict; % using metapost if variant=1: pict := image( fill fullcircle scaled 4pt; ); % TODO % using TeX, variant = 2 else: % TODO: limit the number first pict := sometxt(n); fi; pict shifted -center pict enddef ; def gp_point(expr x, y, n) = draw (gp_the_symbol(n) scaled 1 shifted (x,y)); enddef ; \stopMPextensions \starttext \defineconversion[abc][$\star$,$\bullet$,$\ast$] \startTeXtexts % TODO: 6 is only a guess: I need a better guess (3 in this case) \dostepwiserecurse{1}{6}{1}{\TeXtext{\recurselevel}{{\convertnumber{abc}{\recurselevel}}}} \stopTeXtexts \startMPcode variant := 1; gp_point(1cm,0cm,1); gp_point(2cm,0cm,2); variant := 2; gp_point(1cm,1cm,1); gp_point(2cm,1cm,2); gp_point(3cm,1cm,3); gp_point(4cm,1cm,4); gp_point(5cm,1cm,8); \stopMPcode \stoptext