<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.luatex.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Arthur</id>
	<title>LuaTeXWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.luatex.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Arthur"/>
	<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php/Special:Contributions/Arthur"/>
	<updated>2026-04-22T12:51:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.luatex.org/index.php?title=Traversing_TeX_nodes&amp;diff=171</id>
		<title>Traversing TeX nodes</title>
		<link rel="alternate" type="text/html" href="https://wiki.luatex.org/index.php?title=Traversing_TeX_nodes&amp;diff=171"/>
		<updated>2013-05-19T12:02:33Z</updated>

		<summary type="html">&lt;p&gt;Arthur: Restoring character with garbled encoding&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Traversing TeX nodes ==&lt;br /&gt;
&lt;br /&gt;
Put this code at the beginning of any TeX file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
\directlua{&lt;br /&gt;
 local glyph = node.id(&amp;#039;glyph&amp;#039;)&lt;br /&gt;
 local hlist = node.id(&amp;#039;hlist&amp;#039;)&lt;br /&gt;
 local vlist = node.id(&amp;#039;vlist&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
 function gothru(h,prof)&lt;br /&gt;
   for t in node.traverse(h) do&lt;br /&gt;
     texio.write_nl(string.rep(&amp;quot;...&amp;quot;,prof) .. &amp;#039;NODE type=&amp;#039; ..  node.type(t.id) .. &amp;#039; subtype=&amp;#039; .. t.subtype )&lt;br /&gt;
     if t.id == hlist or t.id == vlist then&lt;br /&gt;
       texio.write(&amp;#039; w=&amp;#039; .. t.width .. &amp;#039; h=&amp;#039; .. t.height .. &amp;#039; d=&amp;#039; .. t.depth .. &amp;#039; s=&amp;#039; .. t.shift )&lt;br /&gt;
	   gothru(t.list,prof+1)&lt;br /&gt;
     end&lt;br /&gt;
     if t.id == glyph then&lt;br /&gt;
       texio.write(&amp;#039; font=&amp;#039; .. t.font .. &amp;#039; char=&amp;#039; .. t.char .. &amp;#039; width=&amp;#039; ..  font.fonts[t.font].characters[t.char][&amp;#039;width&amp;#039;])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
 callback.register(&amp;#039;pre_linebreak_filter&amp;#039;,&lt;br /&gt;
   function(h)&lt;br /&gt;
      gothru(h,0) &lt;br /&gt;
      return true &lt;br /&gt;
   end&lt;br /&gt;
   )&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will display a list of all nodes on the terminal and in the log file. For example, for the document&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
\font\x=omlgc&lt;br /&gt;
\x blε bla bla bla&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which contains a Greek letter (in UTF-8), you will get:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
This is luaTeX, Version 3.141592-snapshot-2007062922 (Web2C 7.5.6)&lt;br /&gt;
(&lt;br /&gt;
NODE type=whatsit subtype=6&lt;br /&gt;
NODE type=hlist subtype=0&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=98&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=108&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=941&lt;br /&gt;
NODE type=glue subtype=0&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=98&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=108&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=97&lt;br /&gt;
NODE type=glue subtype=0&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=98&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=108&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=97&lt;br /&gt;
NODE type=glue subtype=0&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=98&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=108&lt;br /&gt;
NODE type=glyph subtype=0 font=51 char=97&lt;br /&gt;
NODE type=glue subtype=0&lt;br /&gt;
Underfull \hbox (badness 10000) in paragraph at lines 14--15&lt;br /&gt;
&lt;br /&gt;
[1] )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be aware of the fact that the nodes will be created only if the glyph requested indeed exists in the font.&lt;br /&gt;
&lt;br /&gt;
[[User:Yannis.Haralambous|Yannis.Haralambous]] 02:52, 4 July 2007 (EDT)&lt;/div&gt;</summary>
		<author><name>Arthur</name></author>
		
	</entry>
</feed>