ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* table layout
@ 2007-11-06 11:56 Wolfgang Schuster
  2007-11-06 13:36 ` Peter Rolf
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-11-06 11:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4323 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 5460 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

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

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

end of thread, other threads:[~2007-11-09 14:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-06 11:56 table layout Wolfgang Schuster
2007-11-06 13:36 ` Peter Rolf
2007-11-07 11:53   ` Wolfgang Schuster
2007-11-07 14:34     ` Peter Rolf
2007-11-07 16:08       ` Wolfgang Schuster
2007-11-09  9:50       ` Wolfgang Schuster
2007-11-09 12:55         ` Peter Rolf
2007-11-09 14:10         ` luigi scarso

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