ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Aditya Mahajan <adityam@umich.edu>,
	"ntg-context@ntg.nl >> mailing list for ConTeXt users"
	<ntg-context@ntg.nl>
Subject: Re: Bug when mathmatrix is used inside mathalign
Date: Wed, 27 Mar 2019 18:13:51 +0100	[thread overview]
Message-ID: <80bdf3d3-e4cf-8332-ce67-1a3d355d5a18@xs4all.nl> (raw)
In-Reply-To: <nycvar.YAK.7.76.44.1903271155390.12837@ervasbepr.pvz.zptvyy.pn>

On 3/27/2019 4:56 PM, Aditya Mahajan wrote:
> Hi,
> 
> It was reported on TeX.SE[1] that there is a bug when math matrix is used
> inside a math align:
> 
> \starttext
> \startformula
>      \startalign[n=2,align={right,left}]
>          \NC x
>          \NC = a ~ long ~ sequence ~ of ~ terms
>          \NR
>          \NC y
>          \NC = ok ~ left
>          \NR
>          \NC \startmatrix[left={\left\lbrack},right={\right\rbrack}]
>                  \NC x \NR
>                  \NC y \NR
>              \stopmatrix
>          \NC = why ~ right?
>          \NR
>          \NC y
>          \NC = ok ~ left ~ again
>          \NR
>      \stopalign
> \stopformula
> \stoptext
> 
> gives
> 
> https://i.stack.imgur.com/ZTAp3.png
> 
> 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

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2019-03-27 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27 15:56 Aditya Mahajan
2019-03-27 17:13 ` Hans Hagen
2019-03-27 17:13 ` Hans Hagen [this message]
2019-03-27 23:09   ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80bdf3d3-e4cf-8332-ce67-1a3d355d5a18@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).