I've found this example of using lua node. To output Va they've:

        local g1 = node.new("glyph")
        g1.font = font.current()
        g1.lang = tex.language
        g1.char = 86

        local g2 = node.new("glyph")
        g2.font = font.current()
        g2.lang = tex.language
        g2.char = 97

        g1.next = g2
        g2.prev = g1

        local hbox = node.hpack(g1)
        local vbox = node.vpack(hbox)

Can we draw tikz node like this:

    \tikz[node distance = 3cm]{
        \node (a) at (0,0) [draw, circle] {A};
        \node (b) [below of = a, draw, circle] {B};
        \draw [<->] (a) to (b);

to produce this:

enter image description here

using lua node?

  • 4
    despite the similarity in name there is no connection between nodes in lua and in tikz. It would be a lot (thousands of lines I guess) of work to recreate the tikz logic in lua, so you are almost certainly going to just want to print the tex string from lua and interpret it as tex. – David Carlisle Jun 5 at 12:46

Like this?


tp("\\node (a) at (0,0) [draw, circle] {A};")
tp("\\node (b) [below of = a, draw, circle,node distance=3cm] {B};")
tp("\\draw [<->] (a) to (b);")


enter image description here

  • I think those tex.print and tex.sprint are for formatting plaint text, tables, etc.. These works really well for those purposes BUT for tikz node I think lua node is a good candidate. – Emon Haque Jun 5 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.