Hello, On Wed, 16 Jan 2013 12:47:21 +0100, Philipp Gesang wrote: > Lookup the correct string from a table? thanks for the idea - - in other words, we have to keep running results somewhere; the algorithm fills a table with texts for each page, and each \setlayer takes one value back, so we can simplify to: ---- \setupbodyfont[30pt] \starttext A \definelayer [beforetext][width=\overlaywidth,height=\overlayheight] \defineoverlay[beforetext][{\setups[beforetext]\tightlayer[beforetext]}] \startsetups[beforetext] \setlayer[beforetext][preset=righttop] {\framed[width=2in]{\directlua{context(table.remove(userdata.LPr.texts, 1))}}} \stopsetups \startluacode userdata = userdata or { } userdata.LPr = userdata.LPr or { } userdata.LPr.texts = {} for i = 1, 2 do context.startTEXpage { background = "foreground,beforetext" } table.insert(userdata.LPr.texts, "BEF" .. i) context.externalfigure({"cow"},{width="30cm"}) context.stopTEXpage() end \stopluacode Z \stoptext ---- This works. I'm just thinking whether it would be possible to simplify that all - we're using overlays, layers, setups for overlays and an internal table to keep running results... BTW: What does \tightlayer[beforetext] exactly do? Q2: Why some layer properties are specified on \definelayer (beforetext: width=\overlaywidth,height=\overlayheight) and some during overlay setups (beforetext: preset=righttop)? Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038