ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: colored tables work... almost
@ 1998-07-26 10:51 W.H. Dekker
  0 siblings, 0 replies; 5+ messages in thread
From: W.H. Dekker @ 1998-07-26 10:51 UTC (permalink / raw)
  Cc: ntg-context

Hans Hagen wrote:

> 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}}
> ...
> ...
> \def\accountTABLElinewidth%
>   {\scratchdimen=\LineThicknessUnit
>    \global\advance\TABLEheight by \@@tiHLheight\scratchdimen}

OK, I changed that. But it did'nt work (\DV undefined), because I
probably have to make a new format file. And I'm afraid that this
brings me back to the problems I had with that before the TeXLive3 CD:

/TeX/texmf/tex/context/base>context -ini cont-en
This is TeX, Version 3.14159 (Web2C 7.2) (INITEX)
(cont-en.tex

This is CONTEXT version <1998.3.26 > interface <english> responses <english>
...
...
...
 ! Incomplete \ifx; all text was ignored after line 722.
<inserted text> 
                \fi 
l.87 \input colo-ini.tex

? 

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: colored tables work... almost
@ 1998-07-27  7:21 Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 1998-07-27  7:21 UTC (permalink / raw)
  Cc: ntg-context

W.H. Dekker wrote:

> OK, I changed that. But it did'nt work (\DV undefined), because I
> probably have to make a new format file. And I'm afraid that this
> brings me back to the problems I had with that before the TeXLive3 CD:

One way out it to put it in a file called cont-new, 

  \unprotect 

  ... new stuff ... 

  \protect 

  \endinput 

Don't forget to delete this file when you update. 

(cont-new is read in at startup time; locat settings can go into
cont-sys)

> /TeX/texmf/tex/context/base>context -ini cont-en
> This is TeX, Version 3.14159 (Web2C 7.2) (INITEX)
> (cont-en.tex
> 
> This is CONTEXT version <1998.3.26 > interface <english> responses <english>
> ...
> ...
> ...
>  ! Incomplete \ifx; all text was ignored after line 722.
> <inserted text>
>                 \fi
> l.87 \input colo-ini.tex

Never seen that one. Tobias is on Linux now, so he can help you out. 
(I suggest you change to pdftex too, because this produced both dvi and
pdf code; 
if so, I'll send you an update.)

Can you look at colo-ini for

  \ifx\ifinpagebody ... \fi

and

  \ifx\MPgraphicstrue ... \fi

and just delete those pieces of code? These initializations already took
place. The old alternative can be troublesome when something is loaded
twice, which is strange in itself.  

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: colored tables work... almost
@ 1998-07-24 17:16 Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 1998-07-24 17:16 UTC (permalink / raw)
  Cc: ntg-context

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: colored tables work... almost
@ 1998-07-24 16:20 Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 1998-07-24 16:20 UTC (permalink / raw)
  Cc: ntg-context

W.H. Dekker wrote:

> 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

                    screen

> english vs. dutch keywords somewhere?)

Look into file mult-con/mult-com or get the qrc docs from the ntg site,
these are cross linked (click on dutch and get english etc). 

It should work because I use it daily. Keep in mind that some
programs/printers (indeed also GS) just don't show light shades of gray. 

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

I suggest you take a look at syst-gen.tex (I can send you a typeset
documented listing if needed). You can use (and there is a lot of this
stuff there):

\doifelse{#1}{}
  {..}
  {..}

But: the check macro needs a value, so you can best put a * in each
column that does not have a value, and say

\doifelse{#1}{*}
  {..} {..}

An alternative solution would be:

\ifx#1\VL
  etc etc 

but I didn't test this. 

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

First you have to use \inframed instead of \framed (that one normalizes
the framed data to the lineheight. You also have some \.R wrong. 

> - The left vertical line of the cells containing "method" is broken in
>   the middle.

Indeed. I'll look into it. Seperate mail. 

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

It sort of is, but such a font definition ends up in front of the data,
and what I do is picking up that data (space terminated). You could also
have let your perl script put 
\Check{..} into each column. 

> I hope you another few of those nice suggestions!

Well, just let me know. When you look in syst-gen, syst-ext, supp-box
you already see a lot of trickery. 

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* colored tables work... almost
@ 1998-07-24 14:45 W.H. Dekker
  0 siblings, 0 replies; 5+ messages in thread
From: W.H. Dekker @ 1998-07-24 14:45 UTC (permalink / raw)
  Cc: ntg-context

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-07-27  7:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-26 10:51 colored tables work... almost W.H. Dekker
  -- strict thread matches above, loose matches on Subject: below --
1998-07-27  7:21 Hans Hagen
1998-07-24 17:16 Hans Hagen
1998-07-24 16:20 Hans Hagen
1998-07-24 14:45 W.H. Dekker

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).