ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: TABLE 'last line' tag?
Date: Fri, 21 Apr 2006 21:51:46 +0200	[thread overview]
Message-ID: <444937D2.6040906@wxs.nl> (raw)
In-Reply-To: <ops8cjdyxb9niby6@localhost>

nico wrote:
> On Thu, 20 Apr 2006 17:27:50 -0700, Johannes Graumann  
> <johannes_graumann@web.de> wrote:
>
>   
>> nico wrote:
>>
>>     
>>> Why don't you test if the attribute is set before applying it to the TR?
>>> You see the problem on the last row, but the fact is that you force the
>>> bottomframe clear for every row (which is dirty IMHO).
>>>       
>> It's not that easy, since the bottomframe - once set - is persistent ...  
>> so
>> every row underneath my header (e.g.) will have 'bottomframe=on' set.
>>     
>
> No, the options are local to the current level where it is set. If  
> bottomframe is on for one row, it won't set bottomframe to the next rows.  
> In the following example, only two rows (the header and another one in the  
> body) have local bottomframe on, and the last row bottomframe is done with  
> table setup:
>
> \starttext
> \setupTABLE[frame=off]
> \setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]
> \bTABLE
> \bTABLEhead
> \bTR[bottomframe=on]\bTH a \eTH\bTH b \eTH\eTR
> \eTABLEhead
> \bTABLEbody
> \bTR\bTD bla \eTD\bTD bla \eTD\eTR
> \bTR\bTD bla \eTD\bTD bla \eTD\eTR
> \bTR\bTD bla \eTD\bTD bla \eTD\eTR
> \bTR[bottomframe=on]\bTD bla \eTD\bTD bla \eTD\eTR
> \bTR\bTD bla \eTD\bTD bla \eTD\eTR
> \bTR\bTD bla \eTD\bTD bla \eTD\eTR
> \eTABLEbody
> \eTABLE
> \stoptext
>
> You can also put bottomframe only for a cell with  
> bTD[bottomframe=on]...\eTD.
>   

the following patch will permit negative numbers (remove empty lines due 
to mail mess up)

\def\setupTBLcell#1#2% cell over col over row
  {\setupTBLsection % already forgotten
\edef\positiverow{\number#1}%
\edef\positivecol{\number#2}%
\scratchcounter-\maximumrow\advance\scratchcounter#1\advance\scratchcounter\minusone
\edef\negativerow{\number\scratchcounter}%
\scratchcounter-\maximumcol\advance\scratchcounter#2\advance\scratchcounter\minusone
\edef\negativecol{\number\scratchcounter}%
   \getvalue{\@@tblprefix\v!each\v!each}%
   \getvalue{\@@tblprefix\c!y\v!each}%
   \getvalue{\@@tblprefix\c!x\v!each}%
   \getvalue{\@@tblprefix\c!y\v!oddeven\positiverow}%
   \getvalue{\@@tblprefix\c!x\v!oddeven\positivecol}%
   \getvalue{\@@tblprefix\c!x\v!oddeven\positivecol\c!y\v!oddeven\positiverow}%
   \ifnum\positiverow=\plusone
     \getvalue{\@@tblprefix\c!y\v!first}%
     \executeifdefined{\@@tblprefix\c!x\positivecol\c!y\v!first}\donothing
   \fi
   \ifnum\positivecol=\plusone
     \getvalue{\@@tblprefix\c!x\v!first}%
     \executeifdefined{\@@tblprefix\c!x\v!first\c!y\positiverow}\donothing
   \fi
   \ifnum\positiverow=\maximumrow\relax
     \getvalue{\@@tblprefix\c!y\v!last}%
     \executeifdefined{\@@tblprefix\c!x\positivecol\c!y\v!last}\donothing
   \fi
   \ifnum\positivecol=\maximumcol\relax
     \getvalue{\@@tblprefix\c!x\v!last}%
     \executeifdefined{\@@tblprefix\c!x\v!last\c!y\positiverow}\donothing
   \fi
   \ifnum\positiverow=\maximumrow\relax\ifnum\positivecol=\maximumcol\relax
     \getvalue{\@@tblprefix\c!x\v!last\c!y\v!last}%
   \fi\fi
   \ifnum\positiverow=\plusone \ifnum\positivecol=\plusone
     \getvalue{\@@tblprefix\c!x\v!first\c!y\v!first}%
   \fi\fi
   \ifnum#1>\noftblhdnxlines\else
     \executeifdefined{\@@tblprefix\v!header\v!each}\donothing
     \executeifdefined{\@@tblprefix\v!header\positivecol}\donothing
   \fi
   \executeifdefined{\@@tblprefix\c!y\positiverow}\donothing
\executeifdefined{\@@tblprefix\c!y\negativerow}\donothing
   \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax %    \executeifdefined{\@@tblprefix\c!x\positivecol}\donothing
\executeifdefined{\@@tblprefix\c!x\negativecol}\donothing
   \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax %    \executeifdefined{\@@tblprefix\c!x\positivecol\c!y\positiverow}\donothing
\executeifdefined{\@@tblprefix\c!x\negativecol\c!y\negativerow}\donothing
 \global\letcscsname\@@tblsplitafter\csname\@@tbl\@@tbl\c!after\endcsname
   \relax}

\setupcolors[state=start]

\setupTABLE[r]  [2][color=red]
\setupTABLE[r] [-2][color=red]
\setupTABLE[c]  [2][color=green]
\setupTABLE[c] [-2][color=green]
\setupTABLE[4]  [4][color=blue]
\setupTABLE[-4][-4][color=blue]

\bTABLE
\dorecurse{10}{\bTR \dorecurse{6}{\bTD xxx \eTD} \eTR}
\eTABLE

\stoptext


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

      parent reply	other threads:[~2006-04-21 19:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20  5:55 Johannes Graumann
2006-04-20  6:26 ` nico
2006-04-20 14:59   ` Johannes Graumann
2006-04-20 16:14     ` Peter Rolf
2006-04-20 16:45     ` Peter Münster
2006-04-20 16:50       ` Taco Hoekwater
2006-04-20 18:29         ` Johannes Graumann
2006-04-20 19:05           ` nico
2006-04-21  0:27             ` Johannes Graumann
2006-04-21  7:07               ` nico
2006-04-21 19:44                 ` Johannes Graumann
2006-04-21 20:57                   ` nico
2006-04-21 22:23                     ` Johannes Graumann
2006-04-21 19:51                 ` Hans Hagen [this message]

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=444937D2.6040906@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).