[NTG-context] perfect centering of layers in a text area

Wolfgang Schuster schuster.wolfgang at gmail.com
Sat Sep 20 12:31:14 CEST 2014


Am 20.09.2014 um 02:56 schrieb Bernd Donner <Bernd.Donner at gmx.net>:

> Hello,
> 
> I'm converting some context from mkii to mkiv. Since the definelogo is 
> depreciated I try to use layers to get the same result.
> 
> The problem in the example below is, the text in the header - which is a 
> table - is not perfectly centered with respect to the bottomframe. What is 
> the reason that the table is not perfectly centered with respect to the line 
> and what is the correct solution?
> 
> Thank you,
> Bernd
> 
> 
> 
> 
> \setuppapersize[A4]
> 
> \language[de]
> \enableregime[utf]
> 
> \setuplayout[backspace=2.0cm, height=fit, width=fit, rightmarginwidth=0.0cm,
>        leftmargin=1.8cm, footerdistance=0.0cm,
>        rightmargindistance=0.2cm, rightmargin=1.8cm, bottom=0.5cm,
>        leftmargindistance=0.2cm, header=0.4cm, headerdistance=0.5cm,
>        footer=0.5cm, top=0.0cm, topspace=0.0cm, bottomspace=0.0cm]
> 
> \definelayer[sabel]
>  [x=0mm, y=0mm, width=\paperwidth, height=\paperheight, preset=lefttop]
> 
> \startsetups layer
> 
> \setlayer[sabel]
>  [hoffset=0mm, voffset=0mm]
>  {\tfx{\vbox
>  {\bTABLE[option=stretch]
>  \setupTABLE[rulethickness=0pt]
>  \setupTABLE[column][1][align={right}, width=.4\textwidth]
>  \setupTABLE[column][2][align={center}]
>  \setupTABLE[column][3][align={left}, width=.4\textwidth]
>  \bTR \bTD I want to be \eTD \bTD \eTD \bTD perfectly centered \eTD \eTR
>  \eTABLE}}}
> 
> \stopsetups
> 
> \setupbackgrounds[header][text][bottomframe=on, setups=layer, 
> background=sabel]
> \setuppagenumbering[location=]
> 
> \starttext
> thx
> \stoptext

\mainlanguage[de]

\setuplayout
  [backspace=2.0cm,
   height=middle,
   width=middle,
   leftmargin=1.8cm,
   footerdistance=0.0cm,
   rightmargindistance=0.2cm,
   rightmargin=1.8cm,
   bottom=0.5cm,
   leftmargindistance=0.2cm,
   header=0.4cm,
   headerdistance=0.5cm,
   footer=0.5cm,
   top=0.0cm,
   topspace=0.0cm,
   bottomspace=0.0cm]

\definelayer[sabel]

\startsetups[sabel]

\setlayerframed[sabel][x=0mm,y=0mm][frame=on,offset=none]
  {\setupTABLE[column][1][align=right, width=.4\textwidth]%
   \setupTABLE[column][2][align=center,width=.2\textwidth]%
   \setupTABLE[column][3][align=left, width=.4\textwidth]%
   \bTABLE[frame=off,style=\tfx]
     \bTR \bTD I want to be \eTD \bTD \eTD \bTD perfectly centered \eTD \eTR
   \eTABLE}

\stopsetups

\setupbackgrounds[header][text][bottomframe=on,setups=sabel,background=sabel]
\setuppagenumbering[location=]

\starttext
thx
\stoptext

Wolfgang


More information about the ntg-context mailing list