ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: "Huseyin Özoguz" <h.oezoguz@mmnetz.de>
Subject: Re: Double-sided layer
Date: Thu, 6 May 2021 20:49:00 +0200	[thread overview]
Message-ID: <74b0f764-2499-4542-b7b8-60b8ffe48b99@gmail.com> (raw)
In-Reply-To: <3c72749e-4b16-75b9-efbf-d428e83dccf7@mmnetz.de>

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	other threads:[~2021-05-06 18:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 10:48 Huseyin Özoguz
2021-05-06 18:49 ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74b0f764-2499-4542-b7b8-60b8ffe48b99@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=h.oezoguz@mmnetz.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).