ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* mathalignment within a table - help needed!
@ 2011-05-14  1:17 Alasdair McAndrew
  2011-05-14  1:23 ` Aditya Mahajan
  0 siblings, 1 reply; 5+ messages in thread
From: Alasdair McAndrew @ 2011-05-14  1:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1121 bytes --]

Hello,

I'm trying to typeset some linear algebra exercises for my students; the
exercises will be within a table, and each second element will be a system
of linear equations.  This sort of thing:

\starttable[|l|M|l|M|]
\NC (a) \NC %

\startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
      \NC 3x\NC +\NC 6y\NC -\NC 2z\NC =\NC -13\NR
      \NC -6x\NC -\NC 9y\NC +\NC 5z\NC =\NC 22\NR
      \NC 3x\NC +\NC 3y\NC -\NC 5z\NC =\NC -13\NR
    \stopmathalignment
\NC (b) \NC %

\startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
\NC x\NC +\NC 3y\NC +\NC 3z\NC =\NC -4\NR
\NC x\NC +\NC 4y\NC +\NC 5z\NC =\NC -5\NR
\NC 2x\NC +\NC 4y\NC +\NC 3z\NC =\NC -5\NR
\stopmathalignment
\NC\AR
\stoptable

But this doesn't work.  There seems to be a problem with the mathalignment
environment within the table.  What do I need enclose these in so that they
will be treated as displayed equations within the table environment?  I'm
using MkII.

Thanks,
Alasdair

-- 
Blog: http://amca01.wordpress.com
Web:  http://bit.ly/Alasdair
Facebook: http://www.facebook.com/alasdair.mcandrew

[-- Attachment #1.2: Type: text/html, Size: 3138 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: mathalignment within a table - help needed!
  2011-05-14  1:17 mathalignment within a table - help needed! Alasdair McAndrew
@ 2011-05-14  1:23 ` Aditya Mahajan
  2011-05-14  1:57   ` Alasdair McAndrew
  2011-05-14 10:28   ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Aditya Mahajan @ 2011-05-14  1:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 14 May 2011, Alasdair McAndrew wrote:

> Hello,
>
> I'm trying to typeset some linear algebra exercises for my students; the
> exercises will be within a table, and each second element will be a system
> of linear equations.  This sort of thing:
>
> \starttable[|l|M|l|M|]
> \NC (a) \NC %
>
> \startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
>      \NC 3x\NC +\NC 6y\NC -\NC 2z\NC =\NC -13\NR
>      \NC -6x\NC -\NC 9y\NC +\NC 5z\NC =\NC 22\NR
>      \NC 3x\NC +\NC 3y\NC -\NC 5z\NC =\NC -13\NR
>    \stopmathalignment
> \NC (b) \NC %
>
> \startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
> \NC x\NC +\NC 3y\NC +\NC 3z\NC =\NC -4\NR
> \NC x\NC +\NC 4y\NC +\NC 5z\NC =\NC -5\NR
> \NC 2x\NC +\NC 4y\NC +\NC 3z\NC =\NC -5\NR
> \stopmathalignment
> \NC\AR
> \stoptable
>
> But this doesn't work.  There seems to be a problem with the mathalignment
> environment within the table.  What do I need enclose these in so that they
> will be treated as displayed equations within the table environment?

(Untested): \framed[align=normal,width=fit]{\startformula 
\startmathalignment ... \stopmathalignment \stopformula}

math alignment is a display math environment, and must be inside a 
\startformula ... \stopformula.

Two comments:

1. You know about \definemathalignment, right?
2. I think that this effect can be obtained more easily using

\startitemize[two,columns,a]
   \item ...
   \item ..
\stopitemize

but you might need to insert a negative \vskip (or \blank) to get matrix 
to align with the item symbol.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: mathalignment within a table - help needed!
  2011-05-14  1:23 ` Aditya Mahajan
