ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problem in natural tables with nc= and alignmentcharacter
@ 2014-06-23 19:03 Rik Kabel
  2014-06-23 19:43 ` Rik Kabel
  2014-06-23 20:34 ` Peter Münster
  0 siblings, 2 replies; 7+ messages in thread
From: Rik Kabel @ 2014-06-23 19:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1152 bytes --]

When a wide-ish column precedes a character-aligned column and a column 
span is in place, the table is set improperly.

With the following example, the first two columns overlap.

When the first column is moved to the right side of the table there is 
no issue.

When the setup line is removed, there is no issue.

When the long entry in column is shortened, there is no issue.

When the column span is removed and another cell added to that row, 
there is no issue.

The problem occurs when the span is applied to the first two or the last 
two columns in the example.

TL14 handles this correctly. It fails with the 20140622 beta.

    \starttext
       \bTABLE
    \setupTABLE[c][3][alignmentcharacter={.},aligncharacter=yes]
         \bTABLEbody
           \bTR
             \bTC AAA\eTC
             \bTC[nc=2] Location\eTC
           \eTR
           \bTR
             \bTC AAA Longish entry\eTC
             \bTC Figure\eTC
             \bTC 1.12\eTC
           \eTR
           \bTR
             \bTC AAA\eTC
             \bTC Table\eTC
             \bTC 10.8\eTC
           \eTR
         \eTABLEbody
       \eTABLE
    \stoptext

-- 
Rik Kabel

[-- Attachment #1.2: Type: text/html, Size: 2284 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem in natural tables with nc= and alignmentcharacter
  2014-06-23 19:03 Problem in natural tables with nc= and alignmentcharacter Rik Kabel
@ 2014-06-23 19:43 ` Rik Kabel
  2014-06-23 20:34 ` Peter Münster
  1 sibling, 0 replies; 7+ messages in thread
From: Rik Kabel @ 2014-06-23 19:43 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1498 bytes --]

On 2014-06-23 15:03, Rik Kabel wrote:
> When a wide-ish column precedes a character-aligned column and a 
> column span is in place, the table is set improperly.
>
> With the following example, the first two columns overlap.
>
> When the first column is moved to the right side of the table there is 
> no issue.
>
> When the setup line is removed, there is no issue.
>
> When the long entry in column is shortened, there is no issue.
>
> When the column span is removed and another cell added to that row, 
> there is no issue.
>
> The problem occurs when the span is applied to the first two or the 
> last two columns in the example.
>
> TL14 handles this correctly. It fails with the 20140622 beta.
>
>     \starttext
>       \bTABLE
>     \setupTABLE[c][3][alignmentcharacter={.},aligncharacter=yes]
>         \bTABLEbody
>           \bTR
>             \bTC AAA\eTC
>             \bTC[nc=2] Location\eTC
>           \eTR
>           \bTR
>             \bTC AAA Longish entry\eTC
>             \bTC Figure\eTC
>             \bTC 1.12\eTC
>           \eTR
>           \bTR
>             \bTC AAA\eTC
>             \bTC Table\eTC
>             \bTC 10.8\eTC
>           \eTR
>         \eTABLEbody
>       \eTABLE
>     \stoptext
>
> -- 
> Rik Kabel
Small correction. The statement

    When the first column is moved to the right side of the table there
    is no issue.

is incorrect. The problem exists with the long entry in a column 
following the alignmentcharacter column as well.

-- 
Rik

[-- Attachment #1.2: Type: text/html, Size: 2975 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem in natural tables with nc= and alignmentcharacter
  2014-06-23 19:03 Problem in natural tables with nc= and alignmentcharacter Rik Kabel
  2014-06-23 19:43 ` Rik Kabel
@ 2014-06-23 20:34 ` Peter Münster
  2014-06-23 20:50   ` Peter Münster
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Münster @ 2014-06-23 20:34 UTC (permalink / raw)
  To: ntg-context

On Mon, Jun 23 2014, Rik Kabel wrote:

> With the following example, the first two columns overlap.

No solution, just a smaller MWE:

\starttext
\setupTABLE[c][3][aligncharacter=yes]
\setupTABLE[height=2cm]
\bTABLE
\bTR \bTD A               \eTD \bTD[nc=2] A \eTD             \eTR 
\bTR \bTD A xxxxxxxxxxxxx \eTD \bTD       A \eTD \bTD 1 \eTD \eTR
\eTABLE
\stoptext

-- 
           Peter
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Problem in natural tables with nc= and alignmentcharacter
  2014-06-23 20:34 ` Peter Münster
@ 2014-06-23 20:50   ` Peter Münster
  2014-06-24 12:03     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Münster @ 2014-06-23 20:50 UTC (permalink / raw)
  To: ntg-context

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

-- 
           Peter
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem in natural tables with nc= and alignmentcharacter
  2014-06-23 20:50   ` Peter Münster
@ 2014-06-24 12:03     ` Hans Hagen
  2014-06-24 19:53       ` Rik Kabel
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2014-06-24 12:03 UTC (permalink / raw)
  To: ntg-context

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 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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem in natural tables with nc= and alignmentcharacter
  2014-06-24 12:03     ` Hans Hagen
@ 2014-06-24 19:53       ` Rik Kabel
  2014-06-25  8:15         ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Rik Kabel @ 2014-06-24 19:53 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1830 bytes --]

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?

-- 
Rik

[-- Attachment #1.2: Type: text/html, Size: 2905 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem in natural tables with nc= and alignmentcharacter
  2014-06-24 19:53       ` Rik Kabel
@ 2014-06-25  8:15         ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2014-06-25  8:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2014-06-25  8:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-23 19:03 Problem in natural tables with nc= and alignmentcharacter Rik Kabel
2014-06-23 19:43 ` Rik Kabel
2014-06-23 20:34 ` Peter Münster
2014-06-23 20:50   ` Peter Münster
2014-06-24 12:03     ` Hans Hagen
2014-06-24 19:53       ` Rik Kabel
2014-06-25  8:15         ` Hans Hagen

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