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
___________________________________________________________________________________

Reply via email to