From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/71892 Path: news.gmane.org!not-for-mail From: "Meer, H. van der" Newsgroups: gmane.comp.tex.context Subject: Re: metapost question Date: Fri, 21 Oct 2011 15:34:12 +0000 Message-ID: <815A8FE9-1C03-478F-96FE-8087FEB941C5@uva.nl> References: <0E2E620E-1148-41AD-9966-54A594FCCE94@xs4all.nl> <4EA18C11.1040502@gmx.net> 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: dough.gmane.org 1319211279 17093 80.91.229.12 (21 Oct 2011 15:34:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 21 Oct 2011 15:34:39 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 21 17:34:31 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RHH79-000444-5c for gctc-ntg-context-518@m.gmane.org; Fri, 21 Oct 2011 17:34:31 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 837DACB083; Fri, 21 Oct 2011 17:34:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id buankfTbWpkx; Fri, 21 Oct 2011 17:34:28 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id EDAF4CB07F; Fri, 21 Oct 2011 17:34:27 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7EB2CCB07F for ; Fri, 21 Oct 2011 17:34:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lZ-jA6Kg6KZv for ; Fri, 21 Oct 2011 17:34:15 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 51CB8CAFFB for ; Fri, 21 Oct 2011 17:34:15 +0200 (CEST) Original-Received: from holleman.uva.nl (holleman.uva.nl [146.50.108.228]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p9LFYCwO022998 for ; Fri, 21 Oct 2011 17:34:15 +0200 Original-Received: from vanthoff.uva.nl (146.50.108.242) by holleman.uva.nl (146.50.108.228) with Microsoft SMTP Server (TLS) id 14.1.289.1; Fri, 21 Oct 2011 17:34:12 +0200 Original-Received: from ketelaar.uva.nl ([fe80::cc61:4c73:c438:df97]) by vanthoff.uva.nl ([::1]) with mapi id 14.01.0289.001; Fri, 21 Oct 2011 17:34:12 +0200 Thread-Topic: [NTG-context] metapost question Thread-Index: AQHMj/JPwyFporOz80afp1/C9724qJWGxoSAgAAF0oA= In-Reply-To: <4EA18C11.1040502@gmx.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [82.95.102.36] Content-ID: <646298FE6F1A934C8E5EE881D79DFA24@uva.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=146.50.108.228; country=NL; region=07; city=Amsterdam; latitude=52.3500; longitude=4.9167; http://maps.google.com/maps?q=52.3500,4.9167&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0rFLrydIc - 77c2b6103875 - 20111021 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:71892 Archived-At: On 21 okt. 2011, at 17:13, Peter Rolf wrote: > Am 21.10.2011 15:05, schrieb Hans van der Meer: >> I cannot find the answer to the following question in Knuth's Metafont book. >> The following definition with a trailing text argument: >> >> def mydef (expr a, b, c) text modifier = >> if : > > Have you already tried > > if modifier = "" : > > >> else: >> fi >> enddef; I tried it now, but it doesn't work. Something like if(TEXT4) ="":;fi in the error log. No, Metapost is not happy with this construct. >> >> How can I do the switch on an empty or nonempty modifier argument? It is not a string because calling its length fails with an error. >> I must do the switch, because "fill modifier" with an empty "modifier" gives horrible results. >> >> Usage would be calls like: >> mydef(1,2,3) withcolor green; % with modifier text >> mydef(1,2,3); % without modifier text Thanks in advance. Hans van der Meer ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________