TABLE and row/column align settings
Hello, I have a complicated TABLE, but I simplified it to the following example: ---- \def\DoTable#1{% \bTABLE \setupTABLE[width=2cm] \setupTABLE[column][#1][align=flushright] % ....................................................... [1] \setupTABLE[row][1][align=middle] % Settings for ALL columns in the row 1 should be overwritten ... [2] \bTABLEhead \bTR \bTH a\eTH \bTH b\eTH \eTR \eTABLEhead \bTABLEbody \bTR \bTD a\eTD \bTD b\eTD \eTR \eTABLEbody \eTABLE } \starttext No column specification: \DoTable{} With column specification: \DoTable{2} \stoptext ---- The problem is that row #1 should be mid-aligned in all columns. So I wrote: ---- \setupTABLE[column][2][align=flushright] % Column #2 has its own alignment... \setupTABLE[row][1][align=middle] % ... but overwrite here for the whole row #1 (including column #2) ---- But column #2 keeps the previously assigned alignment. The situation doesn't change even if I swap [1] and [2] (for the case "the earlier setting, the higher priority"). Moreover, if the column number if not specified (\DoTable{}), the row setting overwrites setting for ALL columns; so only if the column is specified precisely, its setting is kept. So how to overwrite row #1 setting globally? And how setting priorities are evaluated? I guessed the later specification, the higher weight (which would allow overwriting)... Note that in the example it would be possible to specify settings for each row/column, but it not useful way in the case of more/very complicated tables. TIA. Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
Am 03.10.2012 um 10:16 schrieb Procházka Lukáš Ing. - Pontex s. r. o.
Hello,
I have a complicated TABLE, but I simplified it to the following example:
---- \def\DoTable#1{% \bTABLE \setupTABLE[width=2cm] \setupTABLE[column][#1][align=flushright] % ....................................................... [1] \setupTABLE[row][1][align=middle] % Settings for ALL columns in the row 1 should be overwritten ... [2] \bTABLEhead \bTR \bTH a\eTH \bTH b\eTH \eTR \eTABLEhead \bTABLEbody \bTR \bTD a\eTD \bTD b\eTD \eTR \eTABLEbody \eTABLE }
\starttext No column specification: \DoTable{}
With column specification: \DoTable{2} \stoptext ----
The problem is that row #1 should be mid-aligned in all columns. So I wrote:
---- \setupTABLE[column][2][align=flushright] % Column #2 has its own alignment... \setupTABLE[row][1][align=middle] % ... but overwrite here for the whole row #1 (including column #2) ----
But column #2 keeps the previously assigned alignment.
The situation doesn't change even if I swap [1] and [2] (for the case "the earlier setting, the higher priority").
Moreover, if the column number if not specified (\DoTable{}), the row setting overwrites setting for ALL columns; so only if the column is specified precisely, its setting is kept.
So how to overwrite row #1 setting globally?
And how setting priorities are evaluated? I guessed the later specification, the higher weight (which would allow overwriting)...
Note that in the example it would be possible to specify settings for each row/column, but it not useful way in the case of more/very complicated tables.
\def\DoTable {\dosingleempty\DodoTable} \def\DodoTable[#1]% {\bgroup \setupTABLE[width=2cm]% \doifsomething{#1}{\setupTABLE[column][#1][align=flushright]}% \setupTABLE[header][align=middle]% \bTABLE \bTABLEhead \bTR \bTH a\eTH \bTH b\eTH \eTR \eTABLEhead \bTABLEbody \bTR \bTD a\eTD \bTD b\eTD \eTR \eTABLEbody \eTABLE \egroup} \starttext No column specification: \DoTable With column specification: \DoTable[2] \stoptext Wolfgang
... Thanks for the answer but -
- I generated a macro just do demonstrate different behavior in row #1 depending on whether settings for columns were specified for a PARTICULAR column ("\setupTABLE[column][2][...]") or for columns IN GENERAL ("\setupTABLE[column][][...]").
I need the case with a particular column settings to work:
----
\starttext
\bTABLE
\setupTABLE[width=2cm]
\setupTABLE[column][2][align=flushright]
\setupTABLE[row][1][align=middle] % Settings for ALL columns in the row 1 should be overwritten; but are not (?!)
\bTABLEhead[align=middle]
\bTR
\bTH[align=middle] a\eTH
\bTH[align=middle] b\eTH
\eTR
\eTABLEhead
\bTABLEbody
\bTR
\bTD a\eTD
\bTD b\eTD
\eTR
\eTABLEbody
\eTABLE
\stoptext
----
You can see that "\setupTABLE[row][1][align=middle]" doesn't affect column #2, which keeps its previously setting "\setupTABLE[column][2][align=flushright]"; this is unwanted.
I'd need "\setupTABLE[row][1][align=middle]" to overwrite the column #2 setting, so that all columns in the row #1 be mid-aligned.
Lukas
On Wed, 03 Oct 2012 10:53:39 +0200, Wolfgang Schuster
Am 03.10.2012 um 10:16 schrieb Procházka Lukáš Ing. - Pontex s. r. o.
: Hello,
I have a complicated TABLE, but I simplified it to the following example:
---- \def\DoTable#1{% \bTABLE \setupTABLE[width=2cm] \setupTABLE[column][#1][align=flushright] % ....................................................... [1] \setupTABLE[row][1][align=middle] % Settings for ALL columns in the row 1 should be overwritten ... [2] \bTABLEhead \bTR \bTH a\eTH \bTH b\eTH \eTR \eTABLEhead \bTABLEbody \bTR \bTD a\eTD \bTD b\eTD \eTR \eTABLEbody \eTABLE }
\starttext No column specification: \DoTable{}
With column specification: \DoTable{2} \stoptext ----
The problem is that row #1 should be mid-aligned in all columns. So I wrote:
---- \setupTABLE[column][2][align=flushright] % Column #2 has its own alignment... \setupTABLE[row][1][align=middle] % ... but overwrite here for the whole row #1 (including column #2) ----
But column #2 keeps the previously assigned alignment.
The situation doesn't change even if I swap [1] and [2] (for the case "the earlier setting, the higher priority").
Moreover, if the column number if not specified (\DoTable{}), the row setting overwrites setting for ALL columns; so only if the column is specified precisely, its setting is kept.
So how to overwrite row #1 setting globally?
And how setting priorities are evaluated? I guessed the later specification, the higher weight (which would allow overwriting)...
Note that in the example it would be possible to specify settings for each row/column, but it not useful way in the case of more/very complicated tables.
\def\DoTable {\dosingleempty\DodoTable}
\def\DodoTable[#1]% {\bgroup \setupTABLE[width=2cm]% \doifsomething{#1}{\setupTABLE[column][#1][align=flushright]}% \setupTABLE[header][align=middle]% \bTABLE \bTABLEhead \bTR \bTH a\eTH \bTH b\eTH \eTR \eTABLEhead \bTABLEbody \bTR \bTD a\eTD \bTD b\eTD \eTR \eTABLEbody \eTABLE \egroup}
\starttext
No column specification: \DoTable
With column specification: \DoTable[2]
\stoptext
Wolfgang
-- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
Am 03.10.2012 um 11:11 schrieb Procházka Lukáš Ing. - Pontex s. r. o.
... Thanks for the answer but -
- I generated a macro just do demonstrate different behavior in row #1 depending on whether settings for columns were specified for a PARTICULAR column ("\setupTABLE[column][2][...]") or for columns IN GENERAL ("\setupTABLE[column][][...]").
I need the case with a particular column settings to work:
---- \starttext \bTABLE \setupTABLE[width=2cm] \setupTABLE[column][2][align=flushright] \setupTABLE[row][1][align=middle] % Settings for ALL columns in the row 1 should be overwritten; but are not (?!) \bTABLEhead[align=middle] \bTR \bTH[align=middle] a\eTH \bTH[align=middle] b\eTH \eTR \eTABLEhead \bTABLEbody \bTR \bTD a\eTD \bTD b\eTD \eTR \eTABLEbody \eTABLE \stoptext ----
You can see that "\setupTABLE[row][1][align=middle]" doesn't affect column #2, which keeps its previously setting "\setupTABLE[column][2][align=flushright]"; this is unwanted.
I'd need "\setupTABLE[row][1][align=middle]" to overwrite the column #2 setting, so that all columns in the row #1 be mid-aligned.
The \setupTABLE calls do only store the settings but the values are used later when each cell is formatted and at this step row settings are processed before column settings but when you want a different format for the header you can use \setupTABLE[header][…] which has a higher priority than these two setups. Wolfgang
The \setupTABLE calls do only store the settings but the values are used later when each cell is formatted and at this step row settings are processed before column settings
BTW: Wouldn't be more flexible if the (stored) settings were processed in the order they have been defined?
but when you want a different format for the header you can use \setupTABLE[header][…]which has a higher priority than these two setups.
OK, it's useful in my case. Thanks anyway. Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
participants (2)
-
Procházka Lukáš Ing. - Pontex s. r. o.
-
Wolfgang Schuster