From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/46939 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.comp.tex.context Subject: Re: Using defaults and indexes Date: Wed, 21 Jan 2009 18:11:22 +0100 Message-ID: References: <30C27B4C-BEC1-47D7-82B1-643F689EC3A5@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 1232558085 7017 80.91.229.12 (21 Jan 2009 17:14:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Jan 2009 17:14:45 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Jan 21 18:15:57 2009 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 1LPgg1-0005Mx-UI for gctc-ntg-context-518@m.gmane.org; Wed, 21 Jan 2009 18:15:41 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6F7D01FE32; Wed, 21 Jan 2009 18:14:22 +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 17278-02-4; Wed, 21 Jan 2009 18:13:05 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 3A1D71FC74; Wed, 21 Jan 2009 18:13:05 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 313441FC6F for ; Wed, 21 Jan 2009 18:13:03 +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 12872-04 for ; Wed, 21 Jan 2009 18:12:17 +0100 (CET) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by ronja.ntg.nl (Postfix) with ESMTP id AD6EE1FCBB for ; Wed, 21 Jan 2009 18:11:24 +0100 (CET) Original-Received: from rv-out-0708.google.com (rv-out-0708.google.com [209.85.198.249]) by filter2-til.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n0LHBMFk011691 for ; Wed, 21 Jan 2009 18:11:23 +0100 Original-Received: by rv-out-0708.google.com with SMTP id f25so4025033rvb.14 for ; Wed, 21 Jan 2009 09:11:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=7XSJTqgJUW7lmIFbUmJSVhm2cpSP7KqR2o9ndU0CeDA=; b=qkKmFU1ChEphSXy4iVrSZH09ifyvfTBwd1QyNYgE5fB7lqF5sIUldY+U+NgcQ2ha/K V5xVk9F6WsBbigkzJvD+G4gTAVVneMLp7BOxOAXagmVQdz3A7zvRvqb/X1QfONMgmXBD 6vDG2U0/BYDjmMgxhhk95kFvNP383HdMJoFwI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=uicx7jOayUJou+bGABRBHuGxM/TnqzyRUHqRswgRo42U6TFLFa0B6wsUGbaJ8eMnse +62JVCCr3WpLgp3b6L4FaQpfBNK3UsRkOruskDoaHA17yKeKS8nSVRmdMMKH1auPYgwc 40N8IzudbGviQdUzunyQDi0sYe0EMN7s2Dtq8= Original-Received: by 10.141.43.5 with SMTP id v5mr4054387rvj.246.1232557882049; Wed, 21 Jan 2009 09:11:22 -0800 (PST) In-Reply-To: <30C27B4C-BEC1-47D7-82B1-643F689EC3A5@gmail.com> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.198.249; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 168700474 - eeb19f6facf9 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 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:46939 Archived-At: 2009/1/21 Wolfgang Schuster : >> And in the main file I have: >> >> \letterclosing{Hoogachtend}{Cecil Westerhof} >> >> But I would like to have this as the default, so I could use: >> >> \letterclosing >> >> Beside that I would like to have the possibility to use: >> >> \letterclosing{business} >> or >> \letterclosing{family} >> >> This would then use defined values. >> >> When the first parameter is filled, but not with a recognized value, >> then the second parameter should be filled. If not, the compilation of >> the file should generate an error. Is this something that can be done? > > \long\def\letterbody#1% > {{\blank[line]\setupindenting[yes,medium]#1\par}} > > \def\letterclosing > {\dodoublegroupempty\doletterclosing} > > \def\doletterclosing#1#2% > {\ifsecondargument > \dodoletterclosing{#1}{#2}% > \else > \doifelsenothing{#1} > {\doletterclosing{Hoogachtend,}{Cecil Westerhof}}% > {\processaction > [#1] > [ family=>{\dodoletterclosing{Informal closing,}{Cecil > Westerhof}}, > business=>{\dodoletterclosing{Formal closing}{Cecil Westerhof}}, > unknown=>{\errorisfataltrue\waitonfatalerror}]}% > \fi} > > \def\dodoletterclosing#1#2% > {\blank[line]#1\blank[3*line]#2} > > \setupindenting[yes,none] > > \starttext > > \letterbody{\dorecurse{2}{\input knuth\par}} > \letterclosing{Hoogachtend,}{Cecil Westerhof} > > \page > > \letterbody{\dorecurse{2}{\input knuth\par}} > \letterclosing{family} > > \page > > \letterbody{\dorecurse{2}{\input knuth\par}} > \letterclosing{business} > > \page > > \letterbody{\dorecurse{2}{\input knuth\par}} > \letterclosing{unknown} > > \stoptext Goes a long way. With two parameters it works. When using 'unknown' or 'dummy', I get \wait= messages. When giving enter, the document is still generated. But that is not a real problem. But when using: \letterclosing or \letterclosing{} I get the same wait= message and there is no letterclosing generated (or an empty one). Found the problem. \doifelsenothing{#1} {\doletterclosing{Hoogachtend,}{Cecil Westerhof}}% should be: \doifelsenothing{#1} {\doletterclosing{Hoogachtend,}{Cecil Westerhof}}% Now it seems to do what I want. -- Cecil Westerhof ___________________________________________________________________________________ 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 ___________________________________________________________________________________