ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: table layout
Date: Tue, 06 Nov 2007 14:36:52 +0100	[thread overview]
Message-ID: <47306DF4.9070606@gmx.net> (raw)
In-Reply-To: <115224fb0711060356q2010a496h304cd417a9ee5c31@mail.gmail.com>

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

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


  reply	other threads:[~2007-11-06 13:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-06 11:56 Wolfgang Schuster
2007-11-06 13:36 ` Peter Rolf [this message]
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

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=47306DF4.9070606@gmx.net \
    --to=indiego@gmx.net \
    --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).