[NTG-context] Problem in natural tables with nc= and alignmentcharacter

Hans Hagen pragma at wxs.nl
Wed Jun 25 10:15:17 CEST 2014


On 6/24/2014 9:53 PM, Rik Kabel wrote:
> On 2014-06-24 08:03, Hans Hagen wrote:
>> On 6/23/2014 10:50 PM, Peter Münster wrote:
>>> On Mon, Jun 23 2014, Peter Münster wrote:
>>>
>>>> No solution, just a smaller MWE:
>>>
>>> Yet smaller, but I don't know, if it's still the same problem:
>>>
>>> \starttext
>>> \bTABLE
>>> \bTR \bTD A xxxxxxxxxxxxx \eTD \bTD[nc=2] A \eTD \eTR
>>> \eTABLE
>>> \stoptext
>>
>> after lots of experiments (adapting the width guesser) i decided to
>> stick to a simple check and warning; the first column will be ok but
>> the second one to wide (btw, one solution was to set maxwidth to a
>> large value)
>>
>> catching all possible errors in coding a table is undoable (plus
>> unpredictable)
>>
>> (xtables work ok btw)
>>
>> Hans
>>
> Hans,
>
> While xtable works fine for Peter's reduced MWE, it does not handle the
> problem first presented, which includes an alignment character for
> columns of mark-separated numbers. By my understanding of how xtable
> works, I suspect that it will not be able to handle this requirement.
>
> In this case I can get by with explicitly setting column widths as
> needed to prevent the error. I have been using the following code to get
> the width of what appears to be the widest element in a column:
>
>     %% This gets the width of simple things; from Hans on the mailing
>     %%   list http://www.ntg.nl/pipermail/ntg-context/2007/024390.html
>     %%   example usage: \SetWidthOf{\ColContent}\to\ColContentWidth\relax
>     %%   or: \SetWidthOf{Column Content}\to\ContentWidth\relax
>     \def\SetWidthOf#1\to#2%
>       {\bgroup
>        \setbox\scratchbox\hbox{#1}%
>        \expanded{\egroup\def\noexpand#2{\the\wd\scratchbox}}}
>
> Is TABLE with explicit column widths the best solution for now on tables
> that require number alignment, or do you recommend another table mechanism?

you can avoid the nc triggering width distribution with

     \setupTABLE[maxwidth=100cm]

(in the case of unpredictable nc the available width is distributed and 
the xxxxxxxx doesn't break)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list