From: "W.H. Dekker" <wybo@servaly.hobby.nl>
Cc: ntg-context@ntg.nl
Subject: colored tables work... almost
Date: Fri, 24 Jul 1998 16:45:49 +0200 [thread overview]
Message-ID: <199807241445.QAA03048@servaly.hobby.nl> (raw)
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
next reply other threads:[~1998-07-24 14:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-07-24 14:45 W.H. Dekker [this message]
1998-07-24 16:20 Hans Hagen
1998-07-24 17:16 Hans Hagen
1998-07-26 10:51 W.H. Dekker
1998-07-27 7:21 Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199807241445.QAA03048@servaly.hobby.nl \
--to=wybo@servaly.hobby.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).