i tired the code from this answer to arrange images loaded by includegraphics but got some errors i can not fix. the following code
module(...,package.seeall)
local function get_boxes(parent)
local boxes = {}
for n in node.traverse(parent.head) do
if n.width or n.height or n.depth then
table.insert(boxes, {
w = n.width,
h = n.height + n.depth,
box = node.copy(n),
})
end
end
return boxes
end
produces this error:
generativelayout.lua:9: attempt to perform arithmetic on a nil value (field 'height')
stack traceback:
./generativelayout.lua:9: in upvalue 'get_boxes'
./generativelayout.lua:100: in function 'generativelayout.process'
[\directlua]:1: in main chunk.
\endgenlayout ->\egroup \directlua {gen.process()}
is there a way to fix this?
the code does not work on the proposed fbox nodes (in the example on the link) and also does not work on the nodes generated by includegraphics. of which node type the nodes generated by includegraphics and do they have a width and height?