Hi there, I have s simple table like this: \starttext \starttable[|l|l|] \NC \bf Colheader 1 \NC \bf Colheader 2 \NC \SR \HL \NC cell 11 \NC cell 12 \NC \FR \NC cell 11 \NC cell 12 \NC \LR \stoptable \stoptext and like to have a light gray background for the heading row. I found documentation about \setupTABLE which on the one hand I did not fully understand how to use and on the other hand I'm not quite sure how far this is the way it is done nowadays. -- Thanks, Manfred
Am 11.11.2010 um 19:44 schrieb Manfred Lotz:
Hi there,
I have s simple table like this:
\starttext
\starttable[|l|l|] \NC \bf Colheader 1 \NC \bf Colheader 2 \NC \SR \HL \NC cell 11 \NC cell 12 \NC \FR \NC cell 11 \NC cell 12 \NC \LR \stoptable
\stoptext
and like to have a light gray background for the heading row.
I found documentation about \setupTABLE which on the one hand I did not fully understand how to use and on the other hand I'm not quite sure how far this is the way it is done nowadays.
The \setupTABLE command for the natural tables environment, you can find a overview of the different environments on the wiki. Here is a example for a natural table: \starttext \setupTABLE[header][style=bold,background=color,backgroundcolor=gray] \bTABLE \bTABLEhead \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead \bTABLEbody \bTR \bTD cell 11 \eTD \bTD cell 12 \eTD \eTR \bTR \bTD cell 21 \eTD \bTD cell 22 \eTD \eTR \eTABLEbody \eTABLE \stoptext Wolfgang
Hi Wolfgang,
On Thu, 11 Nov 2010 20:13:22 +0100
Wolfgang Schuster
Am 11.11.2010 um 19:44 schrieb Manfred Lotz:
Hi there,
I have s simple table like this:
\starttext
\starttable[|l|l|] \NC \bf Colheader 1 \NC \bf Colheader 2 \NC \SR \HL \NC cell 11 \NC cell 12 \NC \FR \NC cell 11 \NC cell 12 \NC \LR \stoptable
\stoptext
and like to have a light gray background for the heading row.
I found documentation about \setupTABLE which on the one hand I did not fully understand how to use and on the other hand I'm not quite sure how far this is the way it is done nowadays.
The \setupTABLE command for the natural tables environment, you can find a overview of the different environments on the wiki.
Here is a example for a natural table:
\starttext
\setupTABLE[header][style=bold,background=color,backgroundcolor=gray]
\bTABLE \bTABLEhead \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead \bTABLEbody \bTR \bTD cell 11 \eTD \bTD cell 12 \eTD \eTR \bTR \bTD cell 21 \eTD \bTD cell 22 \eTD \eTR \eTABLEbody \eTABLE
\stoptext
Thanks for your example which works fine but raises some more questions: 1. Your example creates borders around each cell which I don't want to have. Any way to get rid of them? 2. It seems to me that \setupTABLE creates a shading for the header for all tables in a document?! That is ok. However, I'd like to know what would be the variant to have it only for a single table? 3. How does this \bTABLE stuff compare to the \starttable stuff? Are these just different methods to create tables which are both in use these days in context or is one method to be preferred over the other? -- Thanks, Manfred
Am 11.11.2010 20:40, schrieb Manfred Lotz:
\starttext
\setupTABLE[header][style=bold,background=color,backgroundcolor=gray]
\bTABLE \bTABLEhead \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead \bTABLEbody \bTR \bTD cell 11 \eTD \bTD cell 12 \eTD \eTR \bTR \bTD cell 21 \eTD \bTD cell 22 \eTD \eTR \eTABLEbody \eTABLE
\stoptext
Thanks for your example which works fine but raises some more questions:
1. Your example creates borders around each cell which I don't want to have. Any way to get rid of them?
\bTABLE[frame=off] Herbert
Am 11.11.2010 um 20:40 schrieb Manfred Lotz:
Thanks for your example which works fine but raises some more questions:
1. Your example creates borders around each cell which I don't want to have. Any way to get rid of them?
You can disable the border rules with „frame=off“.
2. It seems to me that \setupTABLE creates a shading for the header for all tables in a document?! That is ok.
However, I'd like to know what would be the variant to have it only for a single table?
\startsetups table:mystyle \setupTABLE [frame=off] \setupTABLE[row][first][style=bold,background=color,backgroundcolor=gray] \stopsetups \bTABLE[setups=table:mystyle] \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \eTABLE or \bTABLE[frame=off] \bTR[background=color,backgroundcolor=gray] \bTH Colheader 1 \eTH \bTH Colheader 2 \eTH \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \eTABLE
3. How does this \bTABLE stuff compare to the \starttable stuff? Are these just different methods to create tables which are both in use these days in context or is one method to be preferred over the other?
Both are different method to write a table, \starttable/\stoptable is older than \bTABLE/\eTABLE which use \framed for each table cell and allows more fancy layouts but is slower than \starttable. Wolfgang
On Thu, 11 Nov 2010 20:58:24 +0100
Wolfgang Schuster
Am 11.11.2010 um 20:40 schrieb Manfred Lotz:
Thanks for your example which works fine but raises some more questions:
1. Your example creates borders around each cell which I don't want to have. Any way to get rid of them?
You can disable the border rules with „frame=off“.
Yep. Just found that I get back the first horizontal line by: \setupTABLE[row][first][bottomframe=on]
2. It seems to me that \setupTABLE creates a shading for the header for all tables in a document?! That is ok.
However, I'd like to know what would be the variant to have it only for a single table?
\startsetups table:mystyle
\setupTABLE [frame=off] \setupTABLE[row][first][style=bold,background=color,backgroundcolor=gray]
\stopsetups
\bTABLE[setups=table:mystyle] \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \eTABLE
or
\bTABLE[frame=off] \bTR[background=color,backgroundcolor=gray] \bTH Colheader 1 \eTH \bTH Colheader 2 \eTH \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \bTR \bTD cell 11 \eTD \bTD cell 11 \eTD \eTR \eTABLE
Great, good to know.
3. How does this \bTABLE stuff compare to the \starttable stuff? Are these just different methods to create tables which are both in use these days in context or is one method to be preferred over the other?
Both are different method to write a table, \starttable/\stoptable is older than \bTABLE/\eTABLE which use \framed for each table cell and allows more fancy layouts but is slower than \starttable.
Aaah, ok. Does it mean that \starttable/\stoptable is a simpler way of writing tables with less possiblities than the \bTABLE/\eTABLE stuff? Is also seemed to me that it is not easy to get those shadings using \starttable/\stoptable. Otherwise you would have given me an example using \starttable/\stoptable. -- Thanks, Manfred
Am 11.11.2010 20:13, schrieb Wolfgang Schuster:
The \setupTABLE command for the natural tables environment, you can find a overview of the different environments on the wiki.
Here is a example for a natural table:
\starttext
\setupTABLE[header][style=bold,background=color,backgroundcolor=gray]
\bTABLE \bTABLEhead \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead
with current minimal mkiv I get: (/opt/context/tex/texmf-context/tex/context/base/bxml-apa.mkiv) systems : begin file latex5.tex at line 3 ) Runaway argument? \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead \bTABLEbody \ETC. ! File ended while scanning use of \doTABLEhead. system > error on line 0 in file : File ended while scanning use of \doTABLEhead ... <empty file> <inserted text> \par <*> ./latex5.tex ? Herbert
On 11-11-2010 8:42, Herbert Voss wrote:
Am 11.11.2010 20:13, schrieb Wolfgang Schuster:
The \setupTABLE command for the natural tables environment, you can find a overview of the different environments on the wiki.
Here is a example for a natural table:
\starttext
\setupTABLE[header][style=bold,background=color,backgroundcolor=gray]
\bTABLE \bTABLEhead \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead
with current minimal mkiv I get:
(/opt/context/tex/texmf-context/tex/context/base/bxml-apa.mkiv) systems : begin file latex5.tex at line 3 ) Runaway argument? \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead
typo: \eTBALEhead -> \eTABLEhead 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 -----------------------------------------------------------------
Am 11.11.2010 20:45, schrieb Hans Hagen:
On 11-11-2010 8:42, Herbert Voss wrote:
Am 11.11.2010 20:13, schrieb Wolfgang Schuster:
The \setupTABLE command for the natural tables environment, you can find a overview of the different environments on the wiki.
Here is a example for a natural table:
\starttext
\setupTABLE[header][style=bold,background=color,backgroundcolor=gray]
\bTABLE \bTABLEhead \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead
Runaway argument? \bTR \bTD Colheader 1 \eTD \bTD Colheader 2 \eTD \eTR \eTBALEhead
typo: \eTBALEhead -> \eTABLEhead
uuh, should have seen it myself ... Herbert
This is mainly for completeness: On Thu, 11 Nov 2010, Manfred Lotz wrote:
and like to have a light gray background for the heading row.
\starttext
\starttable[|l|l|] \BL[2] \SR % or % \CL[gray] \SR \NC \bf Colheader 1 \NC \bf Colheader 2 \NC \SR \HL \NC cell 11 \NC cell 12 \NC \FR \NC cell 11 \NC cell 12 \NC \LR \stoptable
\stoptext
Both \BL and \CL work with MkII but in MkIV \BL gives a black rule (rather than gray), which \CL gives an error. Hans, any ideas? For a simple table, you can also use \startTABLE \NC .... \NC ... \NC \NR \NC .... \NC ... \NC \NR \stopTABLE which is wrapper around \bTABLE .. \eTABLE. Aditya
On 11-11-2010 10:54, Aditya Mahajan wrote:
This is mainly for completeness:
On Thu, 11 Nov 2010, Manfred Lotz wrote:
and like to have a light gray background for the heading row.
\starttext
\starttable[|l|l|] \BL[2] \SR % or % \CL[gray] \SR \NC \bf Colheader 1 \NC \bf Colheader 2 \NC \SR \HL \NC cell 11 \NC cell 12 \NC \FR \NC cell 11 \NC cell 12 \NC \LR \stoptable
\stoptext
Both \BL and \CL work with MkII but in MkIV \BL gives a black rule (rather than gray), which \CL gives an error. Hans, any ideas?
For a simple table, you can also use
\startTABLE \NC .... \NC ... \NC \NR \NC .... \NC ... \NC \NR \stopTABLE
which is wrapper around \bTABLE .. \eTABLE.
The color handling in the old table module is implemented by overloading TaBlE code and quite a hack. In mkiv it's easy to add color support but then I'd rather remove some of the old commands. In tabulate one can do (experimental so not enabled by default): \ctxlua{nodes.tasks.enableaction("shipouts","nodes.handlers.backgrounds")} \starttabulate[||p||] \NC test \NC test \NC test \NC \NR \NC test \NC[green] \input tufte \NC[yellow] test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC[blue] test \NC[red] test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC[gray] test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC[blue] test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC[magenta] test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC[cyan] \dorecurse{10}{\input ward }\NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC[yellow] test \NC test \NC \NR \stoptabulate So, if there's interest in the \starttable .. \stoptable mechanism (i have no idea how often it is used) I can consider weeding and redoing some of that code (or just rewrite it from scratch which is probably easier). 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 -----------------------------------------------------------------
On 12-11-2010 7:19, Hans Hagen wrote:
\ctxlua{nodes.tasks.enableaction("shipouts","nodes.handlers.backgrounds")}
i'll upload a beta where this is not needed ----------------------------------------------------------------- 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 -----------------------------------------------------------------
Am 12.11.2010 um 19:19 schrieb Hans Hagen:
So, if there's interest in the \starttable .. \stoptable mechanism (i have no idea how often it is used) I can consider weeding and redoing some of that code (or just rewrite it from scratch which is probably easier).
There is still a use for the old table macros because it’s easier to set small tables (alignment in the preamble versus many \setupTABLE settings), you can set different spacing between rows which is not part of tabulate and you can span cells (also not supported in tabulate). To make the environment more attractive you should use the tabulate mechanism for background colors (\BC[...] and \VL[...]) and a indent option would be usefull to indent the table in a narrower environment and in itemize. Wolfgang
On Fri, 12 Nov 2010, Wolfgang Schuster wrote:
Am 12.11.2010 um 19:19 schrieb Hans Hagen:
So, if there's interest in the \starttable .. \stoptable mechanism (i have no idea how often it is used) I can consider weeding and redoing some of that code (or just rewrite it from scratch which is probably easier).
There is still a use for the old table macros because it’s easier to set small tables (alignment in the preamble versus many \setupTABLE settings), you can set different spacing between rows which is not part of tabulate and you can span cells (also not supported in tabulate).
Perhaps we can add an align key to \startTABLE macro so that we could say \startTABLE[align={left, right, middle}] \NC a \NC b \NC c \NC \NR \NC a \NC b \NC c \NC \NR \stopTABLE similar to math alignment. Aditya
On Fri, 12 Nov 2010, Hans Hagen wrote:
On 11-11-2010 10:54, Aditya Mahajan wrote:
This is mainly for completeness:
On Thu, 11 Nov 2010, Manfred Lotz wrote:
and like to have a light gray background for the heading row.
\starttext
\starttable[|l|l|] \BL[2] \SR % or % \CL[gray] \SR \NC \bf Colheader 1 \NC \bf Colheader 2 \NC \SR \HL \NC cell 11 \NC cell 12 \NC \FR \NC cell 11 \NC cell 12 \NC \LR \stoptable
\stoptext
Both \BL and \CL work with MkII but in MkIV \BL gives a black rule (rather than gray), which \CL gives an error. Hans, any ideas?
For a simple table, you can also use
\startTABLE \NC .... \NC ... \NC \NR \NC .... \NC ... \NC \NR \stopTABLE
which is wrapper around \bTABLE .. \eTABLE.
The color handling in the old table module is implemented by overloading TaBlE code and quite a hack. In mkiv it's easy to add color support but then I'd rather remove some of the old commands. In tabulate one can do (experimental so not enabled by default):
\ctxlua{nodes.tasks.enableaction("shipouts","nodes.handlers.backgrounds")}
\starttabulate[||p||] \NC test \NC test \NC test \NC \NR \NC test \NC[green] \input tufte \NC[yellow] test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC[blue] test \NC[red] test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC[gray] test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC[blue] test \NC test \NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC test \NC[magenta] test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC[cyan] \dorecurse{10}{\input ward }\NC test \NC \NR \NC test \NC test \NC test \NC \NR \NC test \NC[yellow] test \NC test \NC \NR \stoptabulate
Can you also add vertical lines and row background colors?
So, if there's interest in the \starttable .. \stoptable mechanism (i have no idea how often it is used) I can consider weeding and redoing some of that code (or just rewrite it from scratch which is probably easier).
Personally, I do not like the \starttable ... \stoptable macros (the patchup with TaBlE macro is too convoluted) and am happy with the compact \startTABLE syntax. But then, I don't use tables too often anyways. Aditya
participants (5)
-
Aditya Mahajan
-
Hans Hagen
-
Herbert Voss
-
Manfred Lotz
-
Wolfgang Schuster