From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/78051 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: Setting options for every n-th row in natural TABLEs Date: Sun, 2 Sep 2012 20:39:41 -0400 (EDT) Message-ID: References: <461190EC-4251-4CCE-8F75-F78EA878BC56@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-48778315-1346632783=:2975" X-Trace: ger.gmane.org 1346632802 32546 80.91.229.3 (3 Sep 2012 00:40:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Sep 2012 00:40:02 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Sep 03 02:40:04 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T8Khp-0000s0-3f for gctc-ntg-context-518@m.gmane.org; Mon, 03 Sep 2012 02:39:57 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E7A6610201; Mon, 3 Sep 2012 02:39:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Z2zy8vYUeMIr; Mon, 3 Sep 2012 02:39:52 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D6A17101F0; Mon, 3 Sep 2012 02:39:51 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3E572101F0 for ; Mon, 3 Sep 2012 02:39:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id o768-urPyzvm for ; Mon, 3 Sep 2012 02:39:48 +0200 (CEST) Original-Received: from filter3-utr.mf.surf.net (filter3-utr.mf.surf.net [195.169.124.154]) by balder.ntg.nl (Postfix) with ESMTP id 50895101DF for ; Mon, 3 Sep 2012 02:39:47 +0200 (CEST) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by filter3-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q830djTu016125 for ; Mon, 3 Sep 2012 02:39:46 +0200 Original-Received: FROM adi-netbook (bas3-montreal02-1096679445.dsl.bell.ca [65.94.0.21]) By hellskitchen.mr.itd.umich.edu ID 5043FC4F.6E2D0.13746 ; Authuser adityam; 2 Sep 2012 20:39:43 EDT In-Reply-To: <461190EC-4251-4CCE-8F75-F78EA878BC56@gmail.com> User-Agent: Alpine 2.02 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.82; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08HSoDJsn - f12cc56d3b06 - 20120903 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.154 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:78051 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-48778315-1346632783=:2975 Content-Type: TEXT/PLAIN; charset=windows-1252; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 2 Sep 2012, Wolfgang Schuster wrote: > > Am 02.09.2012 um 17:59 schrieb Aditya Mahajan : > >> Hi, >> >> On Edward Tufte's website, there is a discussion on zebra coloring in ta= bles[1]. One of the suggestion is to add a horizontal rule after every thir= d line or shade three lines with one background color and the remaining thr= ee 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=3Dcolor, backgroundcolor=3Dgray] >> \setupTABLE[row][7,8,9][background=3Dcolor, backgroundcolor=3Dgray] >> >> but it requires knowing the number of lines in advance. >> >> Aditya >> >> [1]: http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=3D0001IV > > Natural tables have =93odd=94 and =93even=94 keywords for \setupTABLE but= none=20 > in the way you like it. Well, I can always change what odd and even means :) (I also realized that= =20 odd and even are just dummy values. I can change them to anything, and can= =20 in fact even turn \v!oddeven to a switch statement that returns multiple=20 values) \unprotect \def\redefineoddeven% HACK {\def\v!oddeven##1% Return odd if in set 1-3, 7-9, etc. and even other= wise {\ctxcommand{doifelse(math.mod(##1-1,6) < 3)}\v!odd\v!even}} \protect \startsetups zebra:three \redefineoddeven \setupTABLE[frame=3Doff,background=3Dcolor] \setupTABLE[row][odd][backgroundcolor=3Dblue] \setupTABLE[row][even][backgroundcolor=3Dred] \stopsetups \starttext \startTABLE[setups=3D{zebra:three}] \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \NC A \NC B \NC C \NC \NR \stopTABLE \stoptext > What I would do is to use a overlay in combination with metapost to=20 > create the background but there is no global register to access the=20 > current column/row of a cell, e.g. \currenttablecolumn (this name is=20 > already used by tables) and \currenttablerow. Thanks for the hint. It is relatively easy to access the local counter for= =20 a cell, and changing background colors dependon the current row works=20 well. \defineconversion [triadcolors] [blue,blue,blue,red,red,red] \startsetups zebra:three \setupTABLE[frame=3Doff,background=3Dcolor] \setupTABLE[row][backgroundcolor=3D{\convertnumber{triadcolors}{\getva= lue{m_tabl_ntb_positive_row}}}] \stopsetups If I need rules, I guess I can explicitly check for the value of \m_tabl_nt= b_postive_pow=20 inside an overlay. Thanks, Aditya --8323328-48778315-1346632783=:2975 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --8323328-48778315-1346632783=:2975--