ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Double-sided layer
@ 2021-05-06 10:48 Huseyin Özoguz
  2021-05-06 18:49 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Huseyin Özoguz @ 2021-05-06 10:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello context-community,

I have an image as a layer and want it to place on every page of a book 
with some offset.

My minexample:

\setlayer[mybg]
     [hoffset=2cm, voffset=0.2cm, doublesided=yes] {\framed[frame=off, 
width=2cm, 
height=1cm]{\externalfigure[bilder_bearbeitet_png/32.png][width=\textwidth]}} 


That works in principle, but I want the hoffset to be relative to the 
cutspace/backspace: different on right and left page, such that the 
layer is set equally on every page relative to the textbody.

In the example above I use "doublesided=yes", but that has no effect. 
How to achieve proper double-sided behavior?

Thank you.
Huseyin

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Double-sided layer
  2021-05-06 10:48 Double-sided layer Huseyin Özoguz
@ 2021-05-06 18:49 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2021-05-06 18:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Huseyin Özoguz

Huseyin Özoguz schrieb am 06.05.2021 um 12:48:
> Hello context-community,
> 
> I have an image as a layer and want it to place on every page of a book 
> with some offset.
> 
> My minexample:
> 
> \setlayer[mybg]
>      [hoffset=2cm, voffset=0.2cm, doublesided=yes] {\framed[frame=off, 
> width=2cm, 
> height=1cm]{\externalfigure[bilder_bearbeitet_png/32.png][width=\textwidth]}} 
> 
> 
> That works in principle, but I want the hoffset to be relative to the 
> cutspace/backspace: different on right and left page, such that the 
> layer is set equally on every page relative to the textbody.
> 
> In the example above I use "doublesided=yes", but that has no effect. 
> How to achieve proper double-sided behavior?

You have to set the content for the layer twice, once for
the left pages and a second time for the right pages.

\setuppagenumbering
   [alternative=doublesided]

% \setupexternalfigures
%   [directory=images_bearbeitet_png]

\definelayer
   [backgroundimage]
   [width=\paperwidth,
    height=\paperheight,
    state=repeat,
    doublesided=yes]

\setupbackgrounds
   [page]
   [background=backgroundimage]

\setlayer
   [backgroundimage]
   [right]
   [x=\backspace,
    y=\dimexpr\topspace+\headerheight+\headerdistance\relax]
   {\externalfigure[32.png]}

\setlayer
   [backgroundimage]
   [left]
   [x=\cutspace,
    y=\dimexpr\topspace+\headerheight+\headerdistance\relax]
   {\externalfigure[32.png]}

\showframe [text] [text]

\starttext
\dorecurse{10}{\dontleavehmode\page}
\stoptext

Wolfgang
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2021-05-06 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 10:48 Double-sided layer Huseyin Özoguz
2021-05-06 18:49 ` Wolfgang Schuster

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