ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* TABLE: 'distance' override?
@ 2006-04-20  6:05 Johannes Graumann
  2006-04-21 20:01 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Graumann @ 2006-04-20  6:05 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]

Hello,

In my quest for tables similar to what the 'booktabs' package in LaTeX
produces, I have run into a problem: something
like '\bTABLE[distance=7.5pt]' will give me the sought for gaps in
horizontal lines, but I have trouble implementing an uninterrupted topframe
for the first and bottomframe for the last row. Is there any way of
overriding the 'distance' parameter locally, so that for example the
topframe of the first (header) row is uninterrupted, while the bottomframe
comes with the 'distance' dictated gaps? For clarification see the attached
file. While the gaps are desired for 'bottomframe' of the header row(s),
the 'topframe' should be continuous. It would be even more marvelous if I
could modify bottomframe- and topframe-rule thickness independently ... 

A recent proposal on this list to achieve the desired effect involved
putting the whole table into a frame and displaying it's top- and
bottomframe. However, that doesn't work for tables to be split over
multiple pages and I'm hunting for the most generic of all mechanisms ...

Thanks for any thoughts on this,

Joh

[-- Attachment #2: splittable.tex --]
[-- Type: text/plain, Size: 9199 bytes --]

\setupcaption[table][location=top]
% Fixing multipage table according to Hans Hagen:
\unprotect
% in core-ntb : we check the flag 
\def\splittblbox#1%
  {\ifinsidesplitfloat
     \donetrue
   \else\ifinsidefloat
     \donefalse
   \else
     \donetrue
   \fi\fi
   \ifdone
     \executeifdefined{splittblbox\tbltblsplitmethod}\splittblboxa{#1}%
   \else
     \notsplittblbox{#1}%
   \fi}
% in page-flt : we add a flag 
\newif\ifinsidesplitfloat % will become chardef
\def\dosplitfloat[#1]#2% nog dubbele refs
  {\ifinsidecolumns    % tzt ook nog figuren splitten
     % not yet supported
   \else
     \bgroup
     \insidefloattrue
     \insidesplitfloattrue
     \getparameters[\??si][#1]%
     \resetnumber[\??si]%
     \def\floatcaptionsuffix{\convertednumber[\??si]}%
     \TABLEcaptionheight\@@silines\lineheight % brrr
     \simplifypagebreak % \page becomes \goodbreak
     \dowithnextbox
       {\forgetall
        \dontcomplain
        \doloop
          {\setbox2\vsplit\nextbox to \lineheight
           \setbox2\vbox{\unvbox2}
           \ifdim\ht2>\lineheight
             \incrementnumber[\??si]%
             \ifcase\rawnumber[\??si]\or \ifdim\nextboxht=\zeropoint
               \let\floatcaptionsuffix\empty
             \fi \fi
             \bgroup
             #2{\unvbox2}
             \egroup
             \ifdim\nextboxht>\zeropoint
               \page
               \decrementnumber[\floatcaptionnumber]%
             \fi
           \fi
           \ifdim\nextboxht>\zeropoint\else
             \expandafter\exitloop
           \fi}%
        \egroup}
     \vbox
   \fi}
\protect
% beware: you need to set the splitmethod to b (boxed split) 

\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.90pt,topframe=on]
        \setupTABLE[row][-1][rulethickness=0.90pt,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=off,rulethickness=0.3pt]
  {\expanded{\bTR[bottomframe=\XMLop{bottomframe},rulethickness=\XMLop{rulethickness}]}}
  {\eTR}

\defineXMLnested
  [td]
  [rows=1,cols=1]
  {\expanded{\bTD[nr=\XMLop{rows},nc=\XMLop{cols}]}}
  {\par\eTD}

\starttext
  \startXMLdata
    <splittable>
      <caption>
        FFFFFFFFFFFFF FF FFFFFFFFFFFFFFFFF FFFFFFFF FFFFF FFFFFFFFF FFFFFFFFF FFFFFFFF FFFF FF FFFFFFFFFF FFFFFFF FFFF FFFFFFFF FFF FFFFFFFF FF FFFFFFFFF FF FFFFFFF FFFFFFFF FFFFFFFFFFFFFFFF FFFFFF FFFFFFFF FFFFFFFFFFFF FFFFFFFFFF FFF FFFF FF FFF FFFF FFFFFFF FFFFFFFFF FFF FFFFF FF FFFFFFFF FFFF FFFFF FFFFFFFFF FF FFFFF  FFFF FFF FFFF FFFFFFFFFFFFFFF  FFFFFFFFF FFFFF FFFFFFFFFFF FFFFFFFF FFFFFFFFFFFFF FF FFFFFFFFFFFFFFFFF FFFFFFF FFFFFFFF FFF FFFFFFFF FFF FFFFFFFF FFFFFFFFF FFFFFF FFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFF FFFFFFFFF FFFF FFFFFFF FF FFFFF FFF FFFFFFFFFFF FFFFF FFF FFFFFF F.
      </caption>
      <header>
        <tr bottomframe="on"><td rows="2">YYY</td><td cols="3">YYY</td><td rows="2">YYY</td><td rows="2">YYY</td><td rows="2">YYY</td></tr><tr bottomframe="on"><td>YYY</td><td>YYY</td><td>YYY</td></tr>
      </header>
      <body>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
        <tr><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td><td>XXX</td></tr>
      </body>
    </splittable>
  \stopXMLdata
\stoptext

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

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

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

* Re: TABLE: 'distance' override?
  2006-04-20  6:05 TABLE: 'distance' override? Johannes Graumann
@ 2006-04-21 20:01 ` Hans Hagen
  2006-04-21 22:17   ` Johannes Graumann
  2006-04-23 16:58   ` Johannes Graumann
  0 siblings, 2 replies; 6+ messages in thread
From: Hans Hagen @ 2006-04-21 20:01 UTC (permalink / raw)


Johannes Graumann wrote:
> Hello,
>
> In my quest for tables similar to what the 'booktabs' package in LaTeX
>   
what does booktab do then 

Hans 

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

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

* Re: TABLE: 'distance' override?
  2006-04-21 20:01 ` Hans Hagen
@ 2006-04-21 22:17   ` Johannes Graumann
  2006-04-23 16:58   ` Johannes Graumann
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Graumann @ 2006-04-21 22:17 UTC (permalink / raw)


Hans Hagen wrote:

> what does booktab do then
> 
Have a look at
http://www.idyll.org:8081/JohSite/context/table1.jpg/view

I write there:

> A table formated with the package 'booktabs' in LaTeX. Notice the heavier,
> continuous '\toprule' and '\bottomrule' as well as the lighter and 
> interrupted lines seperating table-header and table body. Notice as well,
> that the table rules ar flush on the left and right with the table 
> entries.  

I had emulated the continuous top- and bottomrule (while using 'distance'
for the others) with a frame around the whole thing, but that prevents the
table from being splitable ...

I have not come across any ConTeXt solution yet making the rules on the left
and right edge of the table flush with the Text.

Joh

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

* Re: TABLE: 'distance' override?
  2006-04-21 20:01 ` Hans Hagen
  2006-04-21 22:17   ` Johannes Graumann
@ 2006-04-23 16:58   ` Johannes Graumann
  2006-04-23 18:36     ` Hans Hagen
  2006-04-23 18:37     ` Hans Hagen
  1 sibling, 2 replies; 6+ messages in thread
From: Johannes Graumann @ 2006-04-23 16:58 UTC (permalink / raw)


After sleeping on this I realize that a more mechanistical answer to this 
may be more interesting.
When coding a table in LaTeX with 'booktabs' as the one shown in
http://www.idyll.org:8081/JohSite/context/table1.jpg/view, booktabs mainly
provides the commands '\bottomrule' and '\toprule', creating the heavier
start and end lines. The interrupted lines separating the table header from
the table body are coded explicitly (with a command I'm not sure is even
provided by 'booktabs'): '\cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(l
{3-3}' for a three-columned table. Bottomline is that while with the
distance solution in ConTeXt natural TABLEs the whole table is modified, a
solution like this only modifies the horizontal line targeted - and that
very flexible: the firs '\cmidrule' call anly shortens the rule on the
right ('(r)'), the second one on both sides ('(lr)') and the last one on
the left ('(l)').

In order to emulate my table style with TABLE there would be 4 things
necessary:
1) possibility to have top- and bottomframe formated independently
(different width - top heavy, bottom light; one continuous, one interrupted
(see 2.))
2) a new frame mode ('int'?) which interrupts a 'bottomframe=int' between
table columns with an automatism recognizing whether this is the first or
last column and only shortening the line on the right or left respectively.
3) Booktabs also provides an '\addlinespace' command for groupseparation ...
see separation between first and second body line in
http://www.idyll.org:8081/JohSite/context/table1.jpg/view
4) When defining tables in LaTeX, a definition like \tabular{@{}lll@{}}
yields horizontal lines terminating on the left and right flush with the
table content and not reaching to a column separation border beyond that.

If you wonder where I got all theses crazy ideas ;0):
http://www.tug.org/tex-archive/info/german/tabsatz/tabsatz.pdf by Axel
Reichert is the inspiring document (sorry - German only).

I'm not asking for this to be implemented, but I believe ConTeXt would
benefit from this.

Joh


Hans Hagen wrote:

> Johannes Graumann wrote:
>> Hello,
>>
>> In my quest for tables similar to what the 'booktabs' package in LaTeX
>>   
> what does booktab do then
> 
> Hans
> 
> -----------------------------------------------------------------
>                                           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
> -----------------------------------------------------------------

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

* Re: TABLE: 'distance' override?
  2006-04-23 16:58   ` Johannes Graumann
@ 2006-04-23 18:36     ` Hans Hagen
  2006-04-23 18:37     ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2006-04-23 18:36 UTC (permalink / raw)


Johannes Graumann wrote:
> When coding a table in LaTeX with 'booktabs' as the one shown in
> http://www.idyll.org:8081/JohSite/context/table1.jpg/view, booktabs mainly
>   
but that's a typical example of a \begintable ... \endtable kind of table

(a quick hack into TABLE is to use backgrounds drawn by mp (which is 
what we do when we need to make real fancy ones with shaded and colors 
and whatever)

Hans

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

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

* Re: TABLE: 'distance' override?
  2006-04-23 16:58   ` Johannes Graumann
  2006-04-23 18:36     ` Hans Hagen
@ 2006-04-23 18:37     ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2006-04-23 18:37 UTC (permalink / raw)


Johannes Graumann wrote:
> 1) possibility to have top- and bottomframe formated independently
> (different width - top heavy, bottom light; one continuous, one interrupted
> (see 2.))
>   
maybe in the future, when we have a bigger tex (would slow down the core 
\framed to much and as a result many other aspects of context)

Hans

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

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

end of thread, other threads:[~2006-04-23 18:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-20  6:05 TABLE: 'distance' override? Johannes Graumann
2006-04-21 20:01 ` Hans Hagen
2006-04-21 22:17   ` Johannes Graumann
2006-04-23 16:58   ` Johannes Graumann
2006-04-23 18:36     ` Hans Hagen
2006-04-23 18:37     ` Hans Hagen

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