[luatex] Building a PDF with Lua code, without a TeX stub
Deepak Jois
deepak.jois at gmail.com
Thu Oct 20 08:25:49 CEST 2016
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
More information about the luatex
mailing list