When processing my document with ConTeXt, I do not understand why there appears a gap between the leftmost edge of my PDF document and the left edge of my background layer.

I have made an MWE which exhibits this behavior:

\definelayer[mybkgr][x=0mm,y=0mm,
  width=\paperwidth,height=\paperheight]

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

\setlayer[mybkgr][x=0mm,y=10cm]{
  \blackrule[height=0.3\paperheight,
   width=\paperwidth,color=orange]}

\starttext
    \strut
\stoptext

I also tried with hoffset instead of x, with the same result.

This gap can be canceled by setting a hoffset to -4mm. But why does it appear in the first place ? am I missing something ?

(note : In order to be sure that it's not a PDF-viewer-specific behavior, I checked the resulting PDF using evince, xpdf and okular)

up vote 11 down vote accepted

You have a spurious space in your code:

\definelayer[mybkgr][x=0mm,y=0mm,
  width=\paperwidth,height=\paperheight]

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

\setlayer[mybkgr][x=0mm,y=10cm]{% <--
  \blackrule[height=0.3\paperheight,
   width=\paperwidth,color=orange]}

\starttext
    \strut
\stoptext

enter image description here

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.