View Revisions: Issue #682

Summary 0000682: Create tex.execute()
Revision 2015-11-08 16:45 by Hans Hagen
Steps To Reproduce it will probably be a mess and still not always ok ... one can do this already:

\directlua {

tex.directprinter = nil

function tex.directprint(...)
    tex.print(...)
    tex.print("\\directlua{coroutine.resume(tex.directprinter)}")
    coroutine.yield()
end

function tex.directsprint(...)
    tex.sprint(...)
    tex.sprint("\\directlua{coroutine.resume(tex.directprinter)}")
    coroutine.yield()
end

function stepwise(f)
    tex.directprinter = coroutine.create(f)
    coroutine.resume(tex.directprinter)
end

}

test

\directlua {
    stepwise (function()
        tex.directprint("\\setbox0\\hbox{!!!!}")
        tex.directprint(tex.getbox(0).width .. "\\par")
        tex.directprint("\\setbox2\\hbox{????}")
        tex.directprint(tex.getbox(2).width .. "\\par")
        tex.directprint("\\copy0\\copy2\par")
        stepwise (function()
            tex.directprint("\\bgroup")
            tex.directprint("\\setbox0\\hbox{>>>>}")
            tex.directprint(tex.getbox(0).width .. "\\par")
            tex.directprint("\\setbox2\\hbox{<<<<}")
            tex.directprint(tex.getbox(2).width .. "\\par")
            tex.directprint("\\copy0\\copy2\par")
            tex.directprint("\\copy0\\copy2\par")
            tex.directprint("\\egroup")
        end)
        tex.directprint("\\copy0\\copy2\par")
    end)
}

test
Revision 2011-06-16 16:16 by Taco
Steps To Reproduce