ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: colored tables work... almost
Date: Fri, 24 Jul 1998 19:16:01 +0200	[thread overview]
Message-ID: <35B8C151.B0B562D0@wxs.nl> (raw)

Hello Wybo, 

First your table: 

\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
   \doifnot{#1}{*}        % see 'm ? 
     {\ifdim#1pt<-3pt
        \inframed[backgroundcolor=unsat]{\strut$#1$}%
      \else\ifdim#1pt<-2pt
        \inframed[backgroundcolor=quest]{\strut$#1$}%
      \else\ifdim#1pt>3pt
        \inframed[backgroundcolor=unsat]{\strut$#1$}%
      \else\ifdim#1pt>2pt
        \inframed[backgroundcolor=quest]{\strut$#1$}%
      \else
        \inframed[background=]{\strut$#1$}
      \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]

% \setuptables[VL=none] % Of course this should also be obeyed.

\starttable[|l|f{\Check}|f{\Check}|f{\Check}|]
\HL
\VL \LOW{method} \VL \use3 \JC Laboratory no.  \VL\SR
\DV              \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 
\VL FFA          \VL  2.2  \VL -0.3  \VL  3.3  \VL\MR 
\VL Ranci        \VL  2.3  \VL  0.7  \VL  0.6  \VL\MR 
\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
\DV              \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   *   \VL\FR
\VL FFA          \VL  0.5  \VL -0.8  \VL   *   \VL\MR
\VL Ranci        \VL -0.5  \VL   *   \VL   *   \VL\MR
\VL NMR 20       \VL -0.4  \VL   *   \VL   *   \VL\LR
\HL
\stoptable
\stoptext

Here is the patch, change this section in core-tab.tex (in fact only a
few lines changed):

%D \startopsomming[3*ruim]
%D \sym{\type{\DL}}
%D \sym{\type{\DV}} (\type{\VD}) 
%D \sym{\type{\DC}}
%D \sym{\type{\DR}}
%D \stopopsomming

\newif\ifTABLEdivision

\def\defineTABLEdivisions%
  {\global\TABLEdivisionfalse % in start
   \let\DL=\TableDL
   \let\DC=\TableDC
   \let\DV=\TableDV
   \let\VD=\TableDV
   \let\DR=\TableDR}

\def\checkTABLEdivision%
  {\ifTABLEdivision \else
     \chuckTABLEautorow
     \global\currentTABLEcolumn=0
     \global\TABLEdivisiontrue
   \fi}

\def\TableDL%
  {\checkTABLEdivision
   \complexorsimpleTable{DL}}

\def\simpleTableDL%
  {\complexTableDL[1]}

\def\complexTableDL[#1]%
  {\ifnum\TABLEaction=\TABLErule
     \writestatus{TABLE}{skipping \string\DL}%
   \else
     \ifnum\TABLEaction=\TABLEmidrow
       \writestatus{TABLE}{change \string\MR\space into
\string\LR/\string\SR}%
     \else\ifnum\TABLEaction=\TABLEfirstrow
       \writestatus{TABLE}{change \string\MR\space into \string\SR}%
     \fi\fi
     \setTABLEaction=\TABLEunknown
     \ifnum\currentTABLEcolumn>\maxTABLEcolumn
       \setTABLEerror\TABLEmissingrow
       \handleTABLEerror
     \fi
     %\startHLcommand
     \ifnum#1=1
       \global\advance\currentTABLEcolumn by 2
       \let\next=\normalTABLEsinglerule
     \else
       \ifnum#1<\maxTABLEcolumn
         \global\advance\currentTABLEcolumn by 1 % was 2
         \def\next{\normalTABLEmultirule{#1}}%
       \else
         \setTABLEerror\TABLEdivisionoverflow
         \let\next=\handleTABLEerror
       \fi
     \fi
     \next
     %\stopHLcommand
     %\global\let\startHLcommand=\empty
     %\global\let\stopHLcommand =\empty
   \fi}

\def\TableDV%
  {\TableDCV
     {\edef\@@tiVLwidth{\getvalue{wVL\the\currentTABLEcolumn}}%
      \expanded{\normalTABLEcomplexbar{\@@tiVLwidth}}}}

\def\TableDC%
  {\TableDCV\normalTABLEquote}

\def\TableDCV#1%
  {\checkTABLEdivision
   \checkTABLEautorow
   \ifnum\currentTABLEcolumn>\maxTABLEcolumn
     \setTABLEerror\TABLEmissingrow
     \handleTABLEerror
   \else
     \global\advance\currentTABLEcolumn by 1
     #1%
   \fi}

\def\TableDR%
  {\ifnum\currentTABLEcolumn<\maxTABLEcolumn % silent recovery 
     \setTABLEerror\TABLEmissingcolumn       % some day warning
     \handleTABLEerror
   \else
     \global\currentTABLEcolumn=0            % nog check 
     \normalTABLElineending
   \fi
   \TABLEnoalign
     {\nobreak
      \global\TABLEdivisionfalse
      \accountTABLElinewidth % temporary solution
      \setTABLEaction\TABLErule}}

\def\accountTABLElinewidth%
  {\scratchdimen=\LineThicknessUnit
   \global\advance\TABLEheight by \@@tiHLheight\scratchdimen}

You see, the new command is \DV (or \VD). Unfortunately we cannot
support this kind of things automatically.

Hans 

-----------------------------------------------------------------
                                              Hans Hagen | PRAGMA
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | fax: 038 477 53 74 | mail: pragma@wxs.nl
-----------------------------------------------------------------


             reply	other threads:[~1998-07-24 17:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-24 17:16 Hans Hagen [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-07-27  7:21 Hans Hagen
1998-07-26 10:51 W.H. Dekker
1998-07-24 16:20 Hans Hagen
1998-07-24 14:45 W.H. Dekker

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=35B8C151.B0B562D0@wxs.nl \
    --to=pragma@wxs.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).