ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [Fwd: Re: Problems with Natural Tables]
@ 2005-10-25  9:39 Vit Zyka
  2005-11-06 10:55 ` Problems with Natural Tables Vit Zyka
  0 siblings, 1 reply; 4+ messages in thread
From: Vit Zyka @ 2005-10-25  9:39 UTC (permalink / raw)


Hello Hans,

(I guess you are the only person who can specify your previous answer),
so please, is the file 'core-ntb-new.tex' somewhere available?

Actually what I want. I have plenty of natural tables. If I want to make 
closer interline space between table lines the only way I know is to 
make smaller value of offset param. But after that, columns are too 
close together (framed object as a core of natural table does not 
distinguish between vertical and horizontal offsets). So bellow mentioned
   \setupTABLE[c][1][distance=2em]
would be nice solution.

So ones more, is the new code available?

Thank you in advance for the answer.
Vit

Hans Hagen wrote:
> Adam Duck wrote:
> 
>> Eckhart Guthöhrlein <eckhart.guthoehrlein@uni-bielefeld.de> writes:
>>
>>  
>>
>>> Am Sonntag, den 14.08.2005, 17:17 +0200 schrieb Adam Duck:
>>>
>>>   
>>>
>>>> - how do I set the spacing between a vertical line (between two
>>>>  columns) and the text inside that columns?  I already used
>>>>  "framedoffest=-3pt", but the output is unacceptable.
>>>>     
>>>
>>> Spacing is a weak point of natural tables. Afaik, there is no good way
>>> to tune spacing. I would try using dummy colums like
>>> \bTD[width=1em]\eTD.
>>>   
>>
>> OK, That sounds reasonable.  I'll try that.  On the other hand this
>> means many \bTD<something>\eTD ... but one can write a macro for that,
>> I think.
>>  
>>
> a next release will support:
> \input core-ntb-new.tex
> 
> \starttext
> 
> \showframe
> 
> \setupTABLE[c][1][distance=2em]
> \setupTABLE[c][2][distance=3em]

I was looking for core-ntb-new.tex or 'distance' in current beta
core-ntb.tex but have not been successful. Please, where I can find it?

Thanks
Vit

> \bTABLE
> \bTR \bTD test \eTD  \bTD test \eTD  \bTD test \eTD \eTR
> \bTR \bTD[nx=2] test \eTD  \bTD test \eTD \eTR
> \bTR \bTD test \eTD  \bTD[nx=2] test \eTD \eTR
> \eTABLE
> 
> 
> \bTABLE[option=stretch]
> \bTR \bTD test \eTD  \bTD test \eTD  \bTD test \eTD \eTR
> \bTR \bTD[nx=2] test \eTD  \bTD test \eTD \eTR
> \bTR \bTD test \eTD  \bTD[nx=2] test \eTD \eTR
> \eTABLE
> 
> \stoptext

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

* Re: Problems with Natural Tables
  2005-10-25  9:39 [Fwd: Re: Problems with Natural Tables] Vit Zyka
@ 2005-11-06 10:55 ` Vit Zyka
  2005-11-09 12:18   ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Vit Zyka @ 2005-11-06 10:55 UTC (permalink / raw)


Vit Zyka wrote:
 > ...
> so please, is the file 'core-ntb-new.tex' somewhere available?

Solution of my own question, for who is interesting.

Description:
The next patch enables to define intercolumn gaps in Natural Table 
(bTABLE...eTABLE) environment.

Features:
- one can distinguish the amounts of first (colsepfirst), inner 
(colsepbetween), and last (colseplast) gaps.
- patch operates for both 'fit' or 'stretch' table options.
- gaps has no 'background' you have to use external one.

Example:
http://typokvitek.com/tmp/nattab-colskip.pdf

Usage:
\bTABLE[colsepbetween=2cm,colsepfirst=.3cm,colseplast=.5cm]
   \bTR
     \bTD A\eTD    \bTD B\eTD    \bTD C\eTD
   \eTR
\eTABLE

Enjoy it,
vit

