[NTG-context] Rows and lines in tables
Hans Hagen
pragma at wxs.nl
Tue Apr 11 23:55:05 CEST 2006
Robert Engelhardt wrote:
> Hello all,
>
> I'm a new ConTeXt user (started using it a few days ago) and I do have
> three problems now with tables which I could not solve reading the manual
> and the content of the ConTeXt wiki. I've created a minimal example (see
> below) illustrating my problems:
>
> 1. How can create lines with different widths using the "\DL" command as
> I do with "\HL[<factor>]" oder "\VL[<factor>]"? This would, in my
> example, allow to align the "dummy<x>" text in the first table with the
> numbers <x> in the second table.
>
> 2. How can I create a carriage return in the text of a table cell?
> Neither "\crlf" nor "\\" do work (tried it with the "AAA" and "BBB" text
> in the first table to get them into the same cell.
>
> 3. How can I synchronize the height of the first two lines of the first
> table with those of the second table, no matter if there's a line between
> the rows (as in the second table, a thin one as in my example or even a
> fat one) or not (like in the first table which visually has a "big
> cell")? Can I create an "invisible line"? How do I line up the "BBB" with
> the "YYY / ZZZ" line? Or, another possibility, how do I control the rows
> independently, having the "BBB" in the first table very close to the
> "AAA", perhaps even three lines of text there, and at the same time only
> two rows of text in the second table? What about having only one line of
> text in the first table, vertically centered to the corresponding two
> rows of the second table?
>
> === [example] ===
>
> \starttext
> \define\bold{8}
> \startcombination[2*1]
> {\starttable[|c|]
> \HL[\bold]
> \VL[\bold] AAA \VL[\bold]\FR
> \VL BBB \VL\LR
> \HL[\bold]
> \VL dummy1 \VL\SR
> \HL
> \VL dummy2 \VL\SR
> \HL
> \VL dummy3 \VL\SR
> \HL[\bold]
> \VL dummy4 \VL\SR
> \HL
> \VL dummy5 \VL\SR
> \HL
> \VL dummy6 \VL\SR
> \HL[\bold]
> \VL dummy7 \VL\SR
> \HL
> \VL dummy8 \VL\SR
> \HL
> \VL dummy9 \VL\SR
> \HL[\bold]
> \stoptable}{}
> {\starttable[|c|cw(3cm)|]
> \HL[\bold]
> \VL[\bold] \use{2} XXX \VL[\bold]\FR
> \HL
> \VL YYY \VL[1] ZZZ \VL\LR
> \HL[\bold]
> \VL 1 \VL \VL \SR
> \DL\VL\DR
> \VL 2 \VL \VL \SR
> \DL\VL\DR
> \VL 3 \VL \VL \SR
> \DL\VL\DR
> \VL 4 \VL \VL \SR
> \DL\VL\DR
> \VL 5 \VL \VL \SR
> \DL\VL\DR
> \VL 6 \VL \VL \SR
> \DL\VL\DR
> \VL 7 \VL \VL \SR
> \DL\VL\DR
> \VL 8 \VL \VL \SR
> \DL\VL\DR
> \VL 9 \VL \VL \SR
> \HL[\bold]
> \stoptable}{}
> \stopcombination
> \stoptext
>
> === [/example] ===
>
> I know, a layout with all these horizontal lines and two tables sitting
> next to each other is not the best one, but I'm trying to reconstruct an
> existing document which is designed that way. Thanks for your help!
>
btw, redefining\bold is a bad idea, use \Bold (i.e. capitalize your
personal commands)
\starttext
\def\DummyLine {\VL \blackrule[height=.5\linewidth,depth=.5\linewidth,width=0pt] \VL \NR}
\def\DummyBoldT{\VL \blackrule[height=4\linewidth, depth=0\linewidth, width=0pt] \VL \VL \NR}
\def\DummyBoldB{\VL \blackrule[height=0\linewidth, depth=3\linewidth, width=0pt] \VL \VL \NR}
\define\bold{8}
\startcombination[2*1]
{\starttable[|c|]
\HL[\bold]
\VL[\bold] AAA \VL[\bold]\FR
\DummyLine
\VL BBB \VL\LR
\HL[\bold]
\VL dummy1 \VL\SR
\HL
\VL dummy2 \VL\SR
\HL
\VL dummy3 \VL\SR
\HL[\bold]
\VL dummy4 \VL\SR
\HL
\VL dummy5 \VL\SR
\HL
\VL dummy6 \VL\SR
\HL[\bold]
\VL dummy7 \VL\SR
\HL
\VL dummy8 \VL\SR
\HL
\VL dummy9 \VL\SR
\HL[\bold]
\stoptable}{}
{\starttable[|c|cw(3cm)|]
\HL[\bold]
\VL[\bold] \use{2} XXX \VL[\bold]\FR
\HL
\VL YYY \VL[1] ZZZ \VL\LR
\HL[\bold]
\VL 1 \VL \VL \SR
\DL\VL\DR
\VL 2 \VL \VL \SR
\DL\VL\DR
\VL 3 \VL \VL \SR
\DummyBoldT
\DL\VL\DR
\DummyBoldB
\VL 4 \VL \VL \SR
\DL\VL\DR
\VL 5 \VL \VL \SR
\DL\VL\DR
\VL 6 \VL \VL \SR
\DummyBoldT
\DL\VL\DR
\DummyBoldB
\VL 7 \VL \VL \SR
\DL\VL\DR
\VL 8 \VL \VL \SR
\DL\VL\DR
\VL 9 \VL \VL \SR
\HL[\bold]
\stoptable}{}
\stopcombination
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
More information about the ntg-context
mailing list