Help wanted for layers and pagebackgrounds
Dear all, I need to have a special layout, in which a number (which is not a page number nor a section number or such) is printed in big size on the right when the pagenumber is even (that is on a leftpage) and printed on the left when the pagenumber is odd (that is a rightpage). With the help of examples gleaned here and there in the manuals, I came up with the following minimal example: %%%% begin \setupcolors[state=start] \setuppagenumbering[location=footer,alternative=doublesided] \definelayer[NumberRight][width=\paperwidth,height=\paperheight] \definelayer[NumberLeft][width=\paperwidth,height=\paperheight] %\showframe \define[1]\myNumber{% \setlayer[NumberRight][preset=righttop,voffset=45mm,hoffset=3mm,reset] % without reset the problem is the same {\offset[location=rt,rightoffset=-3mm] {\tlap{\startcolor[darkgreen] \switchtobodyfont[ss] \scale[height=30mm,width=22mm]{#1} \stopcolor} } } \setlayer[NumberLeft][preset=lefttop,voffset=45mm,hoffset=25mm,reset] % without reset the problem is the same {\offset[location=tl,leftoffset=-3mm] {\tlap{\startcolor[darkgreen] \switchtobodyfont[ss] \scale[height=30mm,width=22mm]{#1} \stopcolor} } } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Maybe the problem is here? \setupbackgrounds[leftpage] [background=NumberRight] \setupbackgrounds[rightpage][background=NumberLeft] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \starttext \dorecurse{4}{\myNumber{#1}\input knuth.tex \page} \dorecurse{4}{\myNumber{#1}\dorecurse{5}{\input knuth.tex }\page} \stoptext %%%%% end The problem is that in some cases (for instance on pages 2, 3, 4 of the above example) the big numbers are overprinted. In particular the behavior seems not to be the same on all pages, that is after the two \dorecurse above. I guess my lack of knowledge in using and setting layers is the cause, but can anyone tell me please what am I doing wrong? This problem arises in a document in which I have to use mkiv, but in mkii one ha the same result. Thanks in advance and best regards: OK
Am 19.05.10 18:21, schrieb Otared Kavian:
Dear all,
I need to have a special layout, in which a number (which is not a page number nor a section number or such) is printed in big size on the right when the pagenumber is even (that is on a leftpage) and printed on the left when the pagenumber is odd (that is a rightpage). With the help of examples gleaned here and there in the manuals, I came up with the following minimal example:
[...]
Good example! \setupcolors[state=start] \setuppagenumbering[location=footer,alternative=doublesided] \definelayer[Number][width=\paperwidth,height=\paperheight,doublesided=yes] \define[1]\myNumber {\setlayer[Number][odd] [preset=righttop,voffset=45mm,hoffset=3mm] {\offset[location=rt,rightoffset=-3mm] {\tlap{\color[darkgreen]{\scale[height=30mm,width=22mm]{\ss#1}}}}}% \setlayer[Number][even] [preset=lefttop,voffset=45mm,hoffset=25mm] {\offset[location=tl,leftoffset=-3mm] {\tlap{\color[darkgreen]{\scale[height=30mm,width=22mm]{\ss#1}}}}}} \setupbackgrounds[page][background=Number] \starttext \dorecurse{4}{\myNumber{#1}\input knuth \page} \dorecurse{4}{\myNumber{#1}\dorecurse{6}{\input knuth }\page} \dorecurse{4}{\myNumber{#1}\dorecurse{3}{\input knuth }\page} \stoptext Wolfgang
Thanks Wolfgang! Somehow I overlooked the two subtleties you are teaching me here:
\definelayer[Number][width=\paperwidth,height=\paperheight,doublesided=yes]
in which the option doublesided=yes, helps and the options [odd] or [even] in \setlayer:
\setlayer[Number][odd] \setlayer[Number][even]
I will wikify this later this weekend. Best regards: OK On 20 mai 2010, at 10:14, Wolfgang Schuster wrote:
Good example!
\setupcolors[state=start]
\setuppagenumbering[location=footer,alternative=doublesided]
\definelayer[Number][width=\paperwidth,height=\paperheight,doublesided=yes]
\define[1]\myNumber {\setlayer[Number][odd] [preset=righttop,voffset=45mm,hoffset=3mm] {\offset[location=rt,rightoffset=-3mm] {\tlap{\color[darkgreen]{\scale[height=30mm,width=22mm]{\ss#1}}}}}% \setlayer[Number][even] [preset=lefttop,voffset=45mm,hoffset=25mm] {\offset[location=tl,leftoffset=-3mm] {\tlap{\color[darkgreen]{\scale[height=30mm,width=22mm]{\ss#1}}}}}}
\setupbackgrounds[page][background=Number]
\starttext \dorecurse{4}{\myNumber{#1}\input knuth \page} \dorecurse{4}{\myNumber{#1}\dorecurse{6}{\input knuth }\page} \dorecurse{4}{\myNumber{#1}\dorecurse{3}{\input knuth }\page} \stoptext
Wolfgang
participants (2)
-
Otared Kavian
-
Wolfgang Schuster