ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Table cell spanning multiple columns in tabulate
@ 2013-07-15 14:39 Thomas Friedrich
  2013-07-15 14:49 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Friedrich @ 2013-07-15 14:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello ConTeXt users,

I am switching from texexec to context, and from table to tabulate.
Question: What is the equivalent for \use{2}\ReFormat[c]{text} in the
\table environment, when you what to do the same in the \tabulate
environment? I couldn't find the answer in the contextgarden.

Thank you for your help.

Please have a look at the following code.

~~~ snip ~~~
\enableregime[utf-8]

\starttext
\placetable[here][tab:tabulate]{Data of $13$ clinical trials
evaluating the efficacy of the Bacillus Calmette-Guérin
vaccine.}{\tfxx

\starttabulatehead
\FL
\NC Trial \NC Author \NC Year \NC Vaccinated\NC\NC Non
vaccinated\NC\NC Absolute \FR
\NC\NC\NC\NC Disease \NC No disease \NC  Disease \NC No disease \NC Latitude \LR
\HL
\stoptabulatehead

\starttabulate[|r|l|r|r|r|r|r|r|]
\HL
\NC A \NC Aronson              \NC 1948 \NC   4 \NC 119   \NC  11 \NC
128   \NC 44 \FR
\NC B \NC Ferguson \& Simes    \NC 1949 \NC   6 \NC 300   \NC  29 \NC
274   \NC 55 \MR
\NC C \NC Rosenthal et al      \NC 1960 \NC   3 \NC 228   \NC  11 \NC
209   \NC 42 \MR
\NC D \NC Hart \& Sutherland   \NC 1977 \NC  62 \NC 13536 \NC 248 \NC
12619 \NC 52 \MR
\NC E \NC Frimodt-Moller et al \NC 1973 \NC  33 \NC 5036  \NC  47 \NC
5761  \NC 13 \MR
\NC F \NC Stein \& Aronson     \NC 1953 \NC 180 \NC 1361  \NC 372 \NC
1079  \NC 44 \MR
\NC G \NC Vandiviere et al     \NC 1973 \NC   8 \NC 2537  \NC  10 \NC
619   \NC 19 \MR
\NC H \NC TPT Madras           \NC 1980 \NC 505 \NC 87886 \NC 499 \NC
87892 \NC 13 \MR
\NC I \NC Coetzee \& Berjak    \NC 1968 \NC  29 \NC 7470  \NC  45 \NC
7232  \NC 27 \MR
\NC J \NC Rosenthal et al      \NC 1961 \NC  17 \NC 1699  \NC  65 \NC
1600  \NC 42 \MR
\NC K \NC Comstock et al       \NC 1974 \NC 186 \NC 50448 \NC 141 \NC
27197 \NC 18 \MR
\NC L \NC Comstock \& Webster  \NC 1969 \NC   5 \NC 2493  \NC   3 \NC
2338  \NC 33 \MR
\NC M \NC Comstock et al       \NC 1976 \NC  27 \NC 16886 \NC  29 \NC
17825 \NC 33 \LR
\LL
\stoptabulate}

\placetable [here] [tab:table] {Data of $13$ clinical trials
evaluating the efficacy of the Bacillus Calmette-Guérin vaccine.}
{\tfxx
\starttable[|r|l|r|r|r|r|r|r|]
\HL
\NC Trial \NC Author \NC Year \NC \use{2}\ReFormat[c]{Vaccinated} \NC
\use{2}\ReFormat[c]{Non vaccinated} \NC Absolute \FR
\NC \NC  \NC  \NC Disease \NC No disease  \NC  Disease \NC No disease
\NC Latitude \LR
\HL
\NC A \NC Aronson              \NC 1948 \NC   4 \NC 119   \NC  11 \NC
128   \NC 44 \FR
\NC B \NC Ferguson \& Simes    \NC 1949 \NC   6 \NC 300   \NC  29 \NC
274   \NC 55 \MR
\NC C \NC Rosenthal et al      \NC 1960 \NC   3 \NC 228   \NC  11 \NC
209   \NC 42 \MR
\NC D \NC Hart \& Sutherland   \NC 1977 \NC  62 \NC 13536 \NC 248 \NC
12619 \NC 52 \MR
\NC E \NC Frimodt-Moller et al \NC 1973 \NC  33 \NC 5036  \NC  47 \NC
5761  \NC 13 \MR
\NC F \NC Stein \& Aronson     \NC 1953 \NC 180 \NC 1361  \NC 372 \NC
1079  \NC 44 \MR
\NC G \NC Vandiviere et al     \NC 1973 \NC   8 \NC 2537  \NC  10 \NC
619   \NC 19 \MR
\NC H \NC TPT Madras           \NC 1980 \NC 505 \NC 87886 \NC 499 \NC
87892 \NC 13 \MR
\NC I \NC Coetzee \& Berjak    \NC 1968 \NC  29 \NC 7470  \NC  45 \NC
7232  \NC 27 \MR
\NC J \NC Rosenthal et al      \NC 1961 \NC  17 \NC 1699  \NC  65 \NC
1600  \NC 42 \MR
\NC K \NC Comstock et al       \NC 1974 \NC 186 \NC 50448 \NC 141 \NC
27197 \NC 18 \MR
\NC L \NC Comstock \& Webster  \NC 1969 \NC   5 \NC 2493  \NC   3 \NC
2338  \NC 33 \MR
\NC M \NC Comstock et al       \NC 1976 \NC  27 \NC 16886 \NC  29 \NC
17825 \NC 33 \LR
\HL
\stoptable}
\stoptext
~~~ snip ~~~

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