@ 2011-05-14  1:57   ` Alasdair McAndrew
  2011-05-14  2:03     ` Aditya Mahajan
  2011-05-14 10:28   ` Hans Hagen
  1 sibling, 1 reply; 5+ messages in thread
From: Alasdair McAndrew @ 2011-05-14  1:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2689 bytes --]

Thanks, the framed bit is fine, except that the base of the frame is aligned
with the exercise number "(a)", whereas I'd like the top line of the
equations aligned with the (a)...

I'll keep fiddling.  This is one of those occasions which makes the
conversion from LaTeX to ConTeXt tricky for a beginner!

Thanks again,
Alasdair

On Sat, May 14, 2011 at 11:23 AM, Aditya Mahajan <adityam@umich.edu> wrote:

> On Sat, 14 May 2011, Alasdair McAndrew wrote:
>
>  Hello,
>>
>> I'm trying to typeset some linear algebra exercises for my students; the
>> exercises will be within a table, and each second element will be a system
>> of linear equations.  This sort of thing:
>>
>> \starttable[|l|M|l|M|]
>> \NC (a) \NC %
>>
>>
>> \startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
>>     \NC 3x\NC +\NC 6y\NC -\NC 2z\NC =\NC -13\NR
>>     \NC -6x\NC -\NC 9y\NC +\NC 5z\NC =\NC 22\NR
>>     \NC 3x\NC +\NC 3y\NC -\NC 5z\NC =\NC -13\NR
>>   \stopmathalignment
>> \NC (b) \NC %
>>
>>
>> \startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
>> \NC x\NC +\NC 3y\NC +\NC 3z\NC =\NC -4\NR
>> \NC x\NC +\NC 4y\NC +\NC 5z\NC =\NC -5\NR
>> \NC 2x\NC +\NC 4y\NC +\NC 3z\NC =\NC -5\NR
>> \stopmathalignment
>> \NC\AR
>> \stoptable
>>
>> But this doesn't work.  There seems to be a problem with the mathalignment
>> environment within the table.  What do I need enclose these in so that
>> they
>> will be treated as displayed equations within the table environment?
>>
>
> (Untested): \framed[align=normal,width=fit]{\startformula
> \startmathalignment ... \stopmathalignment \stopformula}
>
> math alignment is a display math environment, and must be inside a
> \startformula ... \stopformula.
>
> Two comments:
>
> 1. You know about \definemathalignment, right?
> 2. I think that this effect can be obtained more easily using
>
> \startitemize[two,columns,a]
>  \item ...
>  \item ..
> \stopitemize
>
> but you might need to insert a negative \vskip (or \blank) to get matrix to
> align with the item symbol.
>
> Aditya
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>



-- 
Blog: http://amca01.wordpress.com
Web:  http://bit.ly/Alasdair
Facebook: http://www.facebook.com/alasdair.mcandrew

[-- Attachment #1.2: Type: text/html, Size: 3825 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: mathalignment within a table - help needed!
  2011-05-14  1:57   ` Alasdair McAndrew
@ 2011-05-14  2:03     ` Aditya Mahajan
  0 siblings, 0 replies; 5+ messages in thread
From: Aditya Mahajan @ 2011-05-14  2:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 14 May 2011, Alasdair McAndrew wrote:

> Thanks, the framed bit is fine, except that the base of the frame is aligned
> with the exercise number "(a)", whereas I'd like the top line of the
> equations aligned with the (a)...

Play around with:

\framed[location=high|top|low|bottom|lohi|middle]

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: mathalignment within a table - help needed!
  2011-05-14  1:23 ` Aditya Mahajan
  2011-05-14  1:57   ` Alasdair McAndrew
@ 2011-05-14 10:28   ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2011-05-14 10:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

Hi Aditya

see attached file ... when we upgrade the alignment code we need to look 
into this as well (wraping in startformula works ok but has too much 
spacing, but we can handle that)

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

[-- Attachment #2: alignment-001.tex --]
[-- Type: text/x-tex, Size: 745 bytes --]

\starttext

\bTABLE
    \bTR
        \bTD a \eTD
        \bTD
            \startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
            \NC  3x\NC +\NC 6y\NC -\NC 2z\NC =\NC -13\NR
            \NC -6x\NC -\NC 9y\NC +\NC 5z\NC =\NC  22\NR
            \NC  3x\NC +\NC 3y\NC -\NC 5z\NC =\NC -13\NR
            \stopmathalignment
        \eTD
    \eTR
    \bTR
        \bTD b \eTD
        \bTD
            \startmathalignment[n=7,align={right,middle,right,middle,right,middle,right}]
            \NC  x\NC +\NC 3y\NC +\NC 3z\NC =\NC -4\NR
            \NC  x\NC +\NC 4y\NC +\NC 5z\NC =\NC -5\NR
            \NC 2x\NC +\NC 4y\NC +\NC 3z\NC =\NC -5\NR
            \stopmathalignment
        \eTD
    \eTR
\eTABLE

\stoptext

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2011-05-14 10:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-14  1:17 mathalignment within a table - help needed! Alasdair McAndrew
2011-05-14  1:23 ` Aditya Mahajan
2011-05-14  1:57   ` Alasdair McAndrew
2011-05-14  2:03     ` Aditya Mahajan
2011-05-14 10:28   ` 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).