ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Substack in Context
@ 2006-01-28  6:12 Aditya Mahajan
  2006-01-28 10:36 ` Taco Hoekwater
  0 siblings, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2006-01-28  6:12 UTC (permalink / raw)


Hi,

  What is the context equivalent of latex's substack? How do I type the 
following
$$
\sum_{\substack i \in P \\ j \in Q} a_{ij}
$$

I search on source browser shows that this command was defined in 
newmat but pruned out. Is there a replacement for it? Is it safe to 
simply copy the definitions from m-newmat.tex and use them in my 
project?

Thanks
Aditya

-- 
Aditya Mahajan, EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam || Ph: 7342624008

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

* Re: Substack in Context
  2006-01-28  6:12 Substack in Context Aditya Mahajan
@ 2006-01-28 10:36 ` Taco Hoekwater
  2006-01-28 11:13   ` Aditya Mahajan
  0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2006-01-28 10:36 UTC (permalink / raw)


Aditya Mahajan wrote:
> Hi,
> 
>   What is the context equivalent of latex's substack? How do I type the 
> following
> $$
> \sum_{\substack i \in P \\ j \in Q} a_{ij}
> $$

Where is that defined? LateX gives me and 'Undefined control sequence',
and with \usepackage{amsmath} I get no error, but not a stack either.

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.

Cheers,
Taco

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

* Re: Substack in Context
  2006-01-28 10:36 ` Taco Hoekwater
@ 2006-01-28 11:13   ` Aditya Mahajan
  2006-01-28 11:52     ` Taco Hoekwater
  0 siblings, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2006-01-28 11:13 UTC (permalink / raw)


<--- On Jan 28, Taco Hoekwater wrote --->

> Aditya Mahajan wrote:
>> Hi,
>>
>>   What is the context equivalent of latex's substack? How do I type the
>> following
>> $$
>> \sum_{\substack i \in P \\ j \in Q} a_{ij}
>> $$
>
> Where is that defined? LateX gives me and 'Undefined control sequence',
> and with \usepackage{amsmath} I get no error, but not a stack either.


This is defined in amsmath. Sorry, I made a mistake in typing. It
should be

$$
\sum_{\substack{ a \\ b}} c
$$

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

-- 
Aditya Mahajan, EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam || Ph: 7342624008

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

* Re: Substack in Context
  2006-01-28 11:13   ` Aditya Mahajan
@ 2006-01-28 11:52     ` Taco Hoekwater
  2006-01-28 13:46       ` Vit Zyka
  0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2006-01-28 11:52 UTC (permalink / raw)


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

Cheers ,taco

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

* Re: Substack in Context
  2006-01-28 11:52     ` Taco Hoekwater
@ 2006-01-28 13:46       ` Vit Zyka
  2006-01-29 11:23         ` Taco Hoekwater
  2006-02-22 11:00         ` Aditya Mahajan
  0 siblings, 2 replies; 10+ messages in thread
From: Vit Zyka @ 2006-01-28 13:46 UTC (permalink / raw)


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

What about use math primitive \atop:

\def\substack#1%
    {\begingroup
     \let\\\atop
     #1
     \endgroup}

Vit

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

* Re: Substack in Context
  2006-01-28 13:46       ` Vit Zyka
@ 2006-01-29 11:23         ` Taco Hoekwater
  2006-02-22 11:00         ` Aditya Mahajan
  1 sibling, 0 replies; 10+ messages in thread
From: Taco Hoekwater @ 2006-01-29 11:23 UTC (permalink / raw)


Vit Zyka wrote:
> What about use math primitive \atop:
> 
> \def\substack#1%
>     {\begingroup
>      \let\\\atop
>      #1
>      \endgroup}

There can be more then two lines of subscripts.

Cheers, taco

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

* Re: Substack in Context
  2006-01-28 13:46       ` Vit Zyka
  2006-01-29 11:23         ` Taco Hoekwater
@ 2006-02-22 11:00         ` Aditya Mahajan
  2006-02-22 14:53           ` Taco Hoekwater
  1 sibling, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2006-02-22 11:00 UTC (permalink / raw)


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

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

* Re: Substack in Context
  2006-02-22 11:00         ` Aditya Mahajan
@ 2006-02-22 14:53           ` Taco Hoekwater
  2006-02-22 17:17             ` Aditya Mahajan
  2006-03-30 11:26             ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Taco Hoekwater @ 2006-02-22 14:53 UTC (permalink / raw)



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@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Substack in Context
  2006-02-22 14:53           ` Taco Hoekwater
@ 2006-02-22 17:17             ` Aditya Mahajan
  2006-03-30 11:26             ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Aditya Mahajan @ 2006-02-22 17:17 UTC (permalink / raw)


<--- On Feb 22, Taco Hoekwater wrote --->

>
> Does this look ok?
> (code is not production-ready yet, but seems reasonable to me)
>
> [code snipped]

Yes, looks good to my eyes. Thanks a lot.

Aditya



-- 
Aditya Mahajan, EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam || Ph: 7342624008

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

* Re: Substack in Context
  2006-02-22 14:53           ` Taco Hoekwater
  2006-02-22 17:17             ` Aditya Mahajan
@ 2006-03-30 11:26             ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2006-03-30 11:26 UTC (permalink / raw)


Taco Hoekwater wrote:
> 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}
>   
without vadjust: (mathstrut + nointerlineskip)

\def\startsubstack
   {\begingroup
    \null
    \vcenter\bgroup
    \pushmacro\domatrixNC
    \let\stopmathmode\relax % to be sure, will go away
    \def\NC{\domatrixNC}%
    \def\MC{\domatrixNC\startmathmode}%
    \global\let\domatrixNC\dodomatrixNC
    \def\NR{\stopmathmode
      \global\let\domatrixNC\dodomatrixNC
      \crcr\noalign{\nointerlineskip}}%
    \mathsurround\zeropoint
    \everycr\emptytoks
    \halign\bgroup\hfil$\scriptstyle\mathstrut##$\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@ntg.nl
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>>     
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>   


-- 

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

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

end of thread, other threads:[~2006-03-30 11:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-28  6:12 Substack in Context Aditya Mahajan
2006-01-28 10:36 ` Taco Hoekwater
2006-01-28 11:13   ` Aditya Mahajan
2006-01-28 11:52     ` Taco Hoekwater
2006-01-28 13:46       ` Vit Zyka
2006-01-29 11:23         ` Taco Hoekwater
2006-02-22 11:00         ` Aditya Mahajan
2006-02-22 14:53           ` Taco Hoekwater
2006-02-22 17:17             ` Aditya Mahajan
2006-03-30 11:26             ` Hans Hagen

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