On Thu, Oct 20, 2016 at 8:25 AM, Deepak Jois <[email protected]> wrote: > Hi > I would like to invoke the LuaTeX interpreter with a Lua file which > does the node building etc, and then calls something like > tex.shipout(), which can generate a PDF. I am aware of the --lua flag, > but the file passed to that flag executes before the TeX engine is > fully initialised. So that’s not what I am looking for > > For example, lets say I have a Lua file with code: > > <code> > -- Page settings > tex.pagewidth = "210mm" > tex.pageheight = "297mm" > tex.hsize = "210mm" > > -- Set the paragraph indentation > tex.parindent = "20pt" > > tex.sprint("hello world") > </code> > > and I want to generate a PDF from it directly using the luatex > command. I cannot seem to do that right now, and I require a stub TeX > file like this. > > <code> > \outputmode=1 % this could be avoided if I pass --output-format=pdf > \directlua{dofile('code.lua')} > \bye > </code> > > Questions: > > - Is there a way to avoid creating the stub TeX file? > > - If not, is it something worth adding (or possible to add) as a > feature to the LuaTeX program? > > Deepak > you can consider to build your own format and run it by a wrapper as done in context in the minimals
$ cat z.lua for k,v in pairs(_G) do print(k,v) end $ mtxrun --script plain z.lua mtx-plain | running command 'luatex --fmt=luatex-plain "z.lua"' _G table: 0x20f4390 status table: 0x21a38f0 loadfile function: 0x50dda4 rawlen function: 0x718c9c tostring function: 0x719886 font table: 0x21a40a0 coroutine table: 0x20f60d0 collectgarbage function: 0x718dd4 lua table: 0x2104f10 string table: 0x20f7c40 mbox table: 0x210ea60 print function: 0x718695 zlib table: 0x21601c0 arg table: 0x21b6c00 fontloader table: 0x2199f90 ltn12 table: 0x2128ab0 lpeg table: 0x20fd7b0 lfs table: 0x20fcc70 module function: 0x20f5ff0 load function: 0x71934c io table: 0x20f6bb0 socket table: 0x20f7ce0 texio table: 0x21a12e0 tex table: 0x2145ad0 error function: 0x718a97 md5 table: 0x20fc700 ipairs function: 0x719117 profiler table: 0x20fd2d0 rawset function: 0x718d67 mplib table: 0x21a5bf0 rawequal function: 0x718c41 table: 0x20f4390 tonumber function: 0x718803 unicode table: 0x20f7710 getmetatable function: 0x718b29 epdf table: 0x21b1f60 require function: 0x20f6060 pairs function: 0x719068 rawget function: 0x718d0b vf table: 0x21a5db0 _VERSION Lua 5.2 select function: 0x7195bb setmetatable function: 0x718b8b lang table: 0x21a4910 type function: 0x718ee0 callback table: 0x21a2370 debug table: 0x20f95e0 zip table: 0x20fbc80 texconfig table: 0x21b2b00 kpse table: 0x21050f0 dofile function: 0x50debd next function: 0x719006 xpcall function: 0x7197cf bit32 table: 0x20fc1c0 assert function: 0x719556 os table: 0x20f72a0 gzip table: 0x21607d0 package table: 0x20f4b80 pcall function: 0x719747 math table: 0x20f5bf0 table table: 0x20f68d0 mime table: 0x2106c90 pdfscanner table: 0x21b2a60 -- luigi
