At 18:53 07.07.2001 +0300, Tarik Kara wrote:
>It's me again. As you might have guessed I am trying to switch to ConTeXt.
>To start with I want to convert one of my old (LaTeX) document into
>ConTeXt. Although the documentation is extensive I can't seem to find what
>I need. By new guestion is:
>
>A have tables (a game matrix) like the one given in the attachment. What
>is the best way to construct a table like the one in the attachment: The
>label "Player 2" should be centered among the last 2 columns (the
>\TWO\JustCenter{Player 2} did not do a good job), The label "Player 1"
>should be centered among the last two rows (using the command \LOW{Player
>1} in the first row seems to be working ok). The dimension of the
>table does not have to be 2x2, but if you can show how to do it for 2x2 I
>believe I can extended to nxm.
>
>Also is there a way to get the number pairs alined by the comman.
I'm just switching from LaTeX, too, so don't expect too much from me. But I
think that
\starttable[|l|c|c|c|]
\NC \NC \NC\TWO{Agent 2} \NC\SR
\NC \NC \NC C \NC D \NC\SR
\DC \DC \DL[2] \DR
\NC \LOW{Agent 1} \NC C \VL $(-5,-5)$ \VL $(-1,-10)$ \VL\SR
\DC \DC \DL[2] \DR
\NC \NC D \VL $(-10,-1)$ \VL $(-2,-2)$ \VL\SR
\DC \DC \DL[2] \DR
\stoptable
solves your problem. A possibility for the alignment at the comma may be
\starttable[|l|c|r s0|l s3 |r s0 |l s3|]
\NC \NC \NC\FOUR\JustCenter{Agent
2} \NC\SR
\NC \NC \NC\TWO\JustCenter{C} \NC
\TWO\JustCenter{D} \NC\SR
\DC \DC \DL[4] \DR
\NC \LOW{Agent 1} \NC C \VL $(-5$ \NC $,-5)$ \VL $(-1$ \NC
$,-10)$ \VL\SR
\DC \DC \DL[4] \DR
\NC \NC D \VL $(-10$ \NC $,-1)$ \VL $(-2$ \NC
$,-2)$ \VL\SR
\DC \DC \DL[4] \DR
\stoptable
This is something like r@{,}l in LaTeX... At least it works. I put the
comma in the second column to get correct spacing. Maybe Hans or another
more experienced contexter knows a better solution to the alignment
problem. With natural tables, there is an alignment character, but I don't
know if this is the case with table and tabulate, too. And I'm not sure if
it could actually work in this case, since you don't simply want to type a
number with a decimal comma, but a pair of numbers in math mode, separated
by a comma.
The vertical alignment of 'Agent 1' is not perfect, though. Time for a
question: Is there a possibility to span an arbitrary number of rows and
align some text vertically centered in the resulting space? (ny=3 like in
natural tables, with additional centering?) The multirow package does this
for latex (quite well, except for very special cases).
Btw, there are some examples of tables in the beginners' manual which are
not (yet?) in the english beta reference manual, so you may want to have a
look at this.
I think tables are a topic where the context documentation (at least the
english one) ought to be extended, especially for newcomers and 'converts'
from latex. As soon as I am more experienced, and as soon as I have
finished my current work (diploma thesis), I would be willing make
contributions in this area (although the first precondition might take some
time...)
Eckhart