ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Border matrix
@ 2017-08-28 16:33 Fabrice L
  2017-08-28 17:29 ` Hans Hagen
       [not found] ` <7c38cc04-4408-9799-7a27-fcd1c3a47f6b@wxs.nl>
  0 siblings, 2 replies; 6+ messages in thread
From: Fabrice L @ 2017-08-28 16:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1843 bytes --]

Hi,

I’have a lot of courses notes in MKII. I’m trying to move to MKIV. I have a
problem that I’m not able to resolve, to make a border matrix with
brackets. In MKII, I was using a macro, found somewhere, which works great,
but no longer works; here is the macro:

% Border matrix: first line and column are label
\catcode`\@=11\relax
\newdimen\p@renwd
\font\tenex=cmex10 \setbox0=\hbox{\tenex B} \p@renwd=\wd0
\def\bbordermatrix#1{\begingroup \m@th
\setbox\z@\vbox{\def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
    \ialign{$##$\hfil\kern2\p@\kern\p@renwd&\thinspace\hfil$##$\hfil
      &&\quad\hfil$##$\hfil\crcr
      \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
      #1\crcr\omit\strut\cr}}%
  \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
  \setbox\tw@\hbox{$\kern\wd\@ne\kern-\p@renwd\left[\kern-\wd\@ne
    \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
    \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right]$}%
  \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
\catcode`\@=12\relax

but MKIV gives me the error:

\bbordermatrix #1->\begingroup \m@th

                                     \setbox \z@ \vbox {\def \cr {\crcr
\noa...

l.26    i & j & k & l \cr}




16       \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}

17     \catcode`\@=12\relax

I look for solutions on the list, but did not find anything.Here is a
minimal example:

\starttext
A border matrix:
\startformula
\bbordermatrix{
   a & b & c & d \cr
   e & f & G & h \cr
   i & j & k & l \cr}
\stopformula
\stoptext

As I have in my notes hundreds of such matrix, it is really difficult to
change the input format.

Do you know, or can you point me, to a solution ? I’m in a dead end..
Thanks a lot.
F.

[-- Attachment #1.2: Type: text/html, Size: 6079 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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] 6+ messages in thread

* Re: Border matrix
  2017-08-28 16:33 Border matrix Fabrice L
@ 2017-08-28 17:29 ` Hans Hagen
  2017-08-28 17:44   ` Fabrice L
       [not found] ` <7c38cc04-4408-9799-7a27-fcd1c3a47f6b@wxs.nl>
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2017-08-28 17:29 UTC (permalink / raw)
  To: ntg-context

On 8/28/2017 6:33 PM, Fabrice L wrote:
> Hi,
> 
> I’have a lot of courses notes in MKII. I’m trying to move to MKIV. I 
> have a problem that I’m not able to resolve, to make a border matrix 
> with brackets. In MKII, I was using a macro, found somewhere, which 
> works great, but no longer works; here is the macro:
> 
> % Border matrix: first line and column are label
> \catcode`\@=11\relax
> \newdimen\p@renwd
> \font\tenex=cmex10 \setbox0=\hbox{\tenex B} \p@renwd=\wd0
> \def\bbordermatrix#1{\begingroup \m@th
> \setbox\z@\vbox{\def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
>      \ialign{$##$\hfil\kern2\p@\kern\p@renwd&\thinspace\hfil$##$\hfil
>        &&\quad\hfil$##$\hfil\crcr
>        \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
>        #1\crcr\omit\strut\cr}}%
>    \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
>    \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
>    \setbox\tw@\hbox{$\kern\wd\@ne\kern-\p@renwd\left[\kern-\wd\@ne
>      \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
>      \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right]$}%
>    \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
> \catcode`\@=12\relax

Such a plain macro needs to be made bodyfotn size aware and such.

> but MKIV gives me the error:
> 
> \bbordermatrix #1->\begingroup \m@th
> 
>                                       \setbox \z@ \vbox {\def \cr {\crcr 
> \noa...
> 
> l.26    i & j & k & l \cr}
> 
> 
> 16       \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
> 
> 17     \catcode`\@=12\relax
> 
> 
> I look for solutions on the list, but did not find anything.Here is a 
> minimal example:
> 
> \starttext
> A border matrix:
> \startformula
> \bbordermatrix{
>     a & b & c & d \cr
>     e & f & G & h \cr
>     i & j & k & l \cr}
> \stopformula
> \stoptext
> 
> As I have in my notes hundreds of such matrix, it is really difficult to 
> change the input format.
> 
> Do you know, or can you point me, to a solution ? I’m in a dead end..  
> Thanks a lot.
I'll add this:

\unprotect

\unexpanded\def\math_border_matrix#1#2#3% adapted plain
   {\begingroup
    %
    \pushmacro\cr
    %
    \setbox\scratchbox\hbox\bgroup
      \mr B%
    \egroup
    \scratchdimenone\wd\scratchbox
    %
    \scratchdimentwo.2\bodyfontsize
    %
    \mathsurround\zeropoint
    %
    \setbox\scratchboxone\vbox\bgroup
      \def\cr{%
        \crcr
        \noalign\bgroup
          \kern\scratchdimentwo
          \global\let\cr\endline
        \egroup
      }%
      \ialign{%
        \startimath\alignmark\alignmark\stopimath
        \hfil
        \kern\dimexpr\scratchdimentwo+\scratchdimenone\relax
        \aligntab
        \thinspace
        \hfil
        \startimath\alignmark\alignmark\stopimath
        \hfil
        \aligntab
        \aligntab
        \quad
        \hfil
        \startimath\alignmark\alignmark\stopimath
        \hfil
        \crcr
        \omit
        \strut
        \hfil
        \crcr
        \noalign{\kern-\baselineskip}%
        #3\crcr
        \omit
        \strut
        \cr
      }%
    \egroup
    \setbox\scratchboxtwo\vbox\bgroup
      \unvcopy\scratchboxone
      \global\setbox\globalscratchbox\lastbox
    \egroup
    \setbox\scratchboxtwo\hbox\bgroup
      \unhbox\globalscratchbox
      \unskip
      \global\setbox\globalscratchbox\lastbox
    \egroup
    \setbox\scratchboxtwo\hbox\bgroup
      \startimath
      \kern\dimexpr\wd\globalscratchbox-\scratchdimenone\relax
      \left#1\relax
      \kern-\wd\globalscratchbox
      \global\setbox\globalscratchbox\vbox\bgroup
        \box\globalscratchbox
        \kern\scratchdimentwo
      \egroup
      \vcenter\bgroup
        \kern-\ht\globalscratchbox
        \unvbox\scratchboxone
        \kern-\baselineskip
      \egroup
      \thinspace
      \right#2\relax
      \stopimath
    \egroup
    \null
    \thickspace
    \vbox\bgroup
      \kern\ht\globalscratchbox
      \box\scratchboxtwo
    \egroup
    %
    \popmacro\cr
    %
    \endgroup}

\unexpanded\def\bordermatrix {\math_border_matrix()}
\unexpanded\def\bbordermatrix{\math_border_matrix[]}

\protect

\starttext

A plain border matrix:

\startformula
\bordermatrix{
    a & b & c & d \cr
    e & f & G & h \cr
    i & j & k & l \cr}
\stopformula

\startformula
\bbordermatrix{
    a & b & c & d \cr
    e & f & G & h \cr
    i & j & k & l \cr}
\stopformula

\stoptext


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Border matrix
  2017-08-28 17:29 ` Hans Hagen
@ 2017-08-28 17:44   ` Fabrice L
  0 siblings, 0 replies; 6+ messages in thread
From: Fabrice L @ 2017-08-28 17:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4887 bytes --]

Thanks so much !
I’ll will add an entry to the wiki.
Fabrice.


Le 28 août 2017 à 13:29:55, Hans Hagen (pragma@wxs.nl) a écrit:

On 8/28/2017 6:33 PM, Fabrice L wrote:
> Hi,
>
> I’have a lot of courses notes in MKII. I’m trying to move to MKIV. I
> have a problem that I’m not able to resolve, to make a border matrix
> with brackets. In MKII, I was using a macro, found somewhere, which
> works great, but no longer works; here is the macro:
>
> % Border matrix: first line and column are label
> \catcode`\@=11\relax
> \newdimen\p@renwd
> \font\tenex=cmex10 \setbox0=\hbox{\tenex B} \p@renwd=\wd0
> \def\bbordermatrix#1{\begingroup \m@th
> \setbox\z@\vbox{\def\cr{\crcr\noalign{\kern2\p@\global\let\cr\endline}}%
>     \ialign{$##$\hfil\kern2\p@\kern\p@renwd&\thinspace\hfil$##$\hfil
>       &&\quad\hfil$##$\hfil\crcr
>       \omit\strut\hfil\crcr\noalign{\kern-\baselineskip}%
>       #1\crcr\omit\strut\cr}}%
>   \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}%
>   \setbox\tw@\hbox{\unhbox\@ne\unskip\global\setbox\@ne\lastbox}%
>   \setbox\tw@\hbox{$\kern\wd\@ne\kern-\p@renwd\left[\kern-\wd\@ne
>     \global\setbox\@ne\vbox{\box\@ne\kern2\p@}%
>     \vcenter{\kern-\ht\@ne\unvbox\z@\kern-\baselineskip}\,\right]$}%
>   \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
> \catcode`\@=12\relax

Such a plain macro needs to be made bodyfotn size aware and such.

> but MKIV gives me the error:
>
> \bbordermatrix #1->\begingroup \m@th
>
>                                      \setbox \z@ \vbox {\def \cr {\crcr
> \noa...
>
> l.26    i & j & k & l \cr}
>
>
> 16       \null\;\vbox{\kern\ht\@ne\box\tw@}\endgroup}
>
> 17     \catcode`\@=12\relax
>
>
> I look for solutions on the list, but did not find anything.Here is a
> minimal example:
>
> \starttext
> A border matrix:
> \startformula
> \bbordermatrix{
>    a & b & c & d \cr
>    e & f & G & h \cr
>    i & j & k & l \cr}
> \stopformula
> \stoptext
>
> As I have in my notes hundreds of such matrix, it is really difficult to
> change the input format.
>
> Do you know, or can you point me, to a solution ? I’m in a dead end..
> Thanks a lot.
I'll add this:

\unprotect

\unexpanded\def\math_border_matrix#1#2#3% adapted plain
{\begingroup
%
\pushmacro\cr
%
\setbox\scratchbox\hbox\bgroup
\mr B%
\egroup
\scratchdimenone\wd\scratchbox
%
\scratchdimentwo.2\bodyfontsize
%
\mathsurround\zeropoint
%
\setbox\scratchboxone\vbox\bgroup
\def\cr{%
\crcr
\noalign\bgroup
\kern\scratchdimentwo
\global\let\cr\endline
\egroup
}%
\ialign{%
\startimath\alignmark\alignmark\stopimath
\hfil
\kern\dimexpr\scratchdimentwo+\scratchdimenone\relax
\aligntab
\thinspace
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\aligntab
\aligntab
\quad
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\crcr
\omit
\strut
\hfil
\crcr
\noalign{\kern-\baselineskip}%
#3\crcr
\omit
\strut
\cr
}%
\egroup
\setbox\scratchboxtwo\vbox\bgroup
\unvcopy\scratchboxone
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\unhbox\globalscratchbox
\unskip
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\startimath
\kern\dimexpr\wd\globalscratchbox-\scratchdimenone\relax
\left#1\relax
\kern-\wd\globalscratchbox
\global\setbox\globalscratchbox\vbox\bgroup
\box\globalscratchbox
\kern\scratchdimentwo
\egroup
\vcenter\bgroup
\kern-\ht\globalscratchbox
\unvbox\scratchboxone
\kern-\baselineskip
\egroup
\thinspace
\right#2\relax
\stopimath
\egroup
\null
\thickspace
\vbox\bgroup
\kern\ht\globalscratchbox
\box\scratchboxtwo
\egroup
%
\popmacro\cr
%
\endgroup}

\unexpanded\def\bordermatrix {\math_border_matrix()}
\unexpanded\def\bbordermatrix{\math_border_matrix[]}

\protect

\starttext

A plain border matrix:

\startformula
\bordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\startformula
\bbordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\stoptext


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

[-- Attachment #1.2: Type: text/html, Size: 7401 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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] 6+ messages in thread

* Re: Border matrix
       [not found] ` <7c38cc04-4408-9799-7a27-fcd1c3a47f6b@wxs.nl>
@ 2018-04-19 20:05   ` Fabrice L
  2018-04-19 20:14     ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice L @ 2018-04-19 20:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 7175 bytes --]

Dear list,

Some months ago, Hans wrote to this list (see below) a macro to do matrix
showing outside the brackets some informations (like we usually do for
Markov chains), but adapted some plain tex code, which worked in MKII). I
have used with success this code since then, but some weeks ago, the
behavior of Context had changed (probably something on my part; I have
updated the installation, but nothing changed).

The problem (I think) is linked to \unprotect \protect. When this code is
put before the \starttext to the the cont-new-mkiv, the border matrix
behave well, but a simple \eqalign like this:

\startformula
\eqalign{ & \lambda=5, \mu =5 \cr
       & \mu=8 \cr }
\stopformula

do not works is I replace «  \lambda » by « \lambda_2 » for example. I have
no idea what’s is going on. here is a minimal example where Hans’s code is
before the \starttext:


% ————————————————————————————————————————
\unprotect

\def\math_border_NC_indeed
{\gdef\math_border_NC{\aligntab}}

\let\math_border_NC\math_border_NC_indeed

\def\math_border_NR
{\glet\math_border_NC\math_border_NC_indeed
\cr}

\unexpanded\def\math_border_matrix#1#2#3% adapted plain
{\begingroup
%
\pushmacro\cr
%
\setbox\scratchbox\hbox\bgroup
\mr B%
\egroup
\scratchdimenone\wd\scratchbox
%
\scratchdimentwo.2\bodyfontsize
%
\mathsurround\zeropoint
%
\def\NC{\math_border_NC}%
\def\NR{\math_border_NR}%
%
\setbox\scratchboxone\vbox\bgroup
\def\cr{%
\crcr
\noalign\bgroup
\kern\scratchdimentwo
\global\let\cr\endline
\egroup
}%
\ialign{%
\startimath\alignmark\alignmark\stopimath
\hfil
\kern\dimexpr\scratchdimentwo+\scratchdimenone\relax
\aligntab
\thinspace
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\aligntab
\aligntab
\quad
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\crcr
\omit
\strut
\hfil
\crcr
\noalign{\kern-\baselineskip}%
#3\crcr
\omit
\strut
\cr
}%
\egroup
\setbox\scratchboxtwo\vbox\bgroup
\unvcopy\scratchboxone
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\unhbox\globalscratchbox
\unskip
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\startimath
\kern\dimexpr\wd\globalscratchbox-\scratchdimenone\relax
\left#1\relax
\kern-\wd\globalscratchbox
\global\setbox\globalscratchbox\vbox\bgroup
\box\globalscratchbox
\kern\scratchdimentwo
\egroup
\vcenter\bgroup
\kern-\ht\globalscratchbox
\unvbox\scratchboxone
\kern-\baselineskip
\egroup
\thinspace
\right#2\relax
\stopimath
\egroup
\null
\thickspace
\vbox\bgroup
\kern\ht\globalscratchbox
\box\scratchboxtwo
\egroup
%
\popmacro\cr
%
\endgroup}

\unexpanded\def\bordermatrix {\math_border_matrix()}
\unexpanded\def\bbordermatrix{\math_border_matrix[]}

\unexpanded\def\startbordermatrix #1\stopbordermatrix
{\math_border_matrix(){#1}}
\unexpanded\def\startbbordermatrix#1\stopbbordermatrix{\math_border_matrix[]{#1}}

\let\stopbordermatrix \relax
\let\stopbbordermatrix\relax

% ————————
% Should there be a "\ptotect" ?
%\protect
% ————————

\starttext

A plain border matrix  :

\startformula
\bbordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\startformula
\startbbordermatrix
\NC a \NC b \NC c \NC d \NR
\NC e \NC f \NC G \NC h \NR
\NC i \NC j \NC k \NC l \NR
\stopbbordermatrix
\stopformula

\startformula
\eqalign{
& \lambda=5, \mu =5 \cr
% ————————
% Does not work if the next line is uncommented
% & \lambda_1=5, \mu =4 \cr
% ————————
& \mu=8 \cr
}
\stopformula

\stoptext

% ————————————————————————————————————————

Thanks for any help. By the way. Is there with MKIV a more direct way to do
such matrix ?
Fabrice.


Le 28 août 2017 à 13:47:59, Hans Hagen (pragma@wxs.nl) a écrit:

Hi,

Put this in cont-new.mkiv (after \unprotect):

\def\math_border_NC_indeed
{\gdef\math_border_NC{\aligntab}}

\let\math_border_NC\math_border_NC_indeed

\def\math_border_NR
{\glet\math_border_NC\math_border_NC_indeed
\cr}

\unexpanded\def\math_border_matrix#1#2#3% adapted plain
{\begingroup
%
\pushmacro\cr
%
\setbox\scratchbox\hbox\bgroup
\mr B%
\egroup
\scratchdimenone\wd\scratchbox
%
\scratchdimentwo.2\bodyfontsize
%
\mathsurround\zeropoint
%
\def\NC{\math_border_NC}%
\def\NR{\math_border_NR}%
%
\setbox\scratchboxone\vbox\bgroup
\def\cr{%
\crcr
\noalign\bgroup
\kern\scratchdimentwo
\global\let\cr\endline
\egroup
}%
\ialign{%
\startimath\alignmark\alignmark\stopimath
\hfil
\kern\dimexpr\scratchdimentwo+\scratchdimenone\relax
\aligntab
\thinspace
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\aligntab
\aligntab
\quad
\hfil
\startimath\alignmark\alignmark\stopimath
\hfil
\crcr
\omit
\strut
\hfil
\crcr
\noalign{\kern-\baselineskip}%
#3\crcr
\omit
\strut
\cr
}%
\egroup
\setbox\scratchboxtwo\vbox\bgroup
\unvcopy\scratchboxone
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\unhbox\globalscratchbox
\unskip
\global\setbox\globalscratchbox\lastbox
\egroup
\setbox\scratchboxtwo\hbox\bgroup
\startimath
\kern\dimexpr\wd\globalscratchbox-\scratchdimenone\relax
\left#1\relax
\kern-\wd\globalscratchbox
\global\setbox\globalscratchbox\vbox\bgroup
\box\globalscratchbox
\kern\scratchdimentwo
\egroup
\vcenter\bgroup
\kern-\ht\globalscratchbox
\unvbox\scratchboxone
\kern-\baselineskip
\egroup
\thinspace
\right#2\relax
\stopimath
\egroup
\null
\thickspace
\vbox\bgroup
\kern\ht\globalscratchbox
\box\scratchboxtwo
\egroup
%
\popmacro\cr
%
\endgroup}

\unexpanded\def\bordermatrix {\math_border_matrix()}
\unexpanded\def\bbordermatrix{\math_border_matrix[]}

\unexpanded\def\startbordermatrix #1\stopbordermatrix
{\math_border_matrix(){#1}}
\unexpanded\def\startbbordermatrix#1\stopbbordermatrix{\math_border_matrix[]{#1}}


\let\stopbordermatrix \relax
\let\stopbbordermatrix\relax

Then you can do:

\starttext

A plain border matrix:

\startformula
\bordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\startformula
\bbordermatrix{
a & b & c & d \cr
e & f & G & h \cr
i & j & k & l \cr}
\stopformula

\startformula
\startbordermatrix
\NC a \NC b \NC c \NC d \NR
\NC e \NC f \NC G \NC h \NR
\NC i \NC j \NC k \NC l \NR
\stopbordermatrix
\stopformula

\startformula
\startbbordermatrix
\NC a \NC b \NC c \NC d \NR
\NC e \NC f \NC G \NC h \NR
\NC i \NC j \NC k \NC l \NR
\stopbbordermatrix
\stopformula

\stoptext

Not the full matrix support of MKIV but good enough for plain simulations.


-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

[-- Attachment #1.2: Type: text/html, Size: 18606 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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] 6+ messages in thread

* Re: Border matrix
  2018-04-19 20:05   ` Fabrice L
@ 2018-04-19 20:14     ` Wolfgang Schuster
  2018-04-20  3:07       ` Fabrice L
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2018-04-19 20:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1333 bytes --]

1. The bordermatrix code is part of the core and you can remove it from 
cont-new.mkiv.

2. To use the \equalign command you have to enable the special meaning 
of & in math mode with \setupmathematics[ampersand=normal].

3. User the new mathalignment environment as replacement for \equalign 
which avoids special characters like &.

Wolfgang
> Fabrice L <mailto:fabrice.alpha@gmail.com>
> 19. April 2018 um 22:05
> Dear list,
>
> Some months ago, Hans wrote to this list (see below) a macro to do 
> matrix showing outside the brackets some informations (like we usually 
> do for Markov chains), but adapted some plain tex code, which worked 
> in MKII). I have used with success this code since then, but some 
> weeks ago, the behavior of Context had changed (probably something on 
> my part; I have updated the installation, but nothing changed).
>
> The problem (I think) is linked to \unprotect \protect. When this code 
> is put before the \starttext to the the cont-new-mkiv, the border 
> matrix behave well, but a simple \eqalign like this:
>
> \startformula
> \eqalign{ & \lambda=5, \mu =5 \cr
> & \mu=8 \cr }
> \stopformula
>
> do not works is I replace «  \lambda » by « \lambda_2 » for example. I 
> have no idea what’s is going on. here is a minimal example where 
> Hans’s code is before the \starttext:
>

[-- Attachment #1.2: Type: text/html, Size: 3729 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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] 6+ messages in thread

* Re: Border matrix
  2018-04-19 20:14     ` Wolfgang Schuster
@ 2018-04-20  3:07       ` Fabrice L
  0 siblings, 0 replies; 6+ messages in thread
From: Fabrice L @ 2018-04-20  3:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2060 bytes --]

Wolfgang, thanks so much ! Everything is clear now, and works fine.

I will explore the mathalignment environment, which I’m not used to.
Fabrice.


Le 19 avril 2018 à 16:14:51, Wolfgang Schuster (schuster.wolfgang@gmail.com)
a écrit:

1. The bordermatrix code is part of the core and you can remove it from
cont-new.mkiv.

2. To use the \equalign command you have to enable the special meaning of &
in math mode with \setupmathematics[ampersand=normal].

3. User the new mathalignment environment as replacement for \equalign
which avoids special characters like &.

Wolfgang

Fabrice L <fabrice.alpha@gmail.com>
19. April 2018 um 22:05
Dear list,

Some months ago, Hans wrote to this list (see below) a macro to do matrix
showing outside the brackets some informations (like we usually do for
Markov chains), but adapted some plain tex code, which worked in MKII). I
have used with success this code since then, but some weeks ago, the
behavior of Context had changed (probably something on my part; I have
updated the installation, but nothing changed).

The problem (I think) is linked to \unprotect \protect. When this code is
put before the \starttext to the the cont-new-mkiv, the border matrix
behave well, but a simple \eqalign like this:

\startformula
\eqalign{ & \lambda=5, \mu =5 \cr
       & \mu=8 \cr }
\stopformula

do not works is I replace «  \lambda » by « \lambda_2 » for example. I have
no idea what’s is going on. here is a minimal example where Hans’s code is
before the \starttext:

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

[-- Attachment #1.2: Type: text/html, Size: 5389 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2018-04-20  3:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 16:33 Border matrix Fabrice L
2017-08-28 17:29 ` Hans Hagen
2017-08-28 17:44   ` Fabrice L
     [not found] ` <7c38cc04-4408-9799-7a27-fcd1c3a47f6b@wxs.nl>
2018-04-19 20:05   ` Fabrice L
2018-04-19 20:14     ` Wolfgang Schuster
2018-04-20  3:07       ` Fabrice L

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