Hi Hans, your're a genious, thats so great! Thank you very very much! While testing and adapting the code, there are two questions still: I changed pages[number] = range to local order = v.references.order pages[order] = range and accordingly function document.dosomething() local n = structures.notes.getn("footnote",n) which seems to work, but it would be nice if you could confirm my suggestion that these two values are equal. The other question: As far as I can understand, structures.lists.collected seems to be filled before any typesetting is done yet??? Could you give me some enlightment about that or is it simply the ConTeXt magic? Thank you once again, Greetings Achim Am 06.01.2011 14:49, schrieb Hans Hagen:
something like this
\enabletrackers[structures.notes]
\setupnotedefinition[footnote][location=left,distance=1em,hang=4,headalign=flushright]
\startluacode local n, ranges, pages = 0, { }, { } for k, v in ipairs(structures.lists.collected) do if v.metadata.kind == "description" and v.metadata.name == "footnote" then local realpage = v.references.realpage local number = v.numberdata.numbers[1] local range = ranges[realpage] if not range then range = { min = 0, max = 0 } ranges[realpage] = range end if number < range.min then range.min = number end if number > range.max then range.max = number end pages[number] = range end end function document.dosomething() n = n + 1 local range = pages[n] if range then context.setupnotedefinition( { "footnote" }, { sample = range.max } ) end end \stopluacode
\appendtoks \ctxlua{document.dosomething()} \to \everybeforenoteinsert
\showframe
\starttext \dorecurse {200} {test\footnote{test} } \stoptext
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------