From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/64 Path: main.gmane.org!not-for-mail From: "W.H. Dekker" Newsgroups: gmane.comp.tex.context Subject: colored tables work... almost Date: Fri, 24 Jul 1998 16:45:49 +0200 Sender: owner-ntg-context@let.uu.nl Message-ID: <199807241445.QAA03048@servaly.hobby.nl> NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035390924 20841 80.91.224.250 (23 Oct 2002 16:35:24 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 16:35:24 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: pragma@wxs.nl Xref: main.gmane.org gmane.comp.tex.context:64 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:64 Hans Hagen wrote: > ======================= Now how about this one ==================== > > \unexpanded\def\Check#1 > {\stelomlijndin % let op de spatie achter #1 > [kader=uit, % let op het gebruik van \inlijnd > hoogte=passend, > offset=1pt, > breedte=2.5em, > uitlijnen=links, > achtergrond=raster]% > \hfill > \ifdim#1pt=0pt > % forget about it > \else\ifdim#1pt>2pt > \inlijnd[achtergrondraster=.9]{\strut$#1$}% > \else\ifdim#1pt>8pt > \inlijnd[achtergrondraster=.7]{\strut$#1$}% > \else > \inlijnd[achtergrond=]{\strut$#1$}% > \fi\fi\fi} > > \def\JC{\JustCenter} > > \starttabel[|l|f{\Check}|f{\Check}|f{\Check}|] > \HL > \VL \LOW{method} \VL \use3 \JC Laboratory no. \VL\SR > \DC \DL[3] \DR > etcetera That looked like a very interesting solution, which I translated as follows: \starttext \unexpanded\def\Check#1 {\setupframed % let op de spatie achter #1 [frame=off, % let op het gebruik van \inlijnd height=fit, offset=1pt, width=2.5em, align=left, background=color]% \hfill \def\leeg{0} \ifx#1\leeg no data% forget it \else\ifdim#1pt<-3pt \framed[backgroundcolor=unsat]{\strut$#1$}% \else\ifdim#1pt<-2pt \framed[backgroundcolor=quest]{\strut$#1$}% \else\ifdim#1pt>3pt \framed[backgroundcolor=unsat]{\strut$#1$}% \else\ifdim#1pt>2pt \framed[backgroundcolor=quest]{\strut$#1$}% \else \framed[background=]{\strut$#1$} \fi\fi\fi\fi\fi} \def\JC{\JustCenter} \setupcolors[state=start] \definecolor[unsat][r=1,g=.7,b=.7] \definecolor[quest][r=1,g=.9,b=.9] \starttable[|l|f{\Check}|f{\Check}|f{\Check}|] %\starttable[|l|c|c|c|] \HL \VL \LOW{method} \VL \use3 \JC Laboratory no. \VL\SR \DC \DL[3] \DR \VL \VL \JC 1 \VL \JC 2 \VL \JC 3 \VL\SR \HL \VL PO \VL 25.5 \VL -0.0 \VL -2.8 \VL\FR \HL \VL FFA \VL 2.2 \VL -0.3 \VL 3.3 \VL\MR \HL \VL Ranci \VL 2.3 \VL 0.7 \VL 0.6 \VL\MR \HL \VL NMR 20 \VL 1.9 \VL 0.7 \VL -1.0 \VL\LR \HL \VL \LOW{method} \VL \use3 \JC Laboratory no. \VL\SR \DC \DL[3] \DR \VL \VL \JC 6 \VL \JC 5 \VL \JC 6 \VL\SR \HL \VL PO \VL 1.4 \VL 2.4 \VL 0 \VL\FR \VL FFA \VL 0.5 \VL -0.8 \VL 0 \VL\MR \VL Ranci \VL -0.5 \VL 0 \VL 0 \VL\MR \VL NMR 20 \VL -0.4 \VL 0 \VL 0 \VL\LR \HL \stoptable \stoptext So I replaced raster with color because the raster thing did not work, possible because I translated the keywords (background, backgroundraster, raster) wrongly. By the way: do you have a list of english vs. dutch keywords somewhere?) This works fine, except for the following problems: - in your solution empty fields are considered 0, while they actually stand for non-measured data and may not be replaced with 0. I tried to solve this by testing if the cell has a single 0 (\ifx#1\leeg) but this does not work, the single 0's are not recognized. - The framed numbers (both colored and white) are all shifted up with the top of the frame against the top of the table-cell. So the first column does not align with the number columns and the table becomes longer than without coloring. I have shown this more explicitly by adding some extra \HL's. - The left vertical line of the cells containing "method" is broken in the middle. - Perhaps not important, but intriguing: I don't understand the f{\Check}. According to the TaBlE manual this looks like a font redefinition, but is it? I hope you another few of those nice suggestions! -- Kind regards, Wybo ===================Servalys Analytical Chemistry Services================= Wybo H. Dekker | Deilsedijk 60 | tel (31)345-652164 wybo@servaly.hobby.nl | 4158 CH Deil, The Netherlands | fax (31)345-652383