ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \defineseperatedlist and working with variables and merging fields
@ 2011-07-27  9:36 Cecil Westerhof
  2011-07-27 17:33 ` Willi Egger
  0 siblings, 1 reply; 2+ messages in thread
From: Cecil Westerhof @ 2011-07-27  9:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Attached a tex file and the generated PDF.

The first table is what I am trying to do. The second table is an example
about what I would like to accomplish.

I have two problems.

Because there will be a lot of tables I like to use a variable, so that
changes can be done in one place. That is why I would like to use:
    \getvariable{desc}{fieldHeading}
on the third line of the table. But then I get one column instead of five.
(The third is what I get, the fourth what I would like to get.)

In the first and last two rows I would like to have the field take the
complete row. Just like the example in the table under it where I use

Is this possible?

-- 
Cecil Westerhof

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

[-- Attachment #2: test.tex --]
[-- Type: application/x-tex, Size: 922 bytes --]

[-- Attachment #3: test.pdf --]
[-- Type: application/pdf, Size: 18712 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] 2+ messages in thread

* Re: \defineseperatedlist and working with variables and merging fields
  2011-07-27  9:36 \defineseperatedlist and working with variables and merging fields Cecil Westerhof
@ 2011-07-27 17:33 ` Willi Egger
  0 siblings, 0 replies; 2+ messages in thread
From: Willi Egger @ 2011-07-27 17:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Hi,

i think it will be difficult to solve it in that way. If you put the 5 fieldnames into one string, that will not result in 5 cells. What you can do, is to make 5 variables which you call then with a tab-separated list.
Your table has in fact 5 columns. Alas it does not work to use \setupTABLE to organize this, because ConTeXTt expects the nx=5 after the  \bTD. Waht you can do, is to prepend the entry's of the first, second and last row with [nx=5]

See attached example.

Willi


[-- Attachment #2: test-database-table.pdf --]
[-- Type: application/pdf, Size: 20740 bytes --]

[-- Attachment #3: test-database-table.tex --]
[-- Type: application/octet-stream, Size: 1632 bytes --]

\usemodule[database]

\startsetups Table:EXT
 \setupTABLE[style={\switchtobodyfont[9pt]}]
\stopsetups


\defineseparatedlist
 [MyTableExt]
 [separator=tab,
  left=\bTD,right=\eTD,
  first=\bTR,last=\eTR,
  setups=Table:EXT,
  before=\bTABLE,after=\eTABLE]

  \setvariables[desc][
    fieldHeadingA={\bf Field name},
    fieldHeadingB={\bf Field type},
    fieldHeadingC={\bf Field modifiers},
    fieldHeadingD={\bf Field constraints},
    fieldHeadingE={\bf Comments/Usage}]

\starttext

\setupTABLE[row][1][nx=5]
\setupTABLE[row][2][nx=5]
\setupTABLE[row][last][nx=5]
\startMyTableExt
[nx=5]Table name
[nx=5]Table summary
{\getvariable{desc}{fieldHeadingA}}	{\getvariable{desc}{fieldHeadingB}}	{\getvariable{desc}{fieldHeadingC}}	 {\getvariable{desc}{fieldHeadingD}}	{\getvariable{desc}{fieldHeadingE}}
id	CHAR(16)	NOT NULL	PK	
[nx=5]Table constraints
\stopMyTableExt

\bTABLE
\bTR \bTD[nx=5] Table name \eTD \eTR
\bTR \bTD[nx=5] Table summary \eTD \eTR
\bTR
	\bTD {\getvariable{desc}{fieldHeadingA}} \eTD
	\bTD {\getvariable{desc}{fieldHeadingB}} \eTD
	\bTD {\getvariable{desc}{fieldHeadingC}} \eTD
	\bTD {\getvariable{desc}{fieldHeadingD}} \eTD
	\bTD {\getvariable{desc}{fieldHeadingE}} \eTD
\eTR
\bTR
 \bTD id	 \eTD
 \bTD CHAR(16) \eTD
 \bTD NOT NULL \eTD
 \bTD PK \eTD
 \bTD \eTD
\eTR
\bTR \bTD[nx=5] Table constraints\eTD \eTR
\eTABLE

\starttable[|l|l|l|l|l|]
\HL
\VL \use{5} Table name \VL \SR
\HL
\VL \use{5} Table summary \VL \SR
\HL
\VL \bf Field name \VL \bf Field type \VL \bf Field modifiers \VL \bf Field constraints \VL \bf Comments/Usage \VL \SR
\HL
\VL \use{5} Table constraints \VL \SR
\HL
\stoptable

\stoptext

[-- Attachment #4: Type: text/plain, Size: 1314 bytes --]



On 27 Jul 2011, at 11:36, Cecil Westerhof wrote:

> Attached a tex file and the generated PDF.
> 
> The first table is what I am trying to do. The second table is an example about what I would like to accomplish.
> 
> I have two problems.
> 
> Because there will be a lot of tables I like to use a variable, so that changes can be done in one place. That is why I would like to use:
>     \getvariable{desc}{fieldHeading}
> on the third line of the table. But then I get one column instead of five. (The third is what I get, the fourth what I would like to get.)
> 
> In the first and last two rows I would like to have the field take the complete row. Just like the example in the table under it where I use 
> 
> Is this possible?
> 
> -- 
> Cecil Westerhof
> <test.tex><test.pdf>___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


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

end of thread, other threads:[~2011-07-27 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-27  9:36 \defineseperatedlist and working with variables and merging fields Cecil Westerhof
2011-07-27 17:33 ` Willi Egger

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