On 2013-10-08, at 7:22 AM, Procházka Lukáš Ing. - Pontex s. r. o. <l...@pontex.cz> wrote:
> Hello, > > I'm trying to hook commands.stoptext()... > > Here's a minimal example: why only the first image appears? > > ---- > \startluacode > local cmd_p > local tab = {} > > f = function(a) > if not cmd_p then > cmd_p = commands.stoptext > > commands.stoptext = function(...) > context("Hook") > > for _, v in ipairs(tab) do > context.startTEXpage() > context.externalfigure{v} > context.stopTEXpage() > end > > cmd_p(...) > end > end > > table.insert(tab, a) > end > \stopluacode > > \starttext > A > \ctxlua{f("cow")} > \ctxlua{f("hacker")} > \stoptext > ---- > > When I modify the code: > > ---- > ... > for _, v in ipairs(tab) do > --context.startTEXpage() > context.externalfigure{v} > --context.stopTEXpage() > end > ... > ---- > > all figures are shown OK. > > Where's the problem? An alternative is to use (untested) \appendtoks ... \to \everystoptext Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________