* Help wanted for layers and pagebackgrounds
@ 2010-05-19 16:21 Otared Kavian
2010-05-20 8:14 ` Wolfgang Schuster
0 siblings, 1 reply; 3+ messages in thread
From: Otared Kavian @ 2010-05-19 16:21 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Help wanted for layers and pagebackgrounds
2010-05-19 16:21 Help wanted for layers and pagebackgrounds Otared Kavian
@ 2010-05-20 8:14 ` Wolfgang Schuster
2010-05-20 11:17 ` Otared Kavian
0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2010-05-20 8:14 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Help wanted for layers and pagebackgrounds
2010-05-20 8:14 ` Wolfgang Schuster
@ 2010-05-20 11:17 ` Otared Kavian
0 siblings, 0 replies; 3+ messages in thread
From: Otared Kavian @ 2010-05-20 11:17 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-20 11:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19 16:21 Help wanted for layers and pagebackgrounds Otared Kavian
2010-05-20 8:14 ` Wolfgang Schuster
2010-05-20 11:17 ` Otared Kavian
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).