* Re: Table cell spanning multiple columns in tabulate
  2013-07-15 14:39 Table cell spanning multiple columns in tabulate Thomas Friedrich
@ 2013-07-15 14:49 ` Wolfgang Schuster
  2013-07-16  1:50   ` Sietse Brouwer
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2013-07-15 14:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 15.07.2013 um 16:39 schrieb Thomas Friedrich <friedrich@statistik.tu-dortmund.de>:

> Hello ConTeXt users,
> 
> I am switching from texexec to context, and from table to tabulate.
> Question: What is the equivalent for \use{2}\ReFormat[c]{text} in the
> \table environment, when you what to do the same in the \tabulate
> environment? I couldn't find the answer in the context garden.

The tabulate environment has no support for spanned cells.

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

* Re: Table cell spanning multiple columns in tabulate
  2013-07-15 14:49 ` Wolfgang Schuster
@ 2013-07-16  1:50   ` Sietse Brouwer
  2013-07-16 13:15     ` Thomas Friedrich
  0 siblings, 1 reply; 4+ messages in thread
From: Sietse Brouwer @ 2013-07-16  1:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thomas Friedrich wrote:
>> I am switching from texexec to context, and from table to tabulate.
>> Question: What is the equivalent for \use{2}\ReFormat[c]{text} in the
>> \table environment, when you what to do the same in the \tabulate
>> environment? I couldn't find the answer in the context garden.

Wolfgang Schuster wrote:
> The tabulate environment has no support for spanned cells.

The TABLE mechanism does, though, and that is probably the mkiv
standard for writing non-trivial tables. It's a bit more verbose, but
it can do an enormous number of things -- including many things that
the tabulate mechanism can't. Wiki link:
http://wiki.contextgarden.net/TABLE

The equivalent of \use{2}\ReFormat[c]{text} would be this (rest of
table code added to make this example self-contained and compilable):

\bTABLE
  \bTR
    \bTD[nc=2, align=center] text \eTD
  \eTR
  \bTR
    \bTD apples \eTD
    \bTD oranges \eTD
  \eTR
\eTABLE

Hope this help!
Cheers,
Sietse

On 15 July 2013 16:49, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
>
> Am 15.07.2013 um 16:39 schrieb Thomas Friedrich <friedrich@statistik.tu-dortmund.de>:
>
>> Hello ConTeXt users,
>>
>> I am switching from texexec to context, and from table to tabulate.
>> Question: What is the equivalent for \use{2}\ReFormat[c]{text} in the
>> \table environment, when you what to do the same in the \tabulate
>> environment? I couldn't find the answer in the context garden.
>
> The tabulate environment has no support for spanned cells.
>
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Table cell spanning multiple columns in tabulate
  2013-07-16  1:50   ` Sietse Brouwer
