On 7/9/2022 12:40 AM, Otared Kavian via ntg-context wrote:
I just found that \choose has been replaced with \binom (binomial coefficient):

\starttext
\meaning\choose

\meaning\binom

$\binom{n}{k}$
\stoptext

Sorry for complaining… :-)
no problem ... maybe we should have a wiki page for 'use this instead of that'

as you're playing with it ... there is a lot we haven't yet introduced but we will do that stepwise .. here's one

inline formulas like $(x + a + 2)$ will break across lines but traditionally \left( .. \right) doesn't which is why these \bigg things are there : manual solution for breaking inline math

however, in lmtx these do break across lines but there are of course still cases where the penalties injected will discourage it; there is agranular penalty system in place but current it is configured as traditional tex

now, when a formula doesn't break and is somehow wrapped it doesn't play that well with linebreaks but you can cheat: formulas can becoem liek glue where the inter atom stretch and shrink can play a more prominent role ... here's a test:

% turning small inline formulas into leaders to that we don't get overflows
% or excessive spacing

\continuewhenlmtxmode

\startbuffer[threshold-none]
    \setupbodyfont[modern]
    \setuppapersize[A5]
    \setuplayout[tight]
    \setupmathematics[threshold=none]
    \dorecurse {950} {
        test $\darkblue \showboxes x + #1    $
        test $\darkred  \showboxes x + #1 + z$
    }
\stopbuffer

\startbuffer[threshold-small]
    \setupbodyfont[modern]
    \setuppapersize[A5]
    \setuplayout[tight]
    \setupmathematics[threshold=small]
    \dorecurse {950} {
        test $\darkblue \showboxes x + #1    $
        test $\darkred  \showboxes x + #1 + z$
    }
\stopbuffer

\startbuffer[threshold-medium]
    \setupbodyfont[modern]
    \setuppapersize[A5]
    \setuplayout[tight]
    \setupmathematics[threshold=medium]
    \dorecurse {950} {
        test $\darkblue \showboxes x + #1    $
        test $\darkred  \showboxes x + #1 + z$
    }
\stopbuffer

\startbuffer[threshold-big]
    \setupbodyfont[modern]
    \setuppapersize[A5]
    \setuplayout[tight]
    \setupmathematics[threshold=big]
    \dorecurse {950} {
        test $\darkblue \showboxes x + #1    $
        test $\darkred  \showboxes x + #1 + z$
    }
\stopbuffer

\starttext
    \dorecurse {10} {
        \startcombination[2*2]
{\hbox to .45\textwidth{\typesetbuffer[threshold-none] [frame=on,width=.45\textwidth,page=#1]\hss}} {\type {threshold=none}} {\hbox to .45\textwidth{\typesetbuffer[threshold-small] [frame=on,width=.45\textwidth,page=#1]\hss}} {\type {threshold=small}} {\hbox to .45\textwidth{\typesetbuffer[threshold-medium][frame=on,width=.45\textwidth,page=#1]\hss}} {\type {threshold=medium}} {\hbox to .45\textwidth{\typesetbuffer[threshold-big] [frame=on,width=.45\textwidth,page=#1]\hss}} {\type {threshold=big}}
        \stopcombination
    }
\stoptext

There is also a system like widows and orphans in the sense that one can set forward and backward penalties, as in:

\setuplayout[width=11cm]

\startbuffer
    \dorecurse {50} {
        test $\darkblue   a +         #1         + b > 2$ %
        test $\darkred    a + b +     #1     + c + d > 2$ %
        test $\darkgreen  a + b + c + #1 + d + e + f > 2$ %
    }
\stopbuffer

\setuptolerance[verytolerant,stretch]

\starttext
    \start
        \mathforwardpenalties  0
        \mathbackwardpenalties 0
        \getbuffer
        \par
    \stop
    \page
    \start
        \mathforwardpenalties  2 -200 -100
        \mathbackwardpenalties 2 -100  -50
        \getbuffer
        \par
    \stop
    \page
    \start
        \mathforwardpenalties  2  200 100
        \mathbackwardpenalties 2  100  50
        \getbuffer
        \par
    \stop
    \page
\stoptext

but we currently don't have a high level interface for that; it will be part of the more general math penalties setup.

These are just a few of the things to play with.

Hans


-----------------------------------------------------------------
                                          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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to