From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/52506 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Multi-line labels in MetaPost Date: Sat, 22 Aug 2009 15:30:15 -0400 (EDT) Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1250969448 30896 80.91.229.12 (22 Aug 2009 19:30:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Aug 2009 19:30:48 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Aug 22 21:30:41 2009 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.50) id 1MewIS-0001iC-QB for gctc-ntg-context-518@m.gmane.org; Sat, 22 Aug 2009 21:30:40 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id F3494C9A9C; Sat, 22 Aug 2009 21:30:39 +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 hoF6ZEQ7YppX; Sat, 22 Aug 2009 21:30:36 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 72DE5C9A3D; Sat, 22 Aug 2009 21:30:36 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5B171C9A3D for ; Sat, 22 Aug 2009 21:30:35 +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 Sgy7PafaSaC1 for ; Sat, 22 Aug 2009 21:30:32 +0200 (CEST) Original-Received: from skycaptain.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.93.160]) by balder.ntg.nl (Postfix) with ESMTP id A13B4C9A1F for ; Sat, 22 Aug 2009 21:30:31 +0200 (CEST) Original-Received: FROM [192.168.2.8] (c-76-28-88-45.hsd1.ct.comcast.net [76.28.88.45]) By skycaptain.mr.itd.umich.edu ID 4A904755.E2C67.17316 ; Authuser adityam; 22 Aug 2009 15:30:30 EDT In-Reply-To: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) 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:52506 Archived-At: On Sat, 22 Aug 2009, Michail Vidiassov wrote: > Dear All, > >>> I have fixed this by using: >>> >>> label.rt(textext("\framed[frame=off,align=right]{One\\Two}"),origin); >>> > > And what about proper tables there? > Replacing One\\Two in the above code with > $ \startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC 1 \NR \stopmathmatrix $ All metapost environments expand their arguments, so anything looking for an optional argument fails. There are workarounds, though \unexpanded\def\MYMATRIX% {$\startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC 1 \NR \stopmathmatrix$} \starttext \startMPcode label.rt(\sometxt{\MYMATRIX}, origin) ; label.rt(textext ("\MYMATRIX"), (5cm,0)) ; \stopMPcode \stoptext And if you really want it to work, we need to make cetrain things unexpandable \unprotect \def\dodefinemathmatrix[#1]% [#2]% {\unexpanded\setvalue{\e!start#1}{\dodoubleempty\dostartmathmatrix[#1]}% \unexpanded\setvalue{\e!stop #1}{\dostopmathmatrix}% \setupmathmatrix[#1]}% [#2] \definemathmatrix[matrix] \definemathmatrix[\v!mathmatrix] \unexpanded\def\dodomatrixNC {\gdef\domatrixNC{\endmath&}} % To avoid errors in expansion \let\NC\relax \let\NR\relax \protect Now this works \starttext \startMPcode label.rt(\sometxt{$\startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC 1 \NR \stopmathmatrix$}, origin) ; \stopMPcode \stoptext Hans, should we add this to strc-ali? Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________