ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Table width trouble
@ 2006-04-22 23:29 nico
  2006-04-23 16:28 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: nico @ 2006-04-22 23:29 UTC (permalink / raw)


Hello,

I come back with that damn table test case. With release 2006.04.22:

- it works fine when the column width is passed as table option,
- it's wrong when the width is passed via a column setup only,
- it works ok when both table and column option are passed, and it's the  
column option that is used (which is the expected behaviour).
- it's ok when no width specified at all.

\starttext

\startbuffer
\bTR \bTD[nc=2] A \eTD\bTD x \eTD \bTD[nc=2] B \eTD \eTR
\bTR \bTD X \eTD \bTD[nc=3] C \eTD \bTD x \eTD \eTR
\bTR \bTD[nc=2] D \eTD \bTD x \eTD \bTD[nc=2] E \eTD \eTR
\stopbuffer

% ok
\bTABLE[frame=on,width=3em]
\getbuffer
\eTABLE

% nok, messy table
\bTABLE[frame=on]
\setupTABLE[c][each][width=3em]
\getbuffer
\eTABLE

% ok, width=3em for each column
\bTABLE[frame=on,width=0.1pt]
\setupTABLE[c][each][width=3em]
\getbuffer
\eTABLE

% ok
\bTABLE[frame=on]
\getbuffer
\eTABLE

\stoptext


Regards,
BG

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

* Re: Table width trouble
  2006-04-22 23:29 Table width trouble nico
@ 2006-04-23 16:28 ` Hans Hagen
  2006-04-23 22:49   ` nico
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2006-04-23 16:28 UTC (permalink / raw)


