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
[EMAIL PROTECTED]
\else\ifenableTBLbreak
[EMAIL PROTECTED]
\else
[EMAIL PROTECTED]
\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 <[EMAIL PROTECTED]> 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
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context