Am 03.10.2012 um 10:16 schrieb Procházka Lukáš Ing. - Pontex s. r. o. 
<l...@pontex.cz>:

> 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
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to