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 -----------------------------------------------------------------