ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Bug in mathmatrix and possible fix
@ 2017-08-22 23:22 Henri
  0 siblings, 0 replies; only message in thread
From: Henri @ 2017-08-22 23:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear devs,

It is currently not possible to have nested mathmatrices.  The reason is that
\popmacro\math_matrix_NC is done at an inner scope and a succeeding \endgroup will happily overwrite
this again.  A possible fix is to move \popmacro\math_matrix_NC to the very outer scope in
\math_matrix_stop, see below.  I don't know and have not tested whether this breaks something else.

Cheers, Henri

---

\unprotect

\def\math_matrix_stop
  {\crcr
 % \ifgridsnapping \else
     \mathstrut\crcr
     \noalign{\vskip-\baselineskip}%
 % \fi
   \egroup
  %\popmacro\math_matrix_NC % Too early!
   \egroup
   \mathmatrixright
   \endgroup
   \popmacro\math_matrix_NC} % ungrouped!

\protect

\definemathmatrix[pmatrix][left={\left(}, right={\right)}, distance=2em]

\def\matOne{\startmatrix\NC 1 \NC 0 \NR\NC 0 \NC 1\NR\stopmatrix}
\def\matTwo{\startmatrix\NC a\NR\NC b\NR\stopmatrix}
\def\matThree{\startmatrix\NC c \NC d\NR\stopmatrix}

\starttext

\startformula
  \startpmatrix
    \NC \matOne \NC \matTwo\NR
    \NC \matThree \NC e\NR
  \stoppmatrix
\stopformula
\startformula
  \startpmatrix
    \NC 1 \NC 0 \NC a \NR
    \NC 0 \NC 1 \NC b \NR
    \NC c \NC d \NC e\NR
  \stoppmatrix
\stopformula

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-22 23:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 23:22 Bug in mathmatrix and possible fix Henri

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