![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Hi, I try currently to write a table with a repeated header on all pages and rules above and below the header and another rule below the table on all pages. I tried this now with all tables in ConTeXt but I can't the desired result from any of them. Tabulate has problems with rule below the header and did not support repeated footers. TaBlE has problems with the spacing of his rows below the header and at the bottom of the tables, it has also a problem with the spacing from the rule at the bottom. Natural Tables allow me to put a rule above and below the header but I'm unable to get rule at last row on every page, the "last" key for rows use always the last row of the hole table. I played also a little bit with textbackground but I have a few problems with the results, the background has always the width of the current textwidth and it takes always the topskip into account. What it tried so far is the following code: \setuppapersize[A7,landscape][A7,landscape] \setuplayout[lines=5] \starttext \tracetablestrue \setuptables[split=repeat] \starttablehead \HL \NC Row 1 \NC Row 2 \NC Row 3 \NC\AR \HL \stoptablehead \starttabletail \HL \stoptabletail \starttable[|l|l|l|] \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \stoptable \page \startbuffer[tabulate] \starttabulatehead \HL \NC Row 1 \NC Row 2 \NC Row 3 \NC\NR \HL \stoptabulatehead \starttabulatetail \HL \stoptabulatetail \starttabulate[|l|l|l|] \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \stoptabulate \stopbuffer \getbuffer[tabulate] \page \setuptabulate[header=repeat] \getbuffer[tabulate] \page \newconditional\tabulaterepeatfoot \settrue\tabulaterepeatfoot \def\dosplittabulatebox#1% {\resettsplit \def\tsplitminimumfreelines{2}% \def\tsplitminimumfreespace{0pt}% \setbox\tsplitcontent\box#1% \ifcase\tabulaterepeathead\or \setbox\tsplithead\vsplit\tsplitcontent to 3\lineheight \setbox\tsplithead\vbox{\unvbox\tsplithead}% \or \setbox\tsplithead\vbox{\hbox{\strut\tabulateparameter\c!title}}% \fi \ifcase\tabulaterepeatfoot %\setbox\tsplittail\vsplit\tsplitcontent to \lineheight %\setbox\tsplittail\vbox{\unvbox\tsplittail}% \setbox\tsplittail\vbox{\color[orange]{\hrule}}% \fi \handletsplit} \def\fulltabulatecontent {\tabulateheadcontent \tabulatecontent \ifcase\tabulaterepeatfoot\else \tabulatetailcontent \fi \removefunnytabulateline} %\tracetabulatetrue \getbuffer[tabulate] \page %\traceTABLEtrue \setupTABLE[split=repeat,frame=off] \setupTABLE[header][topframe=on,bottomframe=on] \setupTABLE[row][last][bottomframe=on] \bTABLE \bTABLEhead \bTR\bTH Row 1 \eTH\bTH Row 2 \eTH\bTH Row 3 \eTH\eTR \eTABLEhead \bTABLEfoot \bTR\bTD Row 1 \eTD\bTD Row 2 \eTD\bTD Row 3 \eTD\eTR \eTABLEfoot \bTABLEbody \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \eTABLEbody \eTABLE \stoptext I will also show you what I tried to get with textbackgrounds. \setuppapersize[A7,landscape][A7,landscape] \setuplayout[lines=5] \setupcolors[state=start] \startuseMPgraphic{tableback} pickup pencircle scaled 1pt; path p; p = (multipars[1]); draw p withcolor red; \stopuseMPgraphic \definetextbackground [mytab] [location=paragraph, width=local, mp=tableback] \starttext %\topskip=0pt \setuptabulate [before={\starttextbackground[mytab]}, after=\stoptextbackground] \starttabulatehead \HL \NC Row 1 \NC Row 2 \NC Row 3 \NC\NR \HL \stoptabulatehead \starttabulatetail \HL \stoptabulatetail \starttabulate[|l|l|l|] \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \stoptabulate \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/44ca9eda7aaa681c0e3b3e90125c56b0.jpg?s=120&d=mm&r=g)
Hi Wolfgang, what a nice 'minimal' example :) I'm no table expert, not even an experienced table user. Anyhow, I think that table is the best choice here. Aside from the bad placing of the horizontal rules, all is working. This is much more than you can say from the other candidates. How about defining your own horizontal rules instead of using the default \HL ones? See definition of \TableHL and alike in core-tab.tex. You can define special horizontal lines for all three occurrences, so spacing should not be a problem. Donno if this works out of the box (if table accepts such stuff in head and tail). All untested, as I don't have much time. try (ugly and old code, works between normal table lines) \def\betweentable#1{\TABLEnoalign{\nointerlineskip#1\nointerlineskip}} \TB[small,medium,...] for vertical spacing and \betweentable{...} for the line (MP line is always nice) \TB[small] \betweentable{\hbox{~~~\reuseMPgraphic{EnglishRule}{color=dimgray,width=81.3mm,height=2pt}}} \TB[medium] CHANGE IT HERE <<< \starttablehead \HL % <<< \NC Row 1 \NC Row 2 \NC Row 3 \NC\AR \HL % <<< \stoptablehead \starttabletail \HL % <<< \stoptabletail Hope that helps, Peter Wolfgang Schuster schrieb:
Hi,
I try currently to write a table with a repeated header on all pages and rules above and below the header and another rule below the table on all pages. I tried this now with all tables in ConTeXt but I can't the desired result from any of them.
Tabulate has problems with rule below the header and did not support repeated footers.
TaBlE has problems with the spacing of his rows below the header and at the bottom of the tables, it has also a problem with the spacing from the rule at the bottom.
Natural Tables allow me to put a rule above and below the header but I'm unable to get rule at last row on every page, the "last" key for rows use always the last row of the hole table.
I played also a little bit with textbackground but I have a few problems with the results, the background has always the width of the current textwidth and it takes always the topskip into account.
What it tried so far is the following code:
\setuppapersize[A7,landscape][A7,landscape] \setuplayout[lines=5]
\starttext
\tracetablestrue \setuptables[split=repeat]
\starttablehead \HL \NC Row 1 \NC Row 2 \NC Row 3 \NC\AR \HL \stoptablehead
\starttabletail \HL \stoptabletail
\starttable[|l|l|l|] \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \NC Text \NC Text \NC Text \NC\AR \stoptable
\page
\startbuffer[tabulate] \starttabulatehead \HL \NC Row 1 \NC Row 2 \NC Row 3 \NC\NR \HL \stoptabulatehead
\starttabulatetail \HL \stoptabulatetail
\starttabulate[|l|l|l|] \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \stoptabulate \stopbuffer
\getbuffer[tabulate]
\page
\setuptabulate[header=repeat]
\getbuffer[tabulate]
\page
\newconditional\tabulaterepeatfoot
\settrue\tabulaterepeatfoot
\def\dosplittabulatebox#1% {\resettsplit \def\tsplitminimumfreelines{2}% \def\tsplitminimumfreespace{0pt}% \setbox\tsplitcontent\box#1% \ifcase\tabulaterepeathead\or \setbox\tsplithead\vsplit\tsplitcontent to 3\lineheight \setbox\tsplithead\vbox{\unvbox\tsplithead}% \or \setbox\tsplithead\vbox{\hbox{\strut\tabulateparameter\c!title}}% \fi \ifcase\tabulaterepeatfoot %\setbox\tsplittail\vsplit\tsplitcontent to \lineheight %\setbox\tsplittail\vbox{\unvbox\tsplittail}% \setbox\tsplittail\vbox{\color[orange]{\hrule}}% \fi \handletsplit}
\def\fulltabulatecontent {\tabulateheadcontent \tabulatecontent \ifcase\tabulaterepeatfoot\else \tabulatetailcontent \fi \removefunnytabulateline}
%\tracetabulatetrue
\getbuffer[tabulate]
\page
%\traceTABLEtrue \setupTABLE[split=repeat,frame=off] \setupTABLE[header][topframe=on,bottomframe=on] \setupTABLE[row][last][bottomframe=on]
\bTABLE \bTABLEhead \bTR\bTH Row 1 \eTH\bTH Row 2 \eTH\bTH Row 3 \eTH\eTR \eTABLEhead \bTABLEfoot \bTR\bTD Row 1 \eTD\bTD Row 2 \eTD\bTD Row 3 \eTD\eTR \eTABLEfoot \bTABLEbody \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR \eTABLEbody \eTABLE
\stoptext
I will also show you what I tried to get with textbackgrounds.
\setuppapersize[A7,landscape][A7,landscape] \setuplayout[lines=5] \setupcolors[state=start]
\startuseMPgraphic{tableback} pickup pencircle scaled 1pt; path p; p = (multipars[1]); draw p withcolor red; \stopuseMPgraphic
\definetextbackground [mytab] [location=paragraph, width=local, mp=tableback]
\starttext
%\topskip=0pt
\setuptabulate [before={\starttextbackground[mytab]}, after=\stoptextbackground]
\starttabulatehead \HL \NC Row 1 \NC Row 2 \NC Row 3 \NC\NR \HL \stoptabulatehead
\starttabulatetail \HL \stoptabulatetail
\starttabulate[|l|l|l|] \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \NC Text \NC Text \NC Text \NC\NR \stoptabulate
\stoptext
Wolfgang
------------------------------------------------------------------------
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
2007/11/6, Peter Rolf
Hi Wolfgang,
what a nice 'minimal' example :)
I'm no table expert, not even an experienced table user. Anyhow, I think that table is the best choice here. Aside from the bad placing of the horizontal rules, all is working. This is much more than you can say from the other candidates.
How about defining your own horizontal rules instead of using the default \HL ones? See definition of \TableHL and alike in core-tab.tex. You can define special horizontal lines for all three occurrences, so spacing should not be a problem.
Donno if this works out of the box (if table accepts such stuff in head and tail). All untested, as I don't have much time.
try (ugly and old code, works between normal table lines)
\def\betweentable#1{\TABLEnoalign{\nointerlineskip#1\nointerlineskip}}
\TB[small,medium,...] for vertical spacing and \betweentable{...} for the line (MP line is always nice)
\TB[small] \betweentable{\hbox{~~~\reuseMPgraphic{EnglishRule}{color=dimgray,width= 81.3mm,height=2pt}}} \TB[medium]
CHANGE IT HERE <<<
\starttablehead \HL % <<< \NC Row 1 \NC Row 2 \NC Row 3 \NC\AR \HL % <<< \stoptablehead
\starttabletail \HL % <<< \stoptabletail
Hope that helps,
Peter
Hi Peter, your solution would be really a option but I hope the real bugs will be fixed, the big space above the footer line did only appear with the repeat option for split. \starttext \startbuffer \starttablehead \HL \NC Head 1 \NC Head 2 \NC\AR \HL \stoptablehead \starttabletail \HL \stoptabletail \starttable[|||] \NC Text \NC Text \NC\AR \NC Text \NC Text \NC\AR \NC Text \NC Text \NC\AR \NC Text \NC Text \NC\AR \stoptable \stopbuffer %\tracetablestrue \setuptables[split=no] \getbuffer \setuptables[split=yes] \getbuffer \setuptables[split=repeat] \getbuffer \stoptext The wrong spaces after the header and before the footer in the other examples are a result of the macro expansion and need also to be solved, because it is not possile to insert the right nexrow command (\FR and \LR) in the table input without looking at the final pagebreaks. This should be possible with a few extra signals after the header and every line and by inserting linecorrection when the header, footer and tablebody are combined. Wolfgang
![](https://secure.gravatar.com/avatar/44ca9eda7aaa681c0e3b3e90125c56b0.jpg?s=120&d=mm&r=g)
Wolfgang Schuster schrieb:
Hi Peter,
your solution would be really a option but I hope the real bugs will be fixed,
I see :) So things could be worse. You have - a workaround (?) - a complete minimal description/example of the problem (as starting point for Hans) - some good hints/solution for fixing If you add some patience this all looks quite promising. ;) Best wishes, Peter
the big space above the footer line did only appear with the repeat option for split.
\starttext
\startbuffer \starttablehead \HL \NC Head 1 \NC Head 2 \NC\AR \HL \stoptablehead
\starttabletail \HL \stoptabletail
\starttable[|||] \NC Text \NC Text \NC\AR \NC Text \NC Text \NC\AR \NC Text \NC Text \NC\AR \NC Text \NC Text \NC\AR \stoptable \stopbuffer
%\tracetablestrue
\setuptables[split=no] \getbuffer
\setuptables[split=yes] \getbuffer
\setuptables[split=repeat] \getbuffer
\stoptext
The wrong spaces after the header and before the footer in the other examples are a result of the macro expansion and need also to be solved, because it is not possile to insert the right nexrow command (\FR and \LR) in the table input without looking at the final pagebreaks. This should be possible with a few extra signals after the header and every line and by inserting linecorrection when the header, footer and tablebody are combined.
Wolfgang
------------------------------------------------------------------------
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
2007/11/7, Peter Rolf
Wolfgang Schuster schrieb:
Hi Peter,
your solution would be really a option but I hope the real bugs will be fixed,
I see :)
So things could be worse. You have
- a workaround (?)
you mean your solution with a self defined rule. There is also another one if you want to put the table into a float because you can use the background mechanism and put a overlay behind the table. - a complete minimal description/example of the problem (as starting
point for Hans) - some good hints/solution for fixing
If you add some patience this all looks quite promising. ;)
Best wishes, Peter
I have time and this is nothing I need at the moment but this should be fixed especially if you realy need tables in one of your documents. Wolfgang
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
2007/11/7, Peter Rolf
Wolfgang Schuster schrieb:
Hi Peter,
your solution would be really a option but I hope the real bugs will be fixed,
I see :)
So things could be worse. You have
- a workaround (?) - a complete minimal description/example of the problem (as starting point for Hans) - some good hints/solution for fixing
If you add some patience this all looks quite promising. ;)
Best wishes, Peter
Hi Peter, most of the are also possible with the tabulate environment and I was able to get a nearly perfect result (a few minor spacing problems) with it. \unprotect \newconditional\tabulaterepeatfoot \settrue\tabulaterepeatfoot %\setfalse\tabulaterepeatfoot \def\dosplittabulatebox#1% {\resettsplit \def\tsplitminimumfreelines{2}% \def\tsplitminimumfreespace{0pt}% \setbox\tsplitcontent\box#1% \ifcase\tabulaterepeathead\or \setbox\tsplithead\vsplit\tsplitcontent to \lineheight \setbox\tsplithead\vbox{\unvbox\tsplithead}% \or \setbox\tsplithead\vbox{\hbox{\strut\tabulateparameter\c!title}}% \fi \ifcase\tabulaterepeatfoot \setbox\tsplittail\vsplit\tsplitcontent to \lineheight \setbox\tsplittail\vbox{\vskip-\strutht\unvbox\tsplittail}% \fi \handletsplit} \def\fulltabulatecontent {\tabulateheadcontent \ifcase\tabulaterepeatfoot \tabulatetailcontent \tabulatecontent \else \tabulatecontent \tabulatetailcontent \fi \removefunnytabulateline} \protect \setupcolors[state=start] \starttext \setuptabulate [split=no, header=repeat, rulecolor=red] \starttabulatehead %\TABLEnoalign{\dotabulaterule\nobreak\vskip-\tabulateparameter{rulethickness}\nobreak} \TABLEnoalign{\dotabulaterule\nobreak} \NC Head \NC Head \NC\NR %\TABLEnoalign{\nobreak\vskip-\tabulateparameter{rulethickness}\nobreak\dotabulaterule} \TABLEnoalign{\nobreak\vskip-2\tabulateparameter{rulethickness}\nobreak\dotabulaterule} \stoptabulatehead \starttabulatetail \TABLEnoalign{\allowbreak\dotabulaterule\allowbreak} \stoptabulatetail \starttabulate[|l|l|] \dorecurse{100}{\expanded{\NC Row \hfill\recurselevel \NC Row \hfill\recurselevel \NC\NR}}% %\NC Text \NC Text \NC\NR \stoptabulate \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/44ca9eda7aaa681c0e3b3e90125c56b0.jpg?s=120&d=mm&r=g)
Hi Wolfgang, nice patch. I just looked at the comparison of the table type (http://wiki.contextgarden.net/Tables_Overview). There it says: tabulate problems: very limited Add some more stuff and we can change this to 'limited' ;) Best wishes, Peter Wolfgang Schuster schrieb:
2007/11/7, Peter Rolf
: Wolfgang Schuster schrieb:
Hi Peter,
your solution would be really a option but I hope the real bugs will be fixed, I see :)
So things could be worse. You have
- a workaround (?) - a complete minimal description/example of the problem (as starting point for Hans) - some good hints/solution for fixing
If you add some patience this all looks quite promising. ;)
Best wishes, Peter
Hi Peter,
most of the are also possible with the tabulate environment and I was able to get a nearly perfect result (a few minor spacing problems) with it.
\unprotect
\newconditional\tabulaterepeatfoot
\settrue\tabulaterepeatfoot %\setfalse\tabulaterepeatfoot
\def\dosplittabulatebox#1% {\resettsplit \def\tsplitminimumfreelines{2}% \def\tsplitminimumfreespace{0pt}% \setbox\tsplitcontent\box#1% \ifcase\tabulaterepeathead\or \setbox\tsplithead\vsplit\tsplitcontent to \lineheight \setbox\tsplithead\vbox{\unvbox\tsplithead}% \or \setbox\tsplithead\vbox{\hbox{\strut\tabulateparameter\c!title}}% \fi \ifcase\tabulaterepeatfoot \setbox\tsplittail\vsplit\tsplitcontent to \lineheight \setbox\tsplittail\vbox{\vskip-\strutht\unvbox\tsplittail}% \fi \handletsplit}
\def\fulltabulatecontent {\tabulateheadcontent \ifcase\tabulaterepeatfoot \tabulatetailcontent \tabulatecontent \else \tabulatecontent \tabulatetailcontent \fi \removefunnytabulateline}
\protect
\setupcolors[state=start]
\starttext
\setuptabulate [split=no, header=repeat, rulecolor=red]
\starttabulatehead %\TABLEnoalign{\dotabulaterule\nobreak\vskip-\tabulateparameter{rulethickness}\nobreak} \TABLEnoalign{\dotabulaterule\nobreak} \NC Head \NC Head \NC\NR %\TABLEnoalign{\nobreak\vskip-\tabulateparameter{rulethickness}\nobreak\dotabulaterule} \TABLEnoalign{\nobreak\vskip-2\tabulateparameter{rulethickness}\nobreak\dotabulaterule} \stoptabulatehead
\starttabulatetail \TABLEnoalign{\allowbreak\dotabulaterule\allowbreak} \stoptabulatetail
\starttabulate[|l|l|] \dorecurse{100}{\expanded{\NC Row \hfill\recurselevel \NC Row \hfill\recurselevel \NC\NR}}% %\NC Text \NC Text \NC\NR \stoptabulate
\stoptext
Wolfgang ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Nov 9, 2007 10:50 AM, Wolfgang Schuster
2007/11/7, Peter Rolf
: Wolfgang Schuster schrieb:
What about this ? %%%% tabulate spec \def\PRETABRULE{% %\vrule width1pt height \strutht depth \strutdp% \ifnum\tabulatecolumn=0% \rlap{\raise\strutht\hbox{\color[lightgray]{\vrule width \textwidth height 0.5pt}}}% \fi% } \def\POSTTABRULE{% %\vrule width1pt height \strutht depth \strutdp %\ifnum\tabulatecolumn=3% % \ifnum\numexpr(\totalnoftabulatelines -1-\noftabulatelines)=0% % \rlap{\lower\strutdp\hbox{\color[lightgray]{\vrule width 3cm height 0.5pt}}}% % \fi% %\fi% } \let\pretabrule \PRETABRULE \let\posttabrule\POSTTABRULE %\let\posttabrule\donothing %%%% -- luigi
participants (3)
-
luigi scarso
-
Peter Rolf
-
Wolfgang Schuster