* Table column width on spanned cells
@ 2006-04-17 11:19 nico
2006-04-17 12:32 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: nico @ 2006-04-17 11:19 UTC (permalink / raw)
Hello,
In the following example using the "nc" option, the 3 middle columns don't
fit the width option. It seems that the table tries to fit to the page
width instead.
\starttext
\bTABLE[frame=on,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
\stoptext
Regards,
BG
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Table column width on spanned cells
2006-04-17 11:19 Table column width on spanned cells nico
@ 2006-04-17 12:32 ` Hans Hagen
2006-04-17 18:32 ` nico
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2006-04-17 12:32 UTC (permalink / raw)
nico wrote:
> Hello,
>
> In the following example using the "nc" option, the 3 middle columns don't
> fit the width option. It seems that the table tries to fit to the page
> width instead.
>
> \starttext
>
> \bTABLE[frame=on,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
>
> \stoptext
>
there is probably a good reason for that (but forgot what),
\squeezeTBLspanfalse
will give you a different result; a possible patch is:
\newif\ifautosqueezeTBLspan \autosqueezeTBLspantrue % NEW
\long\def\dohandleTBLcellA#1#2[#3]#4%
{\setbox\scratchbox\hbox
{\setupTBLcell{#1}{#2}%
\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
\doifelsevalue{\@@tbl*sq}\v!no
\donefalse
{\ifautosqueezeTBLspan
\doifdimensionelse\tbltblwidth\donefalse\donetrue
\else
\donetrue
\fi}%
\ifdone
\ifnum0\number\gettblcol{#1}{#2}>1\relax \settblspn\colTBL \fi
\fi
\fi
\doifelsetblspn\colTBL
\donothing{\settblwid\colTBL{\the\wd\scratchbox}}% 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
\scratchdimen\gettblaut\colTBL\relax
\ifdim\scratchdimen=\zeropoint
\settblaut\colTBL{\the\scratchdimen}%
\else\ifdim\wd\scratchbox>\scratchdimen
\settblaut\colTBL{\the\wd\scratchbox}%
\fi\fi
\fi
\fi
\fi
\setbox2\null
\wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox
\box2}
but i'm not sure if it will not break other situations, so please do some harsh testing
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] 3+ messages in thread
* Re: Table column width on spanned cells
2006-04-17 12:32 ` Hans Hagen
@ 2006-04-17 18:32 ` nico
0 siblings, 0 replies; 3+ messages in thread
From: nico @ 2006-04-17 18:32 UTC (permalink / raw)
On Mon, 17 Apr 2006 14:32:39 +0200, Hans Hagen <pragma@wxs.nl> wrote:
> nico wrote:
>> Hello,
>>
>> In the following example using the "nc" option, the 3 middle columns
>> don't
>> fit the width option. It seems that the table tries to fit to the page
>> width instead.
>>
>> \starttext
>>
>> \bTABLE[frame=on,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
>>
>> \stoptext
>>
> there is probably a good reason for that (but forgot what),
>
> \squeezeTBLspanfalse
>
> will give you a different result;
Yes, thanks, it works fine for me.
> a possible patch is:
>
> \newif\ifautosqueezeTBLspan \autosqueezeTBLspantrue % NEW
> [...]
>
> but i'm not sure if it will not break other situations, so please do
> some harsh testing
No need for deep testing :-) Any table without a width option fails.
Example:
\bTABLE[frame=on]
\bTR \bTD A \eTD \bTD x \eTD \bTD B \eTD \eTR
\eTABLE
! Missing number, treated as zero.
<to be read again>
f
\v!fit ->f
it
\doifdimensionelse ...mensionelse \scratchdimen #1
pt\relax
<argument> ...pan \doifdimensionelse \tbltblwidth
\donefalse \donetrue
\else...
\secondoftwoarguments #1#2->#2
\handleTBLcell ... \donetrue \else \donetrue \fi }
\ifdone \ifnum 0\number
\g...
...
l.22 \eTABLE
What is the expected benefit of the patch in comparison with switching off
the squeeze stuff, since I haven't seen yet a side effect of using
\squeezeTBLspanfalse ?
Regards,
BG
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-17 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-17 11:19 Table column width on spanned cells nico
2006-04-17 12:32 ` Hans Hagen
2006-04-17 18:32 ` 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).