From: Willi Egger <w.egger@boede.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \defineseperatedlist and working with variables and merging fields
Date: Wed, 27 Jul 2011 19:33:27 +0200 [thread overview]
Message-ID: <5560FE79-3F72-40B9-A544-A729B2C94FA9@boede.nl> (raw)
In-Reply-To: <CAG-LmmCu4Lr1aj-HN0q3PGp6mkDjwMC2SwMUEJwz5f5Y=Voe5g@mail.gmail.com>
[-- 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
___________________________________________________________________________________
prev parent reply other threads:[~2011-07-27 17:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-27 9:36 Cecil Westerhof
2011-07-27 17:33 ` Willi Egger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5560FE79-3F72-40B9-A544-A729B2C94FA9@boede.nl \
--to=w.egger@boede.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).