Am 24.12.2011 um 18:09 schrieb Willi Egger:
Hi Wolfgang,
thank you.
The reason why I ask this question is, because \setupheadertexts has 4 arguments and I was curious about how this would be solved in context/setupheadertexts. I will look into your solution. I am not sure whether it will fit into the cld-project.
Can’t you do stuff like this in a style file where you can use TeX macros. A alternative to the \doifoddpageelse macro is to test whether the page counter is or even with the math.odd function. \startluacode userdata = userdata or { } function userdata.myheadertext(rightpage,leftpage) local rightpage = rightpage local leftpage = leftpage if not leftpage or leftpage == "" then leftpage = rightpage end context.setupheadertexts{ function() if math.odd(tex.count["realpageno"]) then context(rightpage) else context(leftpage) end return true end } end \stopluacode \starttext \ctxlua{userdata.myheadertext("Right page")} \dorecurse{4}{\dontleavehmode\page} \ctxlua{userdata.myheadertext("Right page","Left page")} \dorecurse{4}{\dontleavehmode\page} \stoptext Wolfgang