From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/103728 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Bug when mathmatrix is used inside mathalign Date: Wed, 27 Mar 2019 19:09:14 -0400 (EDT) Message-ID: References: <80bdf3d3-e4cf-8332-ce67-1a3d355d5a18@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-805042624-1553728155=:7970" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="98074"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Alpine 2.21.99 (LNX 239 2017-12-04) To: "ntg-context@ntg.nl >> mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 28 00:10:12 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1h9HgR-000PNy-IV for gctc-ntg-context-518@m.gmane.org; Thu, 28 Mar 2019 00:10:11 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7C63F111495; Thu, 28 Mar 2019 00:09:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o37xt8eTH5nW; Thu, 28 Mar 2019 00:09:20 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 66903111480; Thu, 28 Mar 2019 00:09:20 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 545CF111341 for ; Thu, 28 Mar 2019 00:09:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r9494ABIPN3A for ; Thu, 28 Mar 2019 00:09:17 +0100 (CET) Original-Received: from maleficent.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.125.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 86ED1111480 for ; Thu, 28 Mar 2019 00:09:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=relay-2016-05-12; t=1553728155; bh=Lthb1/QddC0orcPQRpCsIcRnUXA/yDKsXrsbGnTr8b4=; h=Date:From:To:Subject:In-Reply-To:References; b=jQVpOONwjSMvn1PVeuQs+M6AX8n62kSXr3S1CjEAasMx8z9EmfZAaZKEeZif8Zwh9 oWoxsLrS6d1pQbW8Jqm657687e5GnRFHrDy7bCI94YYyEDKGNvbterEiNNq2TNCDwC q/iJlmqz+ORaAQV0z/y4B+VuoDUrdhpHwuVuJkse0McXxxe0A07P3zlNO+pTcHXfdU 8NmpPjvVbpiOUhkwK3Dpi5qNbBQHc8nqmh0i6qPSHa/QaH0k6Lrdrg3Rg1fgDSAhb6 fygC1UssLfnzbhgElQrMPYhthEmQmVjMFa0YheNWMLVvybgoJze40jt/zRfUOs6ld4 hLcdgFUR+/Q8g== Authentication-Results: maleficent.mr.itd.umich.edu; iprev=pass policy.iprev=198.84.249.206 (198-84-249-206.cpe.teksavvy.com); auth=pass smtp.auth=adityam Original-Received: FROM adi-thinkpad.local (198-84-249-206.cpe.teksavvy.com [198.84.249.206]) By maleficent.mr.itd.umich.edu ID 5C9C029B.4681D.30645; Authuser adityam; Wed, 27 Mar 2019 19:09:15 -0400 In-Reply-To: <80bdf3d3-e4cf-8332-ce67-1a3d355d5a18@xs4all.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:103728 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-805042624-1553728155=:7970 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 27 Mar 2019, Hans Hagen wrote: > On 3/27/2019 4:56 PM, Aditya Mahajan wrote: >> Hi, >>=20 >> It was reported on TeX.SE[1] that there is a bug when math matrix is use= d >> inside a math align: >>=20 >> \starttext >> \startformula >> =C2=A0=C2=A0=C2=A0 \startalign[n=3D2,align=3D{right,left}] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC x >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC =3D a ~ long ~ sequence = ~ of ~ terms >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NR >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC y >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC =3D ok ~ left >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NR >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC \startmatrix[left=3D{\le= ft\lbrack},right=3D{\right\rbrack}] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 \NC x \NR >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 \NC y \NR >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \sto= pmatrix >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC =3D why ~ right? >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NR >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC y >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NC =3D ok ~ left ~ again >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \NR >> =C2=A0=C2=A0=C2=A0 \stopalign >> \stopformula >> \stoptext >>=20 >> gives >>=20 >> https://i.stack.imgur.com/ZTAp3.png >>=20 >> It appears that \startmatrix globally resets \NC. I haven't looked into >> the code yet to see why this is happening. > you can play with > > \unprotect > > \newcount\c_math_eqalign_column_saved > \newcount\c_math_eqalign_first_saved > > \unexpanded\def\math_matrix_start#1% > {\begingroup > \c_math_eqalign_column_saved\c_math_eqalign_column > \c_math_eqalign_first_saved \c_math_eqalign_first > \edef\currentmathmatrix{#1}% > \dosingleempty\math_matrix_start_indeed} > > \def\math_matrix_stop > {\math_matrix_stop_processing > \global\c_math_eqalign_column\c_math_eqalign_column_saved > \global\c_math_eqalign_first\c_math_eqalign_first_saved > \endgroup} > > \protect Yes, this works. But we still need \globalpushmacro\c_math_matrix_first,=20 otherwise nested matrices have wrong distance. https://mailman.ntg.nl/pipermail/ntg-context/2017/089631.html So, the following appears to work correctly: \unprotect \newcount\c_math_eqalign_column_saved \newcount\c_math_eqalign_first_saved \unexpanded\def\math_matrix_start#1% {\begingroup \globalpushmacro\c_math_matrix_first \c_math_eqalign_column_saved\c_math_eqalign_column \c_math_eqalign_first_saved \c_math_eqalign_first \edef\currentmathmatrix{#1}% \dosingleempty\math_matrix_start_indeed} \def\math_matrix_stop {\math_matrix_stop_processing \global\c_math_eqalign_column\c_math_eqalign_column_saved \global\c_math_eqalign_first\c_math_eqalign_first_saved \globalpopmacro\c_math_matrix_first \endgroup} \protect I am not sure why the assignments in math_matrix_start are not global but= =20 those in math_matrix_stop are global. Aditya --8323329-805042624-1553728155=:7970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --8323329-805042624-1553728155=:7970--