From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/27111 Path: news.gmane.org!not-for-mail From: Vit Zyka Newsgroups: gmane.comp.tex.context Subject: Re: \setupframed[...][...=...] Date: Wed, 12 Apr 2006 11:39:31 +0200 Message-ID: <443CCAD3.8010504@seznam.cz> References: <443C48FF.40504@seznam.cz> <443CC437.3020500@wxs.nl> 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 1144834741 6441 80.91.229.2 (12 Apr 2006 09:39:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Apr 2006 09:39:01 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Apr 12 11:38:59 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 1FTboO-0007xF-KH for gctc-ntg-context-518@m.gmane.org; Wed, 12 Apr 2006 11:38:56 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AA415127A3; Wed, 12 Apr 2006 11:38:55 +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 14711-02; Wed, 12 Apr 2006 11:38:51 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A6C7F12796; Wed, 12 Apr 2006 11:38:50 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 43E7B12796 for ; Wed, 12 Apr 2006 11:38:49 +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 14568-07 for ; Wed, 12 Apr 2006 11:38:48 +0200 (CEST) Original-Received: from smtp.seznam.cz (smtp.seznam.cz [212.80.76.43]) by ronja.ntg.nl (Postfix) with SMTP id 6959F1278D for ; Wed, 12 Apr 2006 11:38:48 +0200 (CEST) Original-Received: (qmail 15423 invoked from network); 12 Apr 2006 09:38:47 -0000 Original-Received: from unknown (HELO ?127.0.0.1?) (typokvitek@seznam.cz@62.240.166.134) by cetus.go.seznam.cz with ESMTPA; 12 Apr 2006 09:38:47 -0000 X-Seznam-User: typokvitek@seznam.cz User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <443CC437.3020500@wxs.nl> X-Antivirus: avast! (VPS 0615-1, 11.04.2006), Outbound message X-Antivirus-Status: Clean 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:27111 Archived-At: Hans Hagen wrote: > Vit Zyka wrote: > >>Hi, >> >>I tied to extend \setupframed[...=...] to also \setupframed[...][...=...]: >> >>--------------------------------- >>\unprotect >>\def\setupframed{\dodoubleempty\dosetupframed} >>\def\dosetupframed{% >> \ifsecondargument >> \@EA\dodoublesetupframed >> \else >> \@EA\dosinglesetupframed >> \fi >>} >>\def\dosinglesetupframed[#1][#2]{\getparameters[\??oi][#1]} >>\def\dodoublesetupframed[#1][#2]{% >> \bgroup >> \def\dodoubleempty{}% >> \def\doframed[##1]{##1}% >> \xdef\tmp{\getvalue{#1}}% >> \egroup >> >>\@EA\setvalue\@EA{\@EA#1\@EA}\@EA{\@EA\dodoubleempty\@EA\doframed\@EA[\tmp,#2]}% >>} >>\protect >> >>\starttext >>\setupframed[framecolor=yellow] \framed{A} >>\defineframed[myframed][framecolor=blue] \myframed{B} >>\setupframe[myframe][framecolor=red] \myframed{C} >>\stoptext >>------------------------------------- >> >>it works but with fully expansion of options. So it works a bit >>differently in a cases >>1) >>\def\ONorOFF{off} >>\defineframed[myframed][frame=\ONorOFF] >>\def\ONorOFF{on}\myframed{A} >> >>2) >>\def\ONorOFF{off} >>\defineframed[myframed][frame=\ONorOFF] >>\setupframed[myframe][framecolor=red] >>\def\ONorOFF{on}\myframed{A} >> >>Is there some simple solution? Or it has to be rewritten in a way like >>other \definesomething[...] (storing every parameter/definition-instance >>in a macro)? If sometimes this code would be reviewed I vote for doing >>\setupframed in this 'standard' ConTeXt way. >> >> > > next time post with less typos -) Sorry, next time I try to choose better time then 3 o'clock at night. > anyway, here is a working solution: > > \unprotect > > \def\setupframed > {\dodoubleempty\dosetupframed} > > \def\dosetupframed > {\ifsecondargument > \@EA\dodoublesetupframed > \else > \@EA\dosinglesetupframed > \fi} > > \def\dosinglesetupframed[#1][#2]% > {\getparameters[\??oi][#1]} > > \def\dodoublesetupframed[#1][#2]% > {\bgroup > \let\dodoubleempty\empty > \def\doframed[##1]{\gdef\globalredefinedframed{\dodoubleempty\doframed[##1,#2]}}% > \getvalue{#1}% > \egroup > \letvalue{#1}\globalredefinedframed} > > \protect Clever. > keep in mind that some 100 setups of the same instance may lead to rather big definitions Yes, but no problem, I need only one (or two) resetuping after definition. > \setupcolors[state=start] > > \starttext > \setupframed[framecolor=yellow] \framed{A} > \defineframed[myframed][framecolor=blue] \myframed{B} > \setupframed[myframed][framecolor=red] \myframed{C} > \stoptext > > i need to think about adding this, since it may break other things (i will run it for a while) All right. > you can add such patches to cont-loc.tex which is not distributed but read at runtime I see, I did not know about this file. Fine. Thanks Hans, Vit