ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Layers: corner, location
@ 2013-06-07  7:07 Procházka Lukáš Ing. - Pontex s. r. o.
  2013-06-07  7:27 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-06-07  7:07 UTC (permalink / raw)
  To: ConTeXt

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

Hello,

I'm trying to understand meaning of "location" and "corner" keywords of layer definition (http://wiki.contextgarden.net/Layers#My_first_Layer).

The goal is to place a logo (here: a \framed) to the top right corner of the page, with vertical and horizontal shift 5 mm into the centre of the page.

The working code is:

----
\definelayer
   [Logo]
   [location={left,bottom},
    x=\paperwidth,
    y=0mm,
    hoffset=-5mm,
    voffset=5mm,
   ]

\setlayer
   [Logo]
   {\framed[width=4cm,height=1cm]{LOGO}}

\setupbackgrounds[page][background=Logo]

\starttext
   \input knuth
\stoptext
----

Although it works, it's a result of many attempts.
I don't understand why "location={left,bottom}" is the correct choice although the referential point of the logo is *right-top* corner and I'm placing the logo into the *right-top* corner of the layer (page).

I played with "corner=" and "location=" combinations but - it seems the only one which gives the good result is the one above.

Could anyone explain this?

Thanks in advance.

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 244 062 238
Fax: +420 244 461 038

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

\definelayer
  [Logo]
  [location={left,bottom},
   x=\paperwidth,
   y=0mm,
   hoffset=-5mm,
   voffset=5mm,
  ]

\setlayer
  [Logo]
  {\framed[width=4cm,height=1cm]{LOGO}}

\setupbackgrounds[page][background=Logo]

\starttext
  \input knuth
\stoptext

