Debuging boxes in LaTeX

I'm trying to read the TeXbook to understand more on the internal of boxes. They say that:

\setbox0=\hbox{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}
\showbox0


should display how the box is typeset internally by TeX. However, I tried to compile with both tex and pdflatex, and none of them work as I just have an error ! OK (see the transcript file). (and of course the log file does not contain anything meaningfull)

Also, what are the different methods to debug box constructions? I'm impressed by the result of exercice 11.5, but I've no idea how I can do something like that...

MWE:*

\documentclass{article}
\begin{document}
\setbox0=\hbox{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}
\showbox0
\end{document}

• the code for that demobox is in the appendix of answers in the texbook Feb 4 at 21:10

add \tracingonline=1 so it appears on the terminal and set \showboxdepth and \showboxbreadth to suitably large values. The latex macro \showoutput sets all three of these so

> \box0=
\hbox(6.83331+2.15277)x18.6108
.\OT1/cmr/m/n/10 T
.\kern -1.66702
.\hbox(6.83331+0.0)x6.80557, shifted 2.15277
..\OT1/cmr/m/n/10 E
.\kern -1.25
.\OT1/cmr/m/n/10 X

! OK.
l.5 \showbox0

?


from

\documentclass{article}
\begin{document}
\showoutput
\setbox0=\hbox{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}
\showbox0
\end{document}


For a version not available when the TeXBook was written use lualatex and lua-visual-debug

\documentclass{article}
\usepackage{lua-visual-debug}
\begin{document}

\hbox{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}

\end{document}

• Whoo, that's super cool, thanks! And I'm also curious to know, how would you solve the tex exercice using plain tex? Like I'm not even sure to know how to get the height of a character... Feb 4 at 21:11
• @tobiasBora as I commented the answer to all the texbook excercises are in appendx A of the texbook Feb 4 at 21:12
• Oh, thanks a lot! Feb 4 at 21:43