[NTG-context] Bug when mathmatrix is used inside mathalign

Hans Hagen j.hagen at xs4all.nl
Wed Mar 27 18:13:51 CET 2019


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
-----------------------------------------------------------------


More information about the ntg-context mailing list