Problem in natural tables with nc= and alignmentcharacter
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
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
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
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 -----------------------------------------------------------------
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
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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Peter Münster
-
Rik Kabel