ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* TABLE and row/column align settings
@ 2012-10-03  8:16 Procházka Lukáš Ing. - Pontex s. r. o.
  2012-10-03  8:53 ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-10-03  8:16 UTC (permalink / raw)
  To: ConTeXt

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

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

[-- Attachment #2: t-TabAli.mkiv --]
[-- Type: application/octet-stream, Size: 523 bytes --]

\def\DoTable#1{%
  \bTABLE
    \setupTABLE[width=2cm]
    \setupTABLE[column][#1][align=flushright]
    \setupTABLE[row][1][align=middle] % Settings for ALL columns in the row 1 should be overwritten
    \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

[-- Attachment #3: t-TabAli.pdf --]
[-- Type: application/pdf, Size: 8385 bytes --]

[-- Attachment #4: 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] 5+ messages in thread

* Re: TABLE and row/column align settings
  2012-10-03  8:16 TABLE and row/column align settings Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-10-03  8:53 ` Wolfgang Schuster
  2012-10-03  9:11   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2012-10-03  8:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 03.10.2012 um 10:16 schrieb Procházka Lukáš Ing. - Pontex s. r. o. <LPr@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
___________________________________________________________________________________


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

* Re: TABLE and row/column align settings
  2012-10-03  8:53 ` Wolfgang Schuster
@ 2012-10-03  9:11   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-10-03  9:32     ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-10-03  9:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

... 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 <wolfgang.schuster@gmail.com> wrote:

>
> Am 03.10.2012 um 10:16 schrieb Procházka Lukáš Ing. - Pontex s. r. o. <LPr@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


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

___________________________________________________________________________________
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] 5+ messages in thread

* Re: TABLE and row/column align settings
  2012-10-03  9:11   ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2012-10-03  9:32     ` Wolfgang Schuster
  2012-10-03  9:43       ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2012-10-03  9:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

> ... 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
___________________________________________________________________________________
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] 5+ messages in thread

* Re: TABLE and row/column align settings
  2012-10-03  9:32     ` Wolfgang Schuster
@ 2012-10-03  9:43       ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 0 replies; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2012-10-03  9:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> 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

___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2012-10-03  9:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-03  8:16 TABLE and row/column align settings Procházka Lukáš Ing. - Pontex s. r. o.
2012-10-03  8:53 ` Wolfgang Schuster
2012-10-03  9:11   ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-10-03  9:32     ` Wolfgang Schuster
2012-10-03  9:43       ` Procházka Lukáš Ing. - Pontex s. r. o.

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