Patch:
-----------------------------------------------
% suppressing spurious space from setupTABLE
\let\DosetupTABLE=\setupTABLE
\def\setupTABLE[#1][#2][#3]{\DosetupTABLE[#1][#2][#3]\ignorespaces}

% new bTABLE options <dimen>: colsepbetween, colsepfirst, colseplast
\def\nexttblcol
   {\doglobal\increment\colTBL\hskip\tbltblcolsepbetween\hbox{}&} % VZ

\def\begintblrow
   {\noalign
      {\doglobal\increment\rowTBL
       \doglobal\newcounter\colTBL}%
    \nexttblcol
    \hskip\tbltblcolsepfirst\hskip-\tbltblcolsepbetween} % VZ

\unprotected\def\endtblrow
   {\hskip-\tbltblcolsepbetween\hskip\tbltblcolseplast\hbox{}% VZ
    \crcr
    \noalign
      {\nointerlineskip
       \allowbreak
       \bgroup % protect local vars
         \@@tblsplitafter
       \egroup
       \bgroup % protect local vars
         \increment\rowTBL\relax
         \ifnum\rowTBL>\noftblhdnxlines\relax
           \ifnum\rowTBL<\maximumrow\relax
 
\doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}%
           \fi
         \fi
       \egroup}}

\unprotected\def\endTBL
   {\appendtoks
      \endtbl
    \to\tbltoks
    \setbox\scratchbox\hbox
      {\localframed
         [\@@tbl\@@tbl]
         [\c!frame=\v!off,\c!background=,\c!align=\v!no]
         {\strut}}%
    \edef\minimalcellheight{\the\ht\scratchbox}%
    \dorecurse\maximumcol
      {\settblaut\recurselevel\!!zeropoint % \zeropoint etc
       % new
       \let\xcol\recurselevel
       \dorecurse\maximumrow
         {\settblwd \recurselevel\xcol\!!zeropoint
          \settblht \recurselevel\xcol\!!zeropoint}%
       % till here
       \settblwid\recurselevel\!!zeropoint}%
    \dorecurse\maximumrow
      {\settblhei\recurselevel\maxdimen}%
    \chardef\TBLpass\plusone
    \let\handleTBLcell\dohandleTBLcellA
    \def\makeTBL##1##2%
      {\gettbltxt{##1}{##2}}%
    \def\inTBLcell##1##2%
      {\ExpandBothAfter\doifinsetelse\localwidth{\v!fit,\v!broad} % user set
         {}
         {\scratchdimen\gettblaut\colTBL\relax
          \ifdim\localwidth>\scratchdimen
            \settblaut\colTBL\localwidth
          \fi}}%
    \setbox0\vbox{\trialtypesettingtrue \the\tbltoks}%
    \ifautoTBLspread
      % experimental, stretch non fixed cells to \hsize
      \checktblwidthsone   % trial run
      \checktblwidthstwo   % real run
      \stretchtblwidths
      \let\handleTBLcell\dohandleTBLcellB
      \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}%
    \else\ifdim\wd0>\hsize
      \ifautoTBLhsize
        \checktblwidthsone % trial run
        \checktblwidthstwo % real run
        \let\handleTBLcell\dohandleTBLcellB
        \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}%
      \fi
    \else\ifautoTBLrowspan\ifnum\maximumrowspan>1 % max ?
      % added jan 2002 because nx=* did no longer work
      \checktblwidthsone % trial run
      \checktblwidthstwo % real run
      %
      \let\handleTBLcell\dohandleTBLcellC
      \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}%
    \fi\fi\fi\fi
    \let\handleTBLcell\dohandleTBLcellD
    \chardef\TBLpass\plustwo
    \def\makeTBL##1##2% meer in cellD
      {\dimen2\zeropoint
       \globalpushmacro\colTBL
       \dorecurse{\gettblcol{##1}{##2}}
         {\advance\dimen2 \gettblwid\colTBL
          \advance\dimen2 \tbltblcolsepbetween % VZ
          \increment\colTBL}%
       \advance\dimen2 -\tbltblcolsepbetween % VZ
       \edef\widthTBL{\the\dimen2}%
       \globalpopmacro\colTBL
       \setbox\scratchbox\hbox{\gettbltxt{##1}{##2}}%
       \settblht{##1}{##2}{\the\ht\scratchbox}%
       \settblwd{##1}{##2}{\the\wd\scratchbox}%
       \ifdim\ht\scratchbox>\gettblhei{##1}\relax
         \settblhei{##1}{\the\ht\scratchbox}%
       \fi}%
    \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}%
    \checktblheightsone
    \checktblheightstwo
    \let\handleTBLcell\dohandleTBLcellE
    \chardef\TBLpass\plusthree
    \def\makeTBL##1##2%
      {% height
       \globalpushmacro\rowTBL
       \scratchdimen\zeropoint
       \def\rowTBL{##1}%
       \ifnum\gettblcol{##1}{##2}=\maximumcol\relax
         % case: nc=maxcolumns
       \else
         \dorecurse{\gettblrow{##1}{##2}}
           {\advance\scratchdimen \gettblhei\rowTBL
            \increment\rowTBL}%
         \ifdim\scratchdimen<\gettblht{##1}{##2}\relax
           \scratchdimen\gettblht{##1}{##2}\relax
         \fi
       \fi
       \edef\heightTBL{\the\scratchdimen}%
       \globalpopmacro\rowTBL
       % width
       \globalpushmacro\colTBL
       \scratchdimen\zeropoint
       \dorecurse{\gettblcol{##1}{##2}}
         {\advance\scratchdimen \gettblwid\colTBL
          \advance\scratchdimen \tbltblcolsepbetween % VZ
          \increment\colTBL}%
       \advance\scratchdimen -\tbltblcolsepbetween % VZ
       \edef\widthTBL{\the\scratchdimen}%
       \globalpopmacro\colTBL
       % cell
       \setbox\scratchbox\hbox{\gettbltxt{##1}{##2}}%
       \ifnum\gettblcol{##1}{##2}=\maximumcol\relax
         % case: nc=maxcolumns
       \else
         \scratchdimen\gettblhei{##1}%
         \setbox\scratchbox\hbox
           {\lower\ht\scratchbox\hbox{\raise\scratchdimen\box\scratchbox}}%
         \ht\scratchbox\scratchdimen
       \fi
       \dp\scratchbox\zeropoint
       \box\scratchbox}%
     \iftraceTABLE\showtbltoks\fi
     \ifnum\TBLlevel>\plusone
       \@EA\notsplittblbox
     \else\ifenableTBLbreak
       \@EAEAEA\splittblbox
     \else
       \@EAEAEA\notsplittblbox
     \fi\fi{\the\tbltoks}}

\unprotected\def\stretchtblwidths
   {\!!dimend\zeropoint
    \dorecurse\maximumcol
      {\advance\!!dimend\gettblwid\recurselevel
       \advance\!!dimend\tbltblcolsepbetween}% VZ
    \advance\!!dimend-\tbltblcolsepbetween   % VZ
    \advance\!!dimend\tbltblcolsepfirst      % VZ
    \advance\!!dimend\tbltblcolseplast       % VZ
    % distribute width (stretch)
    \ifdim\!!dimend<\hsize
      \advance\!!dimend-\hsize
      \!!dimend-\!!dimend
      \divide\!!dimend\maximumcol
      \dorecurse\maximumcol
        {\scratchdimen\gettblwid\recurselevel
         \advance\scratchdimen\!!dimend
         \settblwid\recurselevel{\the\scratchdimen}}%
    \fi}

\let\tbltblcolsepbetween\zeropoint
\let\tbltblcolsepfirst\zeropoint
\let\tbltblcolseplast\zeropoint
-----------------------------------------------------------

Old emails:
> Actually what I want. I have plenty of natural tables. If I want to make 
> closer interline space between table lines the only way I know is to 
> make smaller value of offset param. But after that, columns are too 
> close together (framed object as a core of natural table does not 
> distinguish between vertical and horizontal offsets). So bellow mentioned
>   \setupTABLE[c][1][distance=2em]
> would be nice solution.
> 
> So ones more, is the new code available?
> 
> Thank you in advance for the answer.
> Vit
> 
> Hans Hagen wrote:
> 
>> Adam Duck wrote:
>>
>>> Eckhart Guthöhrlein <eckhart.guthoehrlein@uni-bielefeld.de> writes:
>>>
>>>  
>>>
>>>> Am Sonntag, den 14.08.2005, 17:17 +0200 schrieb Adam Duck:
>>>>
>>>>  
>>>>
>>>>> - how do I set the spacing between a vertical line (between two
>>>>>  columns) and the text inside that columns?  I already used
>>>>>  "framedoffest=-3pt", but the output is unacceptable.
>>>>>     
>>>>
>>>>
>>>> Spacing is a weak point of natural tables. Afaik, there is no good way
>>>> to tune spacing. I would try using dummy colums like
>>>> \bTD[width=1em]\eTD.
>>>>   
>>>
>>>
>>> OK, That sounds reasonable.  I'll try that.  On the other hand this
>>> means many \bTD<something>\eTD ... but one can write a macro for that,
>>> I think.
>>>  
>>>
>> a next release will support:
>> \input core-ntb-new.tex
>>
>> \starttext
>>
>> \showframe
>>
>> \setupTABLE[c][1][distance=2em]
>> \setupTABLE[c][2][distance=3em]
> 
> 
> I was looking for core-ntb-new.tex or 'distance' in current beta
> core-ntb.tex but have not been successful. Please, where I can find it?
> 
> Thanks
> Vit
> 
>> \bTABLE
>> \bTR \bTD test \eTD  \bTD test \eTD  \bTD test \eTD \eTR
>> \bTR \bTD[nx=2] test \eTD  \bTD test \eTD \eTR
>> \bTR \bTD test \eTD  \bTD[nx=2] test \eTD \eTR
>> \eTABLE
>>
>>
>> \bTABLE[option=stretch]
>> \bTR \bTD test \eTD  \bTD test \eTD  \bTD test \eTD \eTR
>> \bTR \bTD[nx=2] test \eTD  \bTD test \eTD \eTR
>> \bTR \bTD test \eTD  \bTD[nx=2] test \eTD \eTR
>> \eTABLE
>>
>> \stoptext

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

* Re: Problems with Natural Tables
  2005-11-06 10:55 ` Problems with Natural Tables Vit Zyka
@ 2005-11-09 12:18   ` Hans Hagen
  2005-11-09 14:38     ` Vit Zyka
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2005-11-09 12:18 UTC (permalink / raw)


Vit Zyka wrote:

> Vit Zyka wrote:
> > ...
>
>> so please, is the file 'core-ntb-new.tex' somewhere available?
>
i merged the 'core-ntb-new.tex' code into the main file

> Solution of my own question, for who is interesting.
>
> Description:
> The next patch enables to define intercolumn gaps in Natural Table 
> (bTABLE...eTABLE) environment.


I added your patches, but renamed the keys:

\starttext

% distance mechanism, per column (H)

\start
    \setupTABLE[c][1][distance=2em]
    \setupTABLE[c][2][distance=3em]

    \bTABLE
    \bTR \bTD test \eTD  \bTD test \eTD  \bTD test \eTD \eTR
    \bTR \bTD[nx=2] test \eTD  \bTD test \eTD \eTR
    \bTR \bTD test \eTD  \bTD[nx=2] test \eTD \eTR
    \eTABLE

    \bTABLE[option=stretch]
    \bTR \bTD test \eTD  \bTD test \eTD  \bTD test \eTD \eTR
    \bTR \bTD[nx=2] test \eTD  \bTD test \eTD \eTR
    \bTR \bTD test \eTD  \bTD[nx=2] test \eTD \eTR
    \eTABLE
\stop

% distance mechanism, per table (V)

\framed[offset=none]{%
\setupTABLE[column][2][align=left]
\setupTABLE[column][3][align=right]
\bTABLE[columndistance=2cm,leftmargindistance=.3cm,rightmargindistance=.5cm]
  \bTR
    \bTH[nc=3] Table head\eTH
  \eTR
  \bTR\bTD[nc=2] AB\eTD\bTD C\eTD\eTR
  \bTR\bTD[nc=2,align=left] AB\eTD\bTD C\eTD\eTR
  \bTR\bTD[nc=2,align=middle] AB\eTD\bTD C\eTD\eTR
  \bTR\bTD A\eTD\bTD B\eTD\bTD C\eTD\eTR
  \bTR\bTD Aa\eTD\bTD Bb\eTD\bTD Cccc\eTD\eTR
  \bTR\bTD[nc=3,align=middle] ABC\eTD\eTR
\eTABLE
}

\stoptext

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

* Re: Problems with Natural Tables
  2005-11-09 12:18   ` Hans Hagen
@ 2005-11-09 14:38     ` Vit Zyka
  0 siblings, 0 replies; 4+ messages in thread
From: Vit Zyka @ 2005-11-09 14:38 UTC (permalink / raw)


Hans Hagen wrote:
> Vit Zyka wrote:
> 
>> Vit Zyka wrote:
>> > ...
>>
>>> so please, is the file 'core-ntb-new.tex' somewhere available?
>>
>>
> i merged the 'core-ntb-new.tex' code into the main file
> 
>> Solution of my own question, for who is interesting.
>>
>> Description:
>> The next patch enables to define intercolumn gaps in Natural Table 
>> (bTABLE...eTABLE) environment.
> 
> 
> 
> I added your patches, but renamed the keys:

Thanks, renaming makes sence.
vit

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-25  9:39 [Fwd: Re: Problems with Natural Tables] Vit Zyka
2005-11-06 10:55 ` Problems with Natural Tables Vit Zyka
2005-11-09 12:18   ` Hans Hagen
2005-11-09 14:38     ` Vit Zyka

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