[NTG-context] Substack in Context
Taco Hoekwater
taco at elvenkind.com
Wed Feb 22 15:53:38 CET 2006
Does this look ok?
(code is not production-ready yet, but seems reasonable to me)
Taco
\def\startsubstack
{\begingroup
\null
\vcenter\bgroup
\pushmacro\domatrixNC
\let\endmath\relax
\def\NC{\domatrixNC}%
\def\MC{\domatrixNC\ifmmode\else$\def\endmath{$}\fi}%
\global\let\domatrixNC\dodomatrixNC
\def\NR{\endmath%
\global\let\domatrixNC\dodomatrixNC
\vadjust{\kern -.33\bodyfontsize}\crcr}%
\mathsurround\zeropoint
\everycr\emptytoks
\halign\bgroup \hfil$\scriptstyle ##$\hfil\crcr }
\def\stopsubstack
{\crcr
\egroup
\popmacro\domatrixNC
\egroup
\endgroup}
\starttext
\startformula
\sum_{%
\startsubstack
i = 1 \NR
i \neq n \NR
i \neq m
\stopsubstack
}a_i
\stopformula
\stoptext
Aditya Mahajan wrote:
> <--- On Jan 28, Taco Hoekwater wrote --->
>
>>Aditya Mahajan wrote:
>>
>>>>The definition from m-newmat is at least partly superceded by the
>>>>new core math definitions Hans added last week, so a new implementation
>>>>would be better.
>>>
>>>Can you suggest something?
>>
>>Like this maybe?
>>
>>\def\substack#1%
>> {\begingroup
>> \let\\\cr
>> \startmathmatrix #1\stopmathmatrix
>> \endgroup}
>>
>>Probably needs a bit of tweaking to make it look better
>>(perhaps a [strut=no] parameter?).
>>
>
>
> <--- On Jan 28, Vit Zyka wrote --->
>
>>What about use math primitive \atop:
>>
>>\def\substack#1%
>> {\begingroup
>> \let\\\atop
>> #1
>> \endgroup}
>>
>
>
>
> Sorry for not getting back for almost a month. Both suggestions work
> only partially. Consider
>
> \startmathformula
> \sum_{%
> \startmathmatrix
> i = 1 \NR i \neq n \NR i \neq m
> \stopmathmatrix
> }a_i
> \stopformula
>
> As Taco mentioned, the spacing is bad.
>
> \atop gives correct spacing but you need to put subscripts in groups
> of two.
>
> \startformula
> \sum_{ {i = 1 \atop i \neq n}\atop i \neq m } a_i
> \stopformula
>
> Moreover, the font size is incorrect in both cases. Compare with the
> size of the subscript in \sum_{i = 1}.
>
> Any suggestions?
>
> Aditya
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
More information about the ntg-context
mailing list