Re: [NTG-context] TABLE 'last line' tag?

2006-04-21 Thread nico
On Thu, 20 Apr 2006 17:27:50 -0700, Johannes Graumann  
[EMAIL PROTECTED] 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.

Regards,
BG
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-21 Thread Johannes Graumann
nico wrote:

 On Thu, 20 Apr 2006 17:27:50 -0700, Johannes Graumann
 [EMAIL PROTECTED] 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:

The persistence issue is XML specific, I believe and therefore does not
apply to your code example.

Joh


___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-21 Thread Hans Hagen
nico wrote:
 On Thu, 20 Apr 2006 17:27:50 -0700, Johannes Graumann  
 [EMAIL PROTECTED] 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
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-21 Thread nico
On Fri, 21 Apr 2006 12:44:45 -0700, Johannes Graumann  
[EMAIL PROTECTED] wrote:



nico wrote:


On Thu, 20 Apr 2006 17:27:50 -0700, Johannes Graumann
[EMAIL PROTECTED] 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:


The persistence issue is XML specific, I believe and therefore does not
apply to your code example.


It's because you systematically apply the attribute. Doing this should  
work, even if there's maybe a smarter way of doing:


\defineXMLnested
  [tr]
  [bottomframe=,rulethickness=0.5pt]
  {\doifelse{\XMLop{bottomframe}}{}%
   {\expanded{\bTR}}%
   
{\expanded{\bTR[bottomframe=\XMLop{bottomframe},rulethickness=\XMLop{rulethickness}]}}}
  {\eTR}

I attach the full example.

Regards,
BG

splittable.tex
Description: TeX document
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-21 Thread Johannes Graumann
nico wrote:

 \defineXMLnested
 [tr]
 [bottomframe=,rulethickness=0.5pt]
 {\doifelse{\XMLop{bottomframe}}{}%
 {\expanded{\bTR}}%

{\expanded{\bTR[bottomframe=\XMLop{bottomframe},rulethickness=\XMLop{rulethickness}]}}}
 {\eTR}


So much to learn, so little time. Thank you for this hint! Was hunting
around in the XML example file for some XML specific switches and didn't
get far ... this  does it. Thank you.

Joh

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] TABLE 'last line' tag?

2006-04-20 Thread Johannes Graumann
Hello,

When formating tables the first row (top of the header) is easily formated
by using for example:
\setupTABLE[row][1][rulethickness=0.90pt,topframe=on]

I was wondering whether there's an equivalent for specifically addressing
the LAST row in a table? Something along the lines of
\setupTABLE[row][last][rulethickness=0.90pt,topframe=on]
\setupTABLE[row][-1][rulethickness=0.90pt,topframe=on]%python-like
which both don't work ...

Thanks for any hint, Joh

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-20 Thread nico
On Wed, 19 Apr 2006 22:55:23 -0700, Johannes Graumann  
[EMAIL PROTECTED] wrote:

 Hello,

 When formating tables the first row (top of the header) is easily  
 formated
 by using for example:
 \setupTABLE[row][1][rulethickness=0.90pt,topframe=on]

 I was wondering whether there's an equivalent for specifically addressing
 the LAST row in a table? Something along the lines of
 \setupTABLE[row][last][rulethickness=0.90pt,topframe=on]
 \setupTABLE[row][-1][rulethickness=0.90pt,topframe=on]%python-like
 which both don't work ...

Do you want to do this?
\setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]

Regards,
BG
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-20 Thread Johannes Graumann
nico wrote:

 Do you want to do this?
 \setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]

Yes, that's what I want, but it doesn't work for me.

Joh

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-20 Thread Peter Rolf
Johannes Graumann wrote:
 nico wrote:
 
 Do you want to do this?
 \setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]
 
\setupTABLE[r][last][]

Use only the short forms (r=row and c=column) and it should work.
I had to look in an old table, where I had the same problems (I guess).
Should be wikified..

Greets, Peter

 Yes, that's what I want, but it doesn't work for me.
 
 Joh
 
 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context
 
 

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-20 Thread Peter Münster
On Thu, 20 Apr 2006, Johannes Graumann wrote:

 nico wrote:
 
  Do you want to do this?
  \setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]
 
 Yes, that's what I want, but it doesn't work for me.

Could you send a minimal example?
This works here:

\starttext
\setupTABLE[frame=off]
\setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]
\bTABLE
\bTR\bTD bla \eTD\bTD bla \eTD\eTR
\bTR\bTD bla \eTD\bTD bla \eTD\eTR
\eTABLE
\stoptext

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-20 Thread Taco Hoekwater
Peter Münster wrote:
 On Thu, 20 Apr 2006, Johannes Graumann wrote:
 
 
nico wrote:


Do you want to do this?
\setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]

Yes, that's what I want, but it doesn't work for me.
 
 Could you send a minimal example?
 This works here:

Same for me. Perhaps it is a grouping issue? This fails:

  \setupTABLE[frame=off]
  {\setupTABLE[row][last][rulethickness=0.90pt,bottomframe=on]}
  \bTABLE ... \eTABLE

Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-20 Thread Johannes Graumann
Figured out what's going on and would appreciate some advice on the issue:

My actual code interprets XML and reads:

\defineXMLnested
  [splittable]
  {
\defineXMLsave[caption]
\defineXMLsave[header]
\defineXMLsave[body]
\defineXMLsave[footer]
  }
  {
\splitfloat
  {\placetable[\XMLpar{table}{location}{here}][\XMLpar{table}{label
{unknown}]{\XMLflush{caption}}}
  {
\setupTABLE[row][1][rulethickness=0.30pt,topframe=on]
\setupTABLE[row][last][rulethickness=0.30pt,bottomframe=on]
   
\bTABLE[frame=off,split=repeat,splitmethod=b,distance=7.5pt,style={\switchtobodyfont[small]\setupinterlinespace[line=2.8ex]}]
  \bTABLEhead\XMLflush{header}\eTABLEhead
  \bTABLEbody\XMLflush{body}\eTABLEbody
  \bTABLEfoot\XMLflush{footer}\eTABLEfoot
\eTABLE
  }
  }

\defineXMLnested
  [tr]
  [bottomframe=]
  {\expanded{\bTR[bottomframe=\XMLop{bottomframe}]}}
  {\eTR}

What's happening here is that the the 'tr' bottomframe statement (which I
need for formating) overrides the '\setupTABLE[row]' bit. Is there any way
to make 'tr's bottomframe-statement be ineffectual in case of being the
last raw?

Joh

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] TABLE 'last line' tag?

2006-04-20 Thread Johannes Graumann
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. 

So if I set the bottomframe to separate header from body, I have to clear it
from the next line (at least) in order to keep the body bottomframe
free ... and than I run into trouble with the last row, which is body, but
where I explicitly WANT the bottomframe.

Am I not getting something here?

Joh

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context