On 2-9-2012 20:58, Wolfgang Schuster wrote:

Am 02.09.2012 um 17:59 schrieb Aditya Mahajan <adit...@umich.edu>:

Hi,

On Edward Tufte's website, there is a discussion on zebra coloring in 
tables[1]. One of the suggestion is to add a horizontal rule after every third 
line or shade three lines with one background color and the remaining three 
with another background color.

Is there an easy way to do this with natural TABLEs? I can do something like:

\setupTABLE[row][1,2,3][background=color, backgroundcolor=gray]
\setupTABLE[row][7,8,9][background=color, backgroundcolor=gray]

but it requires knowing the number of lines in advance.

Aditya

[1]: http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001IV

Natural tables have “odd” and “even” keywords for \setupTABLE but none in the 
way you like it. What I would do is to use a overlay in combination with 
metapost to create the background but there is no global register to access the 
current column/row of a cell, e.g. \currenttablecolumn (this name is already 
used by tables) and \currenttablerow.

I've added 4 status macros:

\starttext

\bTABLE
    \bTR
\bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD \bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD \bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD \bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
    \eTR
    \bTR
\bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD \bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD \bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD \bTD (\currentTABLErow,\currentTABLEcolumn,\nofTABLErows,\nofTABLEcolumns) \eTD
    \eTR
\eTABLE

\stoptext


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

Reply via email to