[NTG-context] How to center \framed on a position?

Pablo Rodriguez oinos at gmx.es
Wed Apr 6 20:24:42 CEST 2016


On 04/06/2016 01:30 PM, Procházka Lukáš Ing. wrote:
> Hello,
> 
> how to center vertically and horizontally a \framed text at the layer origin?
> 
> I'm not able to figure it out...
> [...]
> And - where has the text "Hello, world!" disappeared?

Hi Lukáš,

here you have the code:

    \setuplayout[page]

    \definelayer[mybg][position=middle, location=middle]

    \setlayer[mybg]
       [x=.5\paperwidth,y=.5\paperheight]
       {\framed
         [frame=on,offset=5mm,width=fit,rulewidth=2mm]
         {\setupbodyfont[10mm,sans]\bf Some text}
       }

    \setupbackgrounds[page][background={mybg}]
    \setupbodyfont[helvetica]
    \starttext
       Hello, world!
    \stoptext

Layer has also position and location. As far as I remember, default
values are {top, left}.

I recall a comment from Wolfgang about setting the body font when using
layers. This is the way to have your text.

I hope it helps,

Pablo
-- 
http://www.ousia.tk


More information about the ntg-context mailing list