{"id":3134,"date":"2013-09-21T09:59:12","date_gmt":"2013-09-21T09:59:12","guid":{"rendered":"http:\/\/www.readytext.co.uk\/?p=3134"},"modified":"2014-06-21T16:26:37","modified_gmt":"2014-06-21T16:26:37","slug":"exploring-luatex-nodes-and-boxes-with-graphviz-on-windows","status":"publish","type":"post","link":"https:\/\/www.readytext.co.uk\/?p=3134","title":{"rendered":"Exploring LuaTeX nodes and boxes with Graphviz on Windows"},"content":{"rendered":"<p>If you are interested to explore the inner structures of TeX boxes created in LuaTeX you can do this very conveniently using the following free resources: <\/p>\n<ul>\n<li><a href=\"https:\/\/gist.github.com\/pgundlach\/556247\">viznodelist.lua<\/a> by Patrick Gundlach. This is an excellent Lua script that generates a text file containing a graph representation of the structures and nodes inside a <code>\\vbox{...}<\/code> or <code>\\hbox{...}<\/code>. The file output by <code>viznodelist.lua<\/code> can be opened and displayed using GVEdit (see below).<\/li>\n<li>GVEdit is part of the Graphviz distribution and you can download a Windows installer from the <a href=\"http:\/\/www.graphviz.org\/Download_windows.php\">Graphviz website<\/a><\/li>\n<\/ul>\n<p>Installing Graphviz should be straightforward using the MSI installer provided. To use <code>viznodelist.lua<\/code> you&#8217;ll need to put the file in the appropriate place within your <code>texmf<\/code> tree. To find the right location you may need to look into your <code>texmf.cnf<\/code> file to examine the <code>LUAINPUTS<\/code> variable &ndash; which typically looks something like this:<\/p>\n<p><code>LUAINPUTS = .;$TEXMF\/scripts\/{$progname,$engine,}\/{lua,}\/\/;$TEXMF\/tex\/{luatex,plain,generic,}\/\/<\/code><\/p>\n<p>For example, suppose your <code>texmf<\/code> folder is located at <code>h:\\texmf<\/code> then you could put <code>viznodelist.lua<\/code> in the folder <code>h:\\texmf\\scripts\\lua<\/code>.<\/p>\n<p>Here&#8217;s an ultra-minimal plain LuaTeX example:<\/p>\n<pre class=\"brush: plain; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n\\directlua{require(&quot;viznodelist&quot;)}\r\n\\setbox1001= \\vbox{\\hsize=50 mm Hello \\hbox{Hello}}\r\n\\directlua{viznodelist.nodelist_visualize(1001,&quot;h:\/texmf\/mybox.gv&quot;)}\r\n\\bye\r\n<\/pre>\n<p>The above code will parse the contents of box 1001 and output a file called <code>mybox.gv<\/code> which you can open in GVEdit to view a graph of the the node structures in box 1001. The following screenshot displays this:<\/p>\n<p><img decoding=\"async\" src=\".\/files\/luatexgraphviz.png\" width=\"100%\"\/><\/p>\n<p>GVEdit can export the graph in numerous formats including PDF, PNG etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are interested to explore the inner structures of TeX boxes created in LuaTeX you can do this very conveniently using the following free resources: viznodelist.lua by Patrick Gundlach. This is an excellent Lua script that generates a text file containing a graph representation of the structures and nodes inside a \\vbox{&#8230;} or \\hbox{&#8230;}. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,3],"tags":[],"class_list":["post-3134","post","type-post","status-publish","format-standard","hentry","category-examples","category-luatex"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3134"}],"version-history":[{"count":8,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3134\/revisions"}],"predecessor-version":[{"id":3372,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3134\/revisions\/3372"}],"wp:attachment":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}