Hi Fabrice,

I think the problem comes from a blank line in your matrix (after your last line of entries in your matrix). The following works fine for me:

\definemathmatrix
  [pmatrix]
  [left={\left(\,},right={\,\right)}]
  
\starttext

\startformula
A = \startpmatrix
\NC 11 \NC 12 \NR
\NC 21 \NC 22 \NR
\stoppmatrix
\stopformula

\startformula
M^3 = \startpmatrix
       \NC 2 \NC 3 \NC 6  \NC 4 \NC 2 \NC 7  \NC 3  \NC 1 \NR 
       \NC 3 \NC 0 \NC 1  \NC 1 \NC 2 \NC 3  \NC 6  \NC 4 \NR  
       \NC 6 \NC 1 \NC 4  \NC 4 \NC 4 \NC 9  \NC 10 \NC 6 \NR  
       \NC 4 \NC 1 \NC 4  \NC 4 \NC 5 \NC 8  \NC 8  \NC 3 \NR  
       \NC 2 \NC 2 \NC 4  \NC 5 \NC 2 \NC 7  \NC 3  \NC 1 \NR  
       \NC 7 \NC 3 \NC 9  \NC 8 \NC 7 \NC 8  \NC 10 \NC 3 \NR  
       \NC 3 \NC 6 \NC 10 \NC 8 \NC 3 \NC 10 \NC 4  \NC 1 \NR  
       \NC 1 \NC 4 \NC 6  \NC 3 \NC 1 \NC 3  \NC 1  \NC 0 \NR  
\stoppmatrix
\stopformula

\stoptext

Best regards: OK


On 17 Jan 2018, at 19:19, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:

Hello,
This macro that is not mine worked very well. I just tested the following file and there is a problem.
Thank you
Fabrice

\definemathmatrix
  [pmatrix]
  [left={\left(\,},right={\,\right)}]
 
\starttext

\math{M^3=\startpmatrix
       \NC 2 \NC 3 \NC 6  \NC 4 \NC 2 \NC 7  \NC 3  \NC 1 \NR
       \NC 3 \NC 0 \NC 1  \NC 1 \NC 2 \NC 3  \NC 6  \NC 4 \NR 
       \NC 6 \NC 1 \NC 4  \NC 4 \NC 4 \NC 9  \NC 10 \NC 6 \NR 
       \NC 4 \NC 1 \NC 4  \NC 4 \NC 5 \NC 8  \NC 8  \NC 3 \NR 
       \NC 2 \NC 2 \NC 4  \NC 5 \NC 2 \NC 7  \NC 3  \NC 1 \NR 
       \NC 7 \NC 3 \NC 9  \NC 8 \NC 7 \NC 8  \NC 10 \NC 3 \NR 
       \NC 3 \NC 6 \NC 10 \NC 8 \NC 3 \NC 10 \NC 4  \NC 1 \NR 
       \NC 1 \NC 4 \NC 6  \NC 3 \NC 1 \NC 3  \NC 1  \NC 0 \NR 
      
     \stoppmatrix} 
 
\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________