ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Multiplication table (with lines) in ConTeXt?
@ 2011-05-04  4:36 Alasdair McAndrew
  2011-05-04  4:45 ` Aditya Mahajan
  0 siblings, 1 reply; 10+ messages in thread
From: Alasdair McAndrew @ 2011-05-04  4:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I want to typeset a multiplication table, where there will be a horizontal
line after the first row, and a vertical line after the first column.  In
LaTeX, I can use:

\[
\begin{array}{c|ccccccc}
  \times&0&1&2&3&4&5&6\\
  \hline
  0&0&0&0&0&0&0&0\\
  1&0&1&2&3&4&5&6\\
  2&0&2&4&6&1&3&5\\
  3&0&3&6&2&5&1&4\\
  4&0&4&1&5&2&6&3\\
  5&0&5&3&1&6&4&2\\
  6&0&6&5&4&3&2&1
\end{array}
\]

What is the canonical way of including lines in a mathematical array in
ConTeXt?

Thanks,
Alasdair

[-- Attachment #1.2: Type: text/html, Size: 1860 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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04  4:36 Multiplication table (with lines) in ConTeXt? Alasdair McAndrew
@ 2011-05-04  4:45 ` Aditya Mahajan
  2011-05-04  7:05   ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2011-05-04  4:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 4 May 2011, Alasdair McAndrew wrote:

> I want to typeset a multiplication table, where there will be a horizontal
> line after the first row, and a vertical line after the first column.  In
> LaTeX, I can use:
>
> \[
> \begin{array}{c|ccccccc}
>  \times&0&1&2&3&4&5&6\\
>  \hline
>  0&0&0&0&0&0&0&0\\
>  1&0&1&2&3&4&5&6\\
>  2&0&2&4&6&1&3&5\\
>  3&0&3&6&2&5&1&4\\
>  4&0&4&1&5&2&6&3\\
>  5&0&5&3&1&6&4&2\\
>  6&0&6&5&4&3&2&1
> \end{array}
> \]
>
> What is the canonical way of including lines in a mathematical array in
> ConTeXt?

\startsetups table:frame
\setupTABLE[each][each][frame=off, align=middle]
\setupTABLE[row][first][bottomframe=on]
\setupTABLE[column][first][rightframe=on]
\stopsetups

\startTABLE[setups=table:frame]
  \NC $\times$ \NC 1 \NC 2 \NC ... \NC \NR
  ....
\stopTABLE

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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04  4:45 ` Aditya Mahajan
@ 2011-05-04  7:05   ` Wolfgang Schuster
  2011-05-04 10:10     ` Alasdair McAndrew
  2011-05-04 10:43     ` Paul Menzel
  0 siblings, 2 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2011-05-04  7:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 04.05.2011 um 06:45 schrieb Aditya Mahajan:

> \startsetups table:frame
> \setupTABLE[each][each][frame=off, align=middle]
> \setupTABLE[row][first][bottomframe=on]
> \setupTABLE[column][first][rightframe=on]
> \stopsetups
> 
> \startTABLE[setups=table:frame]
> \NC $\times$ \NC 1 \NC 2 \NC ... \NC \NR
> ....
> \stopTABLE

and for the lazy people:

\starttext

\startsetups table:multiplication
  \setupTABLE[each][each][frame=off,align=middle,width=2em,height=2em]
  \setupTABLE[row][first][bottomframe=on]
  \setupTABLE[column][first][rightframe=on]
\stopsetups

\startluacode
context.bTABLE{setups="table:multiplication"}
for i=0,6 do
	context.bTR()
	for j=0,6 do
		context.bTD()
		if i==0 and j==0 then
			context("×")
		elseif i==0 or j==0 then
			context(i+j)
		else
			context(i*j)
		end
		context.eTD()
	end
	context.eTR()
end
context.eTABLE()
\stopluacode

\stoptext

Wolfgang

