Jeroen Heijmans wrote:
Hi,
I'm new to ConTeXt, but so far most things I wanted to do turned out
to be quite easy. However, now I'm trying to make a particular
section heading, but I can't get it right:
|-|
| SECTION HEADINGKey 1 Value 1 |
| Key 2 Value 2 |
| Key 3 Value 3 |
| Key 4 Value 4 |
| Text Key 5 Value 5 |
|-|
Or in text, a box containing a section heading in the left top, some
additional text in the left bottom, and a table with pairs of values
on the right side of the box.
Getting a box with a section heading and some text was easy enough,
but I couldn't get the table where and how I wanted it. I also tried
to do all of it in a table, but I got errors when trying to put a
\section in the table. Any suggestion on how to do this will be
highly appreciated.
rough approach
\setvariables
[chapter]
[title=,
text=]
\startsetups chapter:reset
\dorecurse {10} {
\setvariables[chapter][key-\recurselevel=,value-\recurselevel=]
}
\stopsetups
\startsetups chapter:make
\setbox 0 = \vbox {
\framed [align=normal,offset=overlay,frame=off] {
\setuptabulate[before=,after=]
\starttabulate[|l|l|]
\dorecurse {10} {
\doifsomething{\getvariable{chapter}{key-\recurselevel}} {
\expanded { % first one not expanded anyway
\NC
\getvariable{chapter}{key-\recurselevel}
\noexpand \NC
\getvariable{chapter}{value-\recurselevel}
\noexpand \NC \NR
}
}
}
\stoptabulate
}
}
\setbox 2 = \hbox {
\framed [align=normal,offset=overlay,frame=off] {
\strut \getvariable{chapter}{title}
}
}
\setbox 4 = \hbox {
\framed [align=normal,offset=overlay,frame=off] {
\strut \getvariable{chapter}{text}
}
}
\ifdim \dimexpr\ht2+\ht4+\lineheight\relax \ht0
\edef\ChapterHeight{\the\ht0}
\else
\edef\ChapterHeight{\the\dimexpr\ht2+\ht4+\lineheight\relax}
\fi
\definelayer[chapter]
\setuplayer[chapter][width=\textwidth,height=\ChapterHeight,offset=.5ex]
\setlayer[chapter][preset=righttop] {\box0}
\setlayer[chapter][preset=lefttop] {\box2}
\setlayer[chapter][preset=leftbottom]{\box4}
\framed[offset=overlay]{\tightlayer[chapter]}
\setups[chapter:reset]
\stopsetups
\setups[chapter:reset]
\starttext
\setvariables
[chapter]
[title={some title},
text={some text},
key-1=bla,
value-1=whow,
key-2=more bla,
value-2=more whow]
\setups[chapter:make]
\input tufte
\setvariables
[chapter]
[title={another title},
text={another text},
key-1=bla bla,
value-1=whow whow,
key-2=less bla,
value-2=less whow]
\setups[chapter:make]
\input tufte
\setvariables
[chapter]
[title={another title},
text={another text},
key-1=bla bla,
value-1=whow whow,
key-2=less bla,
value-2=less whow,
key-3=bla bla,
value-3=whow whow,
key-4=less bla,
value-4=less whow]
\setups[chapter:make]
\input tufte
\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
-
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context