[-- Attachment #3: t.pdf --]
[-- Type: application/pdf, Size: 11099 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] 5+ messages in thread

* Re: Layers: corner, location
  2013-06-07  7:07 Layers: corner, location Procházka Lukáš Ing. - Pontex s. r. o.
@ 2013-06-07  7:27 ` Hans Hagen
  2013-06-07  8:06   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2013-06-07  7:27 UTC (permalink / raw)
  To: ntg-context

On 6/7/2013 9:07 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> Hello,
>
> I'm trying to understand meaning of "location" and "corner" keywords of
> layer definition (http://wiki.contextgarden.net/Layers#My_first_Layer).
>
> The goal is to place a logo (here: a \framed) to the top right corner of
> the page, with vertical and horizontal shift 5 mm into the centre of the
> page.
>
> The working code is:
>
> ----
> \definelayer
>    [Logo]
>    [location={left,bottom},
>     x=\paperwidth,
>     y=0mm,
>     hoffset=-5mm,
>     voffset=5mm,
>    ]
>
> \setlayer
>    [Logo]
>    {\framed[width=4cm,height=1cm]{LOGO}}
>
> \setupbackgrounds[page][background=Logo]
>
> \starttext
>    \input knuth
> \stoptext
> ----
>
> Although it works, it's a result of many attempts.
> I don't understand why "location={left,bottom}" is the correct choice
> although the referential point of the logo is *right-top* corner and I'm
> placing the logo into the *right-top* corner of the layer (page).
>
> I played with "corner=" and "location=" combinations but - it seems the
> only one which gives the good result is the one above.
>
> Could anyone explain this?

see end of pack-box.mkiv for relationship between corner and location; 
it has to do with matching reference points of content and position on 
layer

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Layers: corner, location
  2013-06-07  7:27 ` Hans Hagen
@ 2013-06-07  8:06   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2013-06-07 12:41     ` Peter Rolf
  0 siblings, 1 reply; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-06-07  8:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

On Fri, 07 Jun 2013 09:27:14 +0200, Hans Hagen <pragma@wxs.nl> wrote:

> On 6/7/2013 9:07 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
>> The working code is:
>>
>> ----
>> \definelayer
>>    [Logo]
>>    [location={left,bottom},
>>     x=\paperwidth,
>>     y=0mm,
>>     hoffset=-5mm,
>>     voffset=5mm,
>>    ]
>>
>> \setlayer
>>    [Logo]
>>    {\framed[width=4cm,height=1cm]{LOGO}}
>>
>> \setupbackgrounds[page][background=Logo]
>>
>> \starttext
>>    \input knuth
>> \stoptext
>> ----
>
> see end of pack-box.mkiv for relationship between corner and location;
> it has to do with matching reference points of content and position on
> layer

Thanks for the trial to hint me - I'm no smarter from that .mkiv source.

You just inspired me so the code bellow works, too, and "corner=" and "location=" are more meaningful in this version:

----
\definelayer
   [Logo]
   [width=\paperwidth,
    corner={right,top},
    location={left,bottom},
    hoffset=5mm,
    voffset=5mm,
    state=repeat,
   ]
----

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 244 062 238
Fax: +420 244 461 038

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Layers: corner, location
  2013-06-07  8:06   ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2013-06-07 12:41     ` Peter Rolf
  2013-06-10  7:50       ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Rolf @ 2013-06-07 12:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 07.06.2013 10:06, schrieb Procházka Lukáš Ing. - Pontex s. r. o.:
> Hello,
> 
> On Fri, 07 Jun 2013 09:27:14 +0200, Hans Hagen <pragma@wxs.nl> wrote:
> 
>> On 6/7/2013 9:07 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
>>> The working code is:
>>>
>>> ----
>>> \definelayer
>>>    [Logo]
>>>    [location={left,bottom},
>>>     x=\paperwidth,
>>>     y=0mm,
>>>     hoffset=-5mm,
>>>     voffset=5mm,
>>>    ]
>>>
>>> \setlayer
>>>    [Logo]
>>>    {\framed[width=4cm,height=1cm]{LOGO}}
>>>
>>> \setupbackgrounds[page][background=Logo]
>>>
>>> \starttext
>>>    \input knuth
>>> \stoptext
>>> ----
>>
>> see end of pack-box.mkiv for relationship between corner and location;
>> it has to do with matching reference points of content and position on
>> layer
> 
> Thanks for the trial to hint me - I'm no smarter from that .mkiv source.
>

The layer is divided into a 2x2 matrix of squares, where 'x' is the
center. This gets you a total of 3x3=9 different corners.

o---o---o
|   |   |
o---x---o
|   |   |
o---o---o

Now you choose one 'corner' (the reference point) for the placement. The
placement is done in relation to this point. The chosen 'corner' c is
our new 'center point' (only for placement) now.

With 'location' you define, where (in relation to 'corner') the content
is placed. Again you have nine different corners to choose from.

An example to make this clear.

'corner={top,right}, location={bottom,right}' will place content in the
area L (outside the original layer). Think about the 'corner' c as a
magnetic grid point, where the content snaps to. The 'location' l
defines, from which direction we approach the point c.

x = layer center point
c = corner 'top,right', d = location 'bottom right', L = location (area)

    o---o---o
    |   |   |
----o---c---o
|   |   | L |
----x---o---d
|   |   |
---------



I hope I haven't mixed things up. Feel free to correct this and to
wikify the final version.


Peter

> You just inspired me so the code bellow works, too, and "corner=" and
> "location=" are more meaningful in this version:
> 
> ----
> \definelayer
>   [Logo]
>   [width=\paperwidth,
>    corner={right,top},
>    location={left,bottom},
>    hoffset=5mm,
>    voffset=5mm,
>    state=repeat,
>   ]
> ----
> 
> Best regards,
> 
> Lukas
> 
> 

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Layers: corner, location
  2013-06-07 12:41     ` Peter Rolf
@ 2013-06-10  7:50       ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 0 replies; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-06-10  7:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

thanks Peter for the explanation.

On Fri, 07 Jun 2013 14:41:45 +0200, Peter Rolf <indiego@gmx.net> wrote:

> The layer is divided into a 2x2 matrix of squares, where 'x' is the
> center. This gets you a total of 3x3=9 different corners.
>
> o---o---o
> |   |   |
> o---x---o
> |   |   |
> o---o---o
>
> Now you choose one 'corner' (the reference point) for the placement. The
> placement is done in relation to this point. The chosen 'corner' c is
> our new 'center point' (only for placement) now.
>
> With 'location' you define, where (in relation to 'corner') the content
> is placed. Again you have nine different corners to choose from.
>
> An example to make this clear.
>
> 'corner={top,right}, location={bottom,right}' will place content in the
> area L (outside the original layer). Think about the 'corner' c as a
> magnetic grid point, where the content snaps to. The 'location' l
> defines, from which direction we approach the point c.
>
> x = layer center point
> c = corner 'top,right', d = location 'bottom right', L = location (area)
>
>     o---o---o
>     |   |   |
> ----o---c---o
> |   |   | L |
> ----x---o---d
> |   |   |
> ---------
>
>
>
> I hope I haven't mixed things up. Feel free to correct this and to
> wikify the final version.
>

I added some info to wiki: http://wiki.contextgarden.net/Layers#Understanding_.22location.22_and_.22corner.22

Best regards,

Lukas

> Peter

-- 
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 244 062 238
Fax: +420 244 461 038

___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2013-06-10  7:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-07  7:07 Layers: corner, location Procházka Lukáš Ing. - Pontex s. r. o.
2013-06-07  7:27 ` Hans Hagen
2013-06-07  8:06   ` Procházka Lukáš Ing. - Pontex s. r. o.
2013-06-07 12:41     ` Peter Rolf
2013-06-10  7:50       ` Procházka Lukáš Ing. - Pontex s. r. o.

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