___________________________________________________________________________________
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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04  7:05   ` Wolfgang Schuster
@ 2011-05-04 10:10     ` Alasdair McAndrew
  2011-05-04 10:32       ` Paul Menzel
  2011-05-04 10:52       ` Wolfgang Schuster
  2011-05-04 10:43     ` Paul Menzel
  1 sibling, 2 replies; 10+ messages in thread
From: Alasdair McAndrew @ 2011-05-04 10:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

 It looks like it should work, but when I try it I get a very squashed
table, with lines between all rows and columns...  FWIW, I'm using MKII:

"ConTeXt  ver: 2011.02.25 22:03 MKII  fmt: 2011.3.14  int: english/english"

-Alasdair

On Wed, May 4, 2011 at 5:05 PM, Wolfgang Schuster <
schuster.wolfgang@googlemail.com> wrote:

>
> Am 04.05.2011 um 06:45 schrieb Aditya Mahajan:
>
> > \startsetups table:frame
> > \setupTABLE[each][each][frame=off, align=middle]
> > \setupTABLE[row][first][bottomframe=on]
> > \setupTABLE[column][first][rightframe=on]
> > \stopsetups
> >
> > \startTABLE[setups=table:frame]
> > \NC $\times$ \NC 1 \NC 2 \NC ... \NC \NR
> > ....
> > \stopTABLE
>
> and for the lazy people:
>
> \starttext
>
> \startsetups table:multiplication
>  \setupTABLE[each][each][frame=off,align=middle,width=2em,height=2em]
>   \setupTABLE[row][first][bottomframe=on]
>  \setupTABLE[column][first][rightframe=on]
> \stopsetups
>
> \startluacode
> context.bTABLE{setups="table:multiplication"}
> for i=0,6 do
>        context.bTR()
>        for j=0,6 do
>                context.bTD()
>                if i==0 and j==0 then
>                        context("×")
>                elseif i==0 or j==0 then
>                        context(i+j)
>                else
>                        context(i*j)
>                end
>                context.eTD()
>        end
>        context.eTR()
> end
> context.eTABLE()
> \stopluacode
>
> \stoptext
>
> Wolfgang
>
>
> ___________________________________________________________________________________
> 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: 3270 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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04 10:10     ` Alasdair McAndrew
@ 2011-05-04 10:32       ` Paul Menzel
  2011-05-04 10:52       ` Wolfgang Schuster
  1 sibling, 0 replies; 10+ messages in thread
From: Paul Menzel @ 2011-05-04 10:32 UTC (permalink / raw)
  To: ntg-context


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

Am Mittwoch, den 04.05.2011, 20:10 +1000 schrieb Alasdair McAndrew:
> It looks like it should work, but when I try it I get a very squashed
> table, with lines between all rows and columns...  FWIW, I'm using MKII:
> 
> "ConTeXt  ver: 2011.02.25 22:03 MKII  fmt: 2011.3.14  int: english/english"

It works perfectly using MK IV.

        ConTeXt  ver: 2011.04.30 17:02 MKIV  fmt: 2011.5.1  int: english/english


Thanks,

Paul


PS: Please do not top post or at least remove the unneeded full quote.

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04  7:05   ` Wolfgang Schuster
  2011-05-04 10:10     ` Alasdair McAndrew
@ 2011-05-04 10:43     ` Paul Menzel
  2011-05-04 10:49       ` Alasdair McAndrew
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Menzel @ 2011-05-04 10:43 UTC (permalink / raw)
  To: ntg-context


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

Am Mittwoch, den 04.05.2011, 09:05 +0200 schrieb Wolfgang Schuster:
> Am 04.05.2011 um 06:45 schrieb Aditya Mahajan:
> 
> > \startsetups table:frame
> > \setupTABLE[each][each][frame=off, align=middle]
> > \setupTABLE[row][first][bottomframe=on]
> > \setupTABLE[column][first][rightframe=on]
> > \stopsetups
> > 
> > \startTABLE[setups=table:frame]
> > \NC $\times$ \NC 1 \NC 2 \NC ... \NC \NR
> > ....
> > \stopTABLE
> 
> and for the lazy people:
> 
> \starttext
> 
> \startsetups table:multiplication
>   \setupTABLE[each][each][frame=off,align=middle,width=2em,height=2em]
>   \setupTABLE[row][first][bottomframe=on]
>   \setupTABLE[column][first][rightframe=on]
> \stopsetups
> 
> \startluacode
> context.bTABLE{setups="table:multiplication"}
> for i=0,6 do
> 	context.bTR()
> 	for j=0,6 do
> 		context.bTD()
> 		if i==0 and j==0 then
> 			context("×")
> 		elseif i==0 or j==0 then
> 			context(i+j)
> 		else
> 			context(i*j)

Alasdair takes modula 7 if I understood correctly. So it can be

if i*j < 7 then
	context(i*j)
else
	context((i*j) % 7)
end

(Nice symmetry in the resulting table.)

> 		end
> 		context.eTD()
> 	end
> 	context.eTR()
> end
> context.eTABLE()
> \stopluacode
> 
> \stoptext

Thank you Wolfang, I just wanted to reply and recommend using Lua. As
always you were too fast. ;-)


Thanks,

Paul

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04 10:43     ` Paul Menzel
@ 2011-05-04 10:49       ` Alasdair McAndrew
  2011-05-04 10:57         ` Wolfgang Schuster
  2011-05-04 11:10         ` Paul Menzel
  0 siblings, 2 replies; 10+ messages in thread
From: Alasdair McAndrew @ 2011-05-04 10:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I gave the mod 7 table as an example; what I in fact want to display is the
Cayley table for the dihedral group D_4.

By the way - how do I upgrade to Mk IV?  I just downloaded the installer for
ConTeXt Minimals and let it do its thing.

This is getting very complicated...

-Alasdair

On Wed, May 4, 2011 at 8:43 PM, Paul Menzel <
paulepanter@users.sourceforge.net> wrote:

> Am Mittwoch, den 04.05.2011, 09:05 +0200 schrieb Wolfgang Schuster:
> > Am 04.05.2011 um 06:45 schrieb Aditya Mahajan:
> >
> > > \startsetups table:frame
> > > \setupTABLE[each][each][frame=off, align=middle]
> > > \setupTABLE[row][first][bottomframe=on]
> > > \setupTABLE[column][first][rightframe=on]
> > > \stopsetups
> > >
> > > \startTABLE[setups=table:frame]
> > > \NC $\times$ \NC 1 \NC 2 \NC ... \NC \NR
> > > ....
> > > \stopTABLE
> >
> > and for the lazy people:
> >
> > \starttext
> >
> > \startsetups table:multiplication
> >   \setupTABLE[each][each][frame=off,align=middle,width=2em,height=2em]
> >   \setupTABLE[row][first][bottomframe=on]
> >   \setupTABLE[column][first][rightframe=on]
> > \stopsetups
> >
> > \startluacode
> > context.bTABLE{setups="table:multiplication"}
> > for i=0,6 do
> >       context.bTR()
> >       for j=0,6 do
> >               context.bTD()
> >               if i==0 and j==0 then
> >                       context("×")
> >               elseif i==0 or j==0 then
> >                       context(i+j)
> >               else
> >                       context(i*j)
>
> Alasdair takes modula 7 if I understood correctly. So it can be
>
> if i*j < 7 then
>        context(i*j)
> else
>        context((i*j) % 7)
> end
>
> (Nice symmetry in the resulting table.)
>
> >               end
> >               context.eTD()
> >       end
> >       context.eTR()
> > end
> > context.eTABLE()
> > \stopluacode
> >
> > \stoptext
>
> Thank you Wolfang, I just wanted to reply and recommend using Lua. As
> always you were too fast. ;-)
>
>
> Thanks,
>
> Paul
>
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3627 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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04 10:10     ` Alasdair McAndrew
  2011-05-04 10:32       ` Paul Menzel
@ 2011-05-04 10:52       ` Wolfgang Schuster
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2011-05-04 10:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 04.05.2011 um 12:10 schrieb Alasdair McAndrew:

>  It looks like it should work, but when I try it I get a very squashed table, with lines between all rows and columns...  FWIW, I'm using MKII: 

To separate the content and style of a table Hans added a “setups” key to \bTABLE/\startTABLE in MkIV but as you use MkII this setting has no effect. You can apply the style to the table with the \setups command:

% engine=pdftex

\startsetups table:multiplication
  \setupTABLE[each][each][frame=off,align=middle,width=2em,height=2em]
  \setupTABLE[row][first][bottomframe=on]
  \setupTABLE[column][first][rightframe=on]
\stopsetups

\starttext

\start\setups[table:multiplication]
\startTABLE
\NC $\times$ \NC 0 \NC 1 \NC 2 \NC 3 \NC 4 \NC 5 \NC 6 \NC\NR
\NC        0 \NC 0 \NC 0 \NC 0 \NC 0 \NC 0 \NC 0 \NC 0 \NC\NR
\NC        1 \NC 0 \NC 1 \NC 2 \NC 3 \NC 4 \NC 5 \NC 6 \NC\NR
\NC        2 \NC 0 \NC 2 \NC 4 \NC 6 \NC 1 \NC 3 \NC 5 \NC\NR
\NC        3 \NC 0 \NC 3 \NC 6 \NC 2 \NC 5 \NC 1 \NC 4 \NC\NR
\NC        4 \NC 0 \NC 4 \NC 1 \NC 5 \NC 2 \NC 6 \NC 3 \NC\NR
\NC        5 \NC 0 \NC 5 \NC 3 \NC 1 \NC 6 \NC 4 \NC 2 \NC\NR
\NC        6 \NC 0 \NC 6 \NC 5 \NC 4 \NC 3 \NC 2 \NC 1 \NC\NR
\stopTABLE
\stop

\stoptext

Wolfgang

___________________________________________________________________________________
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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04 10:49       ` Alasdair McAndrew
@ 2011-05-04 10:57         ` Wolfgang Schuster
  2011-05-04 11:10         ` Paul Menzel
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2011-05-04 10:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 04.05.2011 um 12:49 schrieb Alasdair McAndrew:

> I gave the mod 7 table as an example; what I in fact want to display is the Cayley table for the dihedral group D_4.
> 
> By the way - how do I upgrade to Mk IV?  I just downloaded the installer for ConTeXt Minimals and let it do its thing.

Compile your document with “context <filename>” instead of “texexec <filename>”.

Wolfgang

___________________________________________________________________________________
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] 10+ messages in thread

* Re: Multiplication table (with lines) in ConTeXt?
  2011-05-04 10:49       ` Alasdair McAndrew
  2011-05-04 10:57         ` Wolfgang Schuster
@ 2011-05-04 11:10         ` Paul Menzel
  1 sibling, 0 replies; 10+ messages in thread
From: Paul Menzel @ 2011-05-04 11:10 UTC (permalink / raw)
  To: ntg-context


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

Dear Alasdair,


please adhere to the posting style the people helping you use [1].
Please use the interleaved style [2].


Am Mittwoch, den 04.05.2011, 20:49 +1000 schrieb Alasdair McAndrew:
> I gave the mod 7 table as an example; what I in fact want to display is the
> Cayley table for the dihedral group D_4.

Interesting. When you have that finished, it would be great if you could
share your TeX file.

> By the way - how do I upgrade to Mk IV?  I just downloaded the installer for
> ConTeXt Minimals and let it do its thing.
> 
> This is getting very complicated...

Please open a new thread about that topic. Do not forget to include
useful information like what operating system you use.


Thanks,

Paul


[1] http://en.opensuse.org/openSUSE:Mailing_list_netiquette
[2] https://secure.wikimedia.org/wikipedia/en/wiki/Posting_style#Interleaved_style

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 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] 10+ messages in thread

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04  4:36 Multiplication table (with lines) in ConTeXt? Alasdair McAndrew
2011-05-04  4:45 ` Aditya Mahajan
2011-05-04  7:05   ` Wolfgang Schuster
2011-05-04 10:10     ` Alasdair McAndrew
2011-05-04 10:32       ` Paul Menzel
2011-05-04 10:52       ` Wolfgang Schuster
2011-05-04 10:43     ` Paul Menzel
2011-05-04 10:49       ` Alasdair McAndrew
2011-05-04 10:57         ` Wolfgang Schuster
2011-05-04 11:10         ` Paul Menzel

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