ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to center \framed on a position?
@ 2016-04-06 11:30 Procházka Lukáš Ing.
  2016-04-06 18:24 ` Pablo Rodriguez
  0 siblings, 1 reply; 2+ messages in thread
From: Procházka Lukáš Ing. @ 2016-04-06 11:30 UTC (permalink / raw)
  To: ConTeXt

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

Hello,

how to center vertically and horizontally a \framed text at the layer origin?

I'm not able to figure it out...

Here's my code:

----
\setuplayout[page]

\definelayer[mybg]

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

\setupbackgrounds[page][background={mybg}]

\starttext
   Hello, world!
\stoptext
----

And - where has the text "Hello, world!" disappeared?

Any help would be appreciated...

Best regards,

Lukas


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751
Fax: +420 244 461 038

[-- Attachment #2: D.mkiv --]
[-- Type: application/octet-stream, Size: 391 bytes --]

\setuplayout[page]

\definelayer[mybg]

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

\setupbackgrounds[page][background={mybg}]

\starttext
  Hello, world!
\stoptext

[-- Attachment #3: D.pdf --]
[-- Type: application/pdf, Size: 5057 bytes --]

[-- Attachment #4: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to center \framed on a position?
  2016-04-06 11:30 How to center \framed on a position? Procházka Lukáš Ing.
@ 2016-04-06 18:24 ` Pablo Rodriguez
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Rodriguez @ 2016-04-06 18:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2016-04-06 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 11:30 How to center \framed on a position? Procházka Lukáš Ing.
2016-04-06 18:24 ` Pablo Rodriguez

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