ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to make this section header in ConTeXt?
@ 2006-06-16 12:41 Jeroen Heijmans
  2006-06-16 22:10 ` Hans Hagen
  2006-06-17 10:32 ` Jeroen Heijmans
  0 siblings, 2 replies; 4+ messages in thread
From: Jeroen Heijmans @ 2006-06-16 12:41 UTC (permalink / raw)


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 HEADING            Key 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.

thanks,

Jeroen Heijmans

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

* Re: How to make this section header in ConTeXt?
  2006-06-16 12:41 How to make this section header in ConTeXt? Jeroen Heijmans
@ 2006-06-16 22:10 ` Hans Hagen
  2006-06-17 10:32 ` Jeroen Heijmans
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2006-06-16 22:10 UTC (permalink / raw)


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

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

* Re: How to make this section header in ConTeXt?
  2006-06-16 12:41 How to make this section header in ConTeXt? Jeroen Heijmans
  2006-06-16 22:10 ` Hans Hagen
@ 2006-06-17 10:32 ` Jeroen Heijmans
  2006-06-18 20:40   ` Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Jeroen Heijmans @ 2006-06-17 10:32 UTC (permalink / raw)


Hans Hagen:
> rough approach
> ...
>
>

Thanks a lot, this is what I'm looking for - although it's a bit more  
involved than I had expected.

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

* Re: How to make this section header in ConTeXt?
  2006-06-17 10:32 ` Jeroen Heijmans
@ 2006-06-18 20:40   ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2006-06-18 20:40 UTC (permalink / raw)


Jeroen Heijmans wrote:
> Hans Hagen:
>   
>> rough approach
>> ...
>>
>>
>>     
>
> Thanks a lot, this is what I'm looking for - although it's a bit more  
> involved than I had expected.
>   

you can do it simpler (quick and dirty) but this demos how to write a 
more general interface

Hans

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

end of thread, other threads:[~2006-06-18 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-16 12:41 How to make this section header in ConTeXt? Jeroen Heijmans
2006-06-16 22:10 ` Hans Hagen
2006-06-17 10:32 ` Jeroen Heijmans
2006-06-18 20:40   ` Hans Hagen

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