nico wrote:
> Hello,
>
> I come back with that damn table test case. With release 2006.04.22:
>
> - it works fine when the column width is passed as table option,
> - it's wrong when the width is passed via a column setup only,
> - it works ok when both table and column option are passed, and it's the  
> column option that is used (which is the expected behaviour).
> - it's ok when no width specified at all.
>
> \starttext
>
> \startbuffer
> \bTR \bTD[nc=2] A \eTD\bTD x \eTD \bTD[nc=2] B \eTD \eTR
> \bTR \bTD X \eTD \bTD[nc=3] C \eTD \bTD x \eTD \eTR
> \bTR \bTD[nc=2] D \eTD \bTD x \eTD \bTD[nc=2] E \eTD \eTR
> \stopbuffer
>
> % ok
> \bTABLE[frame=on,width=3em]
> \getbuffer
> \eTABLE
>
> % nok, messy table
> \bTABLE[frame=on]
> \setupTABLE[c][each][width=3em]
> \getbuffer
> \eTABLE
>
> % ok, width=3em for each column
> \bTABLE[frame=on,width=0.1pt]
> \setupTABLE[c][each][width=3em]
> \getbuffer
> \eTABLE
>
> % ok
> \bTABLE[frame=on]
> \getbuffer
> \eTABLE
>
> \stoptext
>
>   
\long\def\dohandleTBLcellA#1#2[#3]#4%
  {\bgroup
   \setupTBLcell{#1}{#2}%
   \setbox\scratchbox\hbox
     {\scratchdimen\tbltbldistance\relax
      \ifdim\scratchdimen>\gettbldis{#2}\relax
        \settbldis{#2}{\the\scratchdimen}%
      \fi
      \localframed
        [\@@tbl\@@tbl]
        [#3,\c!background=,\c!frame=\v!off]% 25% faster
        {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}%
   \scratchdimen\gettblwid\colTBL\relax
   \ifdim\wd\scratchbox>\scratchdimen
     \ifsqueezeTBLspan
       \ifautosqueezeTBLspan
         \doifinsetelse\tbltblwidth{\v!fit,\v!fixed,\v!broad,\v!local}
           \donetrue \donefalse
       \else
         \donetrue
       \fi
       \ifdone
         \ifnum0\number\gettblcol{#1}{#2}>1\relax \settblspn\colTBL \fi
       \fi
     \fi
     \doifelsetblspn\colTBL
       \donothing
       {\ifdim\gettblwid\colTBL<\wd\scratchbox
          \settblwid\colTBL{\the\wd\scratchbox}%
        \fi}% auto set
   \fi
   \let\rowTBLx\rowTBL\increment\rowTBLx
   \scratchdimen\gettblhei\rowTBLx\relax
   \ifdim\ht\scratchbox<\scratchdimen
     \settblhei\rowTBLx{\the\ht\scratchbox}% auto set
   \fi
   \settblht{#1}{#2}{\the\ht\scratchbox}%
   \settblwd{#1}{#2}{\the\wd\scratchbox}%
   \ifautoTBLcheckwidth
     \ifdim\wd\scratchbox<.75\hsize
       \ifdim\ht\scratchbox>2\openlineheight % honor width since this
         \scratchdimen\gettblaut\colTBL\relax % can be a figure or so
         \ifdim\scratchdimen=\zeropoint
           % side effect: when width is set to 0pt,
           % we can force a span that fits the sum of spans widths
           \settblaut\colTBL{\the\scratchdimen}%
         \else\ifdim\wd\scratchbox>\scratchdimen
           % unless span
           \settblaut\colTBL{\the\wd\scratchbox}%
           % to be translated
           \writestatus\m!TABLE
             {no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}%
         \fi\fi
       \fi
     \fi
   \fi
   \setbox2\null
   \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox
   \box2
   \egroup}


-----------------------------------------------------------------
                                          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] 5+ messages in thread

* Re: Table width trouble
  2006-04-23 16:28 ` Hans Hagen
@ 2006-04-23 22:49   ` nico
  2006-04-25 22:11     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: nico @ 2006-04-23 22:49 UTC (permalink / raw)


On Sun, 23 Apr 2006 18:28:20 +0200, Hans Hagen <pragma@wxs.nl> wrote:

> nico wrote:
>> Hello,
>>
>> I come back with that damn table test case. With release 2006.04.22:  
>> [...]
>>
>>
> \long\def\dohandleTBLcellA#1#2[#3]#4%

Thanks, it does it. Another torture case: when column widths are partially  
defined, it can give a weird result (here the last column has almost  
disppeared). Since it's a limit case, I don't know if it's worth being  
fixed.

\bTABLE[frame=on]
\setupTABLE[c][2][width=3em]
\setupTABLE[c][3][width=3em]
\bTR \bTD[nc=2] A \eTD\bTD x \eTD \bTD[nc=2] B \eTD \eTR
\bTR \bTD X \eTD \bTD[nc=3] C \eTD \bTD x \eTD \eTR
\bTR \bTD[nc=2] D \eTD \bTD x \eTD \bTD[nc=2] E \eTD \eTR
\eTABLE

Regards,
BG

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

* Re: Table width trouble
  2006-04-23 22:49   ` nico
@ 2006-04-25 22:11     ` Hans Hagen
  2006-04-26 19:39       ` nico
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2006-04-25 22:11 UTC (permalink / raw)


nico wrote:
> On Sun, 23 Apr 2006 18:28:20 +0200, Hans Hagen <pragma@wxs.nl> wrote:
>
>   
>> nico wrote:
>>     
>>> Hello,
>>>
>>> I come back with that damn table test case. With release 2006.04.22:  
>>> [...]
>>>
>>>
>>>       
>> \long\def\dohandleTBLcellA#1#2[#3]#4%
>>     
>
> Thanks, it does it. Another torture case: when column widths are partially  
> defined, it can give a weird result (here the last column has almost  
> disppeared). Since it's a limit case, I don't know if it's worth being  
> fixed.
>
> \bTABLE[frame=on]
> \setupTABLE[c][2][width=3em]
> \setupTABLE[c][3][width=3em]
> \bTR \bTD[nc=2] A \eTD\bTD x \eTD \bTD[nc=2] B \eTD \eTR
> \bTR \bTD X \eTD \bTD[nc=3] C \eTD \bTD x \eTD \eTR
> \bTR \bTD[nc=2] D \eTD \bTD x \eTD \bTD[nc=2] E \eTD \eTR
> \eTABLE
>   
indeed a strange case 

the best is to collect them so that i can look into them some rainy day 

(btw, if users have interesting example tables that demo something not in ennatab, then we can add them there) 

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] 5+ messages in thread

* Re: Table width trouble
  2006-04-25 22:11     ` Hans Hagen
@ 2006-04-26 19:39       ` nico
  0 siblings, 0 replies; 5+ messages in thread
From: nico @ 2006-04-26 19:39 UTC (permalink / raw)


On Wed, 26 Apr 2006 00:11:56 +0200, Hans Hagen <pragma@wxs.nl> wrote:

> nico wrote:
>> On Sun, 23 Apr 2006 18:28:20 +0200, Hans Hagen <pragma@wxs.nl> wrote:
>>
>>
>>> nico wrote:
>>>
>>>> Hello,
>>>>
>>>> I come back with that damn table test case. With release 2006.04.22:
>>>> [...]
>>>>
>>>>
>>>>
>>> \long\def\dohandleTBLcellA#1#2[#3]#4%
>>>
>>
>> Thanks, it does it. Another torture case: when column widths are  
>> partially
>> defined, it can give a weird result (here the last column has almost
>> disppeared). Since it's a limit case, I don't know if it's worth being
>> fixed.
>>
> indeed a strange case
>
> the best is to collect them so that i can look into them some rainy day
>
> (btw, if users have interesting example tables that demo something not  
> in ennatab, then we can add them there)

I haven't ready-to-add tables, but maybe the following topics could be  
added (unless you want to let them to wiki):
- use of \bTABLEhead..\eTABLEhead \bTABLEbody..\eTABLEbody and  
split=repeat,
- use of the options distance, leftmargindistance, etc,
- use of negative column/row values (not in the wiki).

Regards,
BG

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

end of thread, other threads:[~2006-04-26 19:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-22 23:29 Table width trouble nico
2006-04-23 16:28 ` Hans Hagen
2006-04-23 22:49   ` nico
2006-04-25 22:11     ` Hans Hagen
2006-04-26 19:39       ` nico

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