[NTG-context] feature request

Henri Menke henrimenke at gmail.com
Thu Jul 4 07:48:07 CEST 2019


The existing definition of \pmatrix in math-pln.mkiv is the original
Plain TeX definition, because in the very early days ConTeXt used to be
compatible with Plain.  This tradition has prevailed until today.  You
will find other remnants of Plain TeX in ConTeXt, e.g. \eqalign, but it
is better not to use them.

Just like Plain TeX, ConTeXt does not provide \bmatrix and \vmatrix.
One reason is that they didn't exist in Plain, but another important
reason is that Hans is not a mathematician.  If I remember correctly
ConTeXt was originally developed for typesetting of primary school
textbooks and last I checked matrix algebra was not part of the
curriculum.

Other developers (Alan, Aditya, and others) have contributed math
typesetting macros over time, but these follow the ConTeXt philosophy of
providing strong defaults but trying to avoid feature creep.  Therefore
bmatrix, vmatrix, etc. are not defined by default, but as you saw from
my last message it is trivial to define these, especially because
templates (matrix:parentheses, etc.) for them already exist in the core.

It would sometimes be nice if you could just copy and paste LaTeX code
into a ConTeXt document and it just works™, but after all ConTeXt is not
LaTeX.

Cheers, Henri

On 4/07/19 5:18 PM, Atsuhito Kohda wrote:
> Hi Henri,
> Thanks for your suggestions, they are very instructive.
> However, my request is not a smart way of displaying matrices
> but to know why \bmatrix and \vmatrix are not provided
> in core part of ConTeXt although \pmatrix is provided already
> in math-pln.mkiv
> 
> About matrices, I first found commands in your first email in
> http://dl.contextgarden.net/myway/context-latex-math.pdf
> (like \startpmatrix \NC A\NC B\NR \NC C\NC D\NR\stoppmatrix)
> and then browsing ma-cb-en.pdf I noticed another command
> like \pmatrix{A&B\cr C&D\cr}.
> Now by your email, I know a command \pmatrix{A, B; C, D}
> 
> One might say ConTeXt is flexible but I've an impression
> that ConTeXt is in a state of confusion/disorder.
> 
> I think it is better if a standard command is provided
> by core ConTeXt or by a module etc.
> 
> Or is it ConTeXt way that each user defines his/her own commands
> in setup area and uses them in text area?
> I'm afraid consistency and/or portability is lost in such scenario.
> 
> BTW, I constantly convert Beamer documents into ConTeXt's
> simpleslide documents recently and it is very convenient
> if I can use \pmatrix{a&b\cr c&d\cr} style because it is similar
> to LaTeX documents.
> 
> 2019年7月3日(水) 15:42 Henri Menke <henrimenke at gmail.com>:
> 
>>
>>
>> On 3/07/19 6:00 PM, Atsuhito Kohda wrote:
>>> I've used LaTeX quite a long time but recently I begin to use ConTeXt
>> too.
>>> So I'm very sorry if the following is well-known issue.
>>>
>>> I find an example of \pmatrix in p.21 of "ConTeXt Mark IV an excursion"
>>> (ma-cb-en.pdf).  And I notice it is defined in
>>> /usr/share/texmf/tex/context/base/mkiv/math-pln.mkiv (in Debian).
>>> But it seems \bmatrix, \vmatrix are not defined yet.
>>> Is there any reason why they are not defined?
>>> Similar commands or environments \begin{bmatrix}...\end{bmatrix},
>>> \begin{vmatrix}...\end{vmatrix} are very often used in mathematical
>>> LaTeX documents.
>>> It is very useful if we can use \bmatrix and \vmatrix in ConTeXt
>>> documents, so please add
>>> \unexpanded\def\bmatrix#1%
>>>   {\left[\matrix{#1}\right]}
>>> \unexpanded\def\vmatrix#1%
>>>   {\left|\matrix{#1}\right|}
>>> in math-pln.mkiv or somewhere.
>>
>> Ignore my other message, this is even better:
>>
>> \definemathmatrix
>>   [pmatrix]
>>   [matrix:parentheses]
>>   [simplecommand=pmatrix]
>>
>> \definemathmatrix
>>   [bmatrix]
>>   [matrix:brackets]
>>   [simplecommand=bmatrix]
>>
>> \definemathmatrix
>>   [vmatrix]
>>   [matrix:bars]
>>   [simplecommand=vmatrix]
>>
>> \definemathmatrix
>>   [Vmatrix]
>>   [left={\left\lVert\mskip\thinmuskip},
>>    right={\mskip\thinmuskip\right\rVert},
>>    align=middle,
>>    simplecommand=Vmatrix]
>>
>> \starttext
>>
>> \startformula
>>     \startpmatrix
>>         \NC A \NC B \NR
>>         \NC C \NC D \NR
>>     \stoppmatrix
>>     \quad
>>     \startbmatrix
>>         \NC A \NC B \NR
>>         \NC C \NC D \NR
>>     \stopbmatrix
>>     \quad
>>     \startvmatrix
>>         \NC A \NC B \NR
>>         \NC C \NC D \NR
>>     \stopvmatrix
>>     \quad
>>     \startVmatrix
>>         \NC A \NC B \NR
>>         \NC C \NC D \NR
>>     \stopVmatrix
>> \stopformula
>>
>> \startformula
>>     \pmatrix{A, B; C, D}
>>     \quad
>>     \bmatrix{A, B; C, D}
>>     \quad
>>     \vmatrix{A, B; C, D}
>>     \quad
>>     \Vmatrix{A, B; C, D}
>> \stopformula
>>
>> \stoptext
>>
>>>
>>> By the way, I think it is critical to set
>>> \setupmathematics[ampersand=normal]
>>> to use \matrix above but I can't find this setting in ma-cb-en.pdf
>>> It is great if this is added in  ma-cb-en.pdf
>>>
>>>
>>>
>> ___________________________________________________________________________________
>>> If your question is of interest to others as well, please add an entry
>> to the Wiki!
>>>
>>> maillist : ntg-context at 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
>>>
>> ___________________________________________________________________________________
>>>
>>
>>
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to
>> the Wiki!
>>
>> maillist : ntg-context at 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
>>
>> ___________________________________________________________________________________
>>
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at 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
> ___________________________________________________________________________________
> 



More information about the ntg-context mailing list