[luatex] Putting an image in a box
mtw at view.net.au
Thu Nov 15 06:11:23 CET 2012
Let me try again.
On Sun, 11 Nov 2012, Michael Talbot-Wilson wrote:
> a = img.new()
> a.filename = somename
> n = img.node(a)
> tex.setbox(8, n)
(where somename is a Lua string).
I guess the prior question is, can the contents of a PDF file read by
lua be placed in a TeX box?
Or, can a lua string be used with pdftex syntax e.g. as the argument
Or, if not, can image userdata obtained as above be placed in a TeX
box by any other means?
Or, if not, is there any way that luatex can place in a TeX box
content from a file given that the file's name is available only as a
It seems that the answer is No, No, No, No. Hence, silence.
I guess the usual solution is to run LuaTeX twice, have lua write the data
in the first run and \read1 to\somewhere in the second.
Is that what you guys are doing?
It's a pity there's no other way. There are many situations in which
one wants to include information, e.g. when writing a letter, when you
might want supply a person's name and have TeX get the address from
And that solution wouldn't be of much use for someone who wanted to
print a stamp catalogue with images and descriptions of 5000 postage
I guess what I need to do is use a preprocessor to do the lookups and
write the TeX file. Some kind of private preprocessor language coming
up, I think, to chew up my.pretex and spit out my.tex and run TeX on
it. There are better languages than Lua for writing such a
It would be nice if the LuaTex callbacks were keyed to TeX csnames.
As it is, the documentation (beta 0.70.0) is impenetrable for anyone
who is not a LuaTeX developer. open_read_file? What triggers a call
of that? find_image_file (p. 34)? What can you write in TeX that
calls that? What can TeX do with the actual_name returned? Did it
define a macro accessible to TeX? Okay, don't say, President's eyes
only, of course. I'll go away.
More information about the luatex