[NTG-context] new tricks in beta

Hans Hagen pragma at wxs.nl
Wed Feb 20 14:47:40 CET 2013


Hi Aditya,

I made a mathstyle mechanism ... used in fences first:

\starttext

\startTEXpage[offset=1ex]

\def\TestMe#1%
   {\NC \ttbf #1
    \NC \ruledhbox{$\setupmathstyle[#1]x + x_j^2 + x_i^{e^2} + \frac{1}{x}$}
    \NC \ruledhbox{$\setupmathstyle[#1,small]x + x_j^2 + x_i^{e^2} + 
\frac{1}{x}$}
    \NC \NR}

\starttabulate[|l|r|l|]
\HL
\NC \NC \NC \ttbf ...,small \NC \NR
\HL
\TestMe{text}
\TestMe{text,cramped}
\TestMe{script}
\TestMe{script,cramped}
\TestMe{scriptscript}
\TestMe{scriptscript,cramped}
\TestMe{display}
\TestMe{display,cramped}
\HL
\stoptabulate

\stopTEXpage

\startTEXpage

$x\begingroup\setupmathstyle[script]x\endgroup x$ \par
$x{\setupmathstyle[script]x}x$ \par
$x\startmathstyle[script]x\stopmathstyle x$

\stopTEXpage

\definemathfence [scriptbracket] [bracket] 
[command=yes,color=red,mathstyle=script]
\definemathfence [smallbracket]  [bracket] 
[command=yes,color=green,mathstyle=small]
\definemathfence [normalbracket] [bracket] [command=yes,color=blue]

\startTEXpage[offset=1ex]

\startbuffer
test 
$a\frac{1}{normal}\scriptbracket{\frac{1}{script}}\normalbracket{\frac{1}{normal}}\smallbracket{\frac{1}{small}}c$ 
test \par
\stopbuffer

\getbuffer \setupmathfences [color=red] \getbuffer

\stopTEXpage

\stoptext

\starttext

\definemathfence [fancybracket] [bracket] [command=yes,color=blue]

test $|x|$ test \par
test $||x||$ test (okay) \par
test $a\left|\frac{1}{b}\right|c$ test \par
test $a\left||\frac{1}{b}\right||c$ test (not okay) \par

\startbuffer
test $a\fenced[bar]{\frac{1}{b}}c$ test \par
test $a\fenced[doublebar]{\frac{1}{b}}c$ test \par
test $a\fenced[bracket]{\frac{1}{b}}c$ test \par
test $a\fancybracket{\frac{1}{b}}c$ test \par
\stopbuffer

\getbuffer \setupmathfences [color=red] \getbuffer

\stoptext

Hans

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


More information about the ntg-context mailing list