@ 2013-07-16 13:15     ` Thomas Friedrich
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Friedrich @ 2013-07-16 13:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2013/7/16 Sietse Brouwer <sbbrouwer@gmail.com>:
> Thomas Friedrich wrote:
>>> I am switching from texexec to context, and from table to tabulate.
>>> Question: What is the equivalent for \use{2}\ReFormat[c]{text} in the
>>> \table environment, when you what to do the same in the \tabulate
>>> environment? I couldn't find the answer in the context garden.
>
> Wolfgang Schuster wrote:
>> The tabulate environment has no support for spanned cells.
>
> The TABLE mechanism does, though, and that is probably the mkiv
> standard for writing non-trivial tables. It's a bit more verbose, but
> it can do an enormous number of things -- including many things that
> the tabulate mechanism can't. Wiki link:
> http://wiki.contextgarden.net/TABLE
>
> The equivalent of \use{2}\ReFormat[c]{text} would be this (rest of
> table code added to make this example self-contained and compilable):
>
> \bTABLE
>   \bTR
>     \bTD[nc=2, align=center] text \eTD
>   \eTR
>   \bTR
>     \bTD apples \eTD
>     \bTD oranges \eTD
>   \eTR
> \eTABLE
>
> Hope this help!
> Cheers,
> Sietse

Thanks for pointing this out, and I did indeed rewrite the code, so it
would work with the TABLE mechanism. It's a bit like breaking a
butterfly with a wheel. Please have a look at the following code, as I
think I may have found bug in the TABLE mechanism.

The following code does exactly what I want but it has a pretty bad
hack on line 7, where I reference all columns by
[1,2,3,4,5,6,7,8][1,2,3] rather than using the [r][1,2,3], since the
latter does not work as expected.  It seems that statements concerning
columns take precedence before statements that concern rows.  In the
example below, \setupTABLE[c][1,2,3][align=right] overwrites
\setupTABLE[r][1,2][align=center] --- no matter where you put the
latter (before or after the former statement). At least for me, this
is rather unintuitive.

~~~ snip ~~~
\enableregime[utf-8]
\starttext
\placetable[here][tab:bcg-study-data]{The table shows results}{%

\bTABLE
\setupTABLE[r][each][align=left]
\setupTABLE[1,2,3,4,5,6,7,8][1,2][align=center]
%%% The following should be equivalest to the line above:
%\setupTABLE[r][1,2][align=center]

\setupTABLE[c][1,2,3][align=right]
\setupTABLE[c][4,5,6,7][width=17mm]
\setupTABLE[r][2][height=\lineheight]

\setupTABLE[frame=off]
\setupTABLE[4,5,6,7][2][bottomframe=on]
\setupTABLE[r][first][topframe=on]
\setupTABLE[r][last][bottomframe=on]
\setupTABLE[r][4][topframe=on]

\bTABLEhead
\bTR
  \bTD[nr=3] Trial \eTD
  \bTD[nr=3] Author \eTD
  \bTD[nr=3] Year \eTD
  \bTD[nc=4] Infected when\eTD
  \bTD[nr=3] {Absolute\\ latitute}\eTD
\eTR
\bTR
  \bTD[nc=2] vaccinated \eTD
  \bTD[nc=2] not vaccinated \eTD
\eTR
\bTR
  \bTD yes \eTD
  \bTD no \eTD
  \bTD yes \eTD
  \bTD no \eTD
\eTR
\eTABLEhead
\bTABLEbody
\bTR\bTD A \eTD\bTD Aronson   \eTD\bTD 1948 \eTD\bTD 4 \eTD\bTD 119
\eTD\bTD 11 \eTD\bTD 128  \eTD\bTD 44 \eTD\eTR
\bTR\bTD B \eTD\bTD Ferguson  \eTD\bTD 1949 \eTD\bTD 6 \eTD\bTD 300
\eTD\bTD 129 \eTD\bTD 274 \eTD\bTD 55 \eTD\eTR
\bTR\bTD C \eTD\bTD Rosenthal \eTD\bTD 1960 \eTD\bTD 3 \eTD\bTD 228
\eTD\bTD 11 \eTD\bTD 2090 \eTD\bTD 442 \eTD\eTR
\bTR\bTD D \eTD\bTD Hart \eTD\bTD 1977 \eTD\bTD 656 \eTD\bTD 13536
\eTD\bTD 248 \eTD\bTD 12619 \eTD\bTD 52 \eTD\eTR
\eTABLEbody
\eTABLE}
\stoptext
~~~ snip ~~~


Is this a bug? Is this a feature?

Thanks.

Thomas








> On 15 July 2013 16:49, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
>>
>> Am 15.07.2013 um 16:39 schrieb Thomas Friedrich <friedrich@statistik.tu-dortmund.de>:
>>
>>> Hello ConTeXt users,
>>>
>>> I am switching from texexec to context, and from table to tabulate.
>>> Question: What is the equivalent for \use{2}\ReFormat[c]{text} in the
>>> \table environment, when you what to do the same in the \tabulate
>>> environment? I couldn't find the answer in the context garden.
>>
>> The tabulate environment has no support for spanned cells.
>>
>> 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
>> ___________________________________________________________________________________
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________



-- 
Thomas Friedrich
Fakultät Statistik
Technische Universität Dortmund
44221 Dortmund
Telefon: 0231 755 - 3116
FAX: 0231 755 - 5304
E-Mail: friedrich@statistik.tu-dortmund.de
___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2013-07-16 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15 14:39 Table cell spanning multiple columns in tabulate Thomas Friedrich
2013-07-15 14:49 ` Wolfgang Schuster
2013-07-16  1:50   ` Sietse Brouwer
2013-07-16 13:15     ` Thomas Friedrich

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