# Is it possible to display all boxes I am currently in?

I'm currently reading Knuth's TeXbook. As an educational reference, is there a way to display a hierarchical list of all boxes I am currently "in" (in other words, I'm typing the document interactively, and at some point, I wish to see the boxes TeX is in the process of creating at the current instant), and ideally, also be able to display their contents?

Knuth mentions the primitive \showbox, but it seems (to me) that it requires first for one to run \setbox, and furthermore, it seems to tell me nothing about what I have typed so far.

• \showlists is what you want here – David Carlisle Sep 25 at 0:59

\tracingonline1

aa

\vbox{

bb  \hbox{ccc  \showlists

}}\bye


Produces a terminal output of

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdftex)
restricted \write18 enabled.
entering extended mode
(./aa910.tex

### restricted horizontal mode entered at line 7
\tenrm c
\tenrm c
\tenrm c
\glue 3.33333 plus 1.66666 minus 1.11111
spacefactor 1000
### horizontal mode entered at line 7
\hbox(0.0+0.0)x20.0
\tenrm b
\tenrm b
\glue 3.33333 plus 1.66666 minus 1.11111
spacefactor 1000
### internal vertical mode entered at line 5
prevdepth ignored
### vertical mode entered at line 0
### current page:
\glue(\topskip) 5.69446
\hbox(4.30554+0.0)x469.75499, glue set 439.75496fil
.\hbox(0.0+0.0)x20.0
.\tenrm a
.\tenrm a
.\penalty 10000
.\glue(\parfillskip) 0.0 plus 1.0fil
.etc.
total height 10.0
goal height 643.20255
prevdepth 0.0, prevgraf 1 line

! OK.
l.7 bb  \hbox{ccc  \showlists

?


so at the point it stopped

you see you are in a restricted hlist (=hbox)

### restricted horizontal mode entered at line 7
\tenrm c
\tenrm c
\tenrm c
\glue 3.33333 plus 1.66666 minus 1.11111
spacefactor 1000


That was in an unrestricted hlist (=paragraph before it is broken into lines

### horizontal mode entered at line 7
\hbox(0.0+0.0)x20.0
\tenrm b
\tenrm b
\glue 3.33333 plus 1.66666 minus 1.11111
spacefactor 1000


and the paragraph was in a vertical list from the top of the page that already has a hbox for the line aa

### vertical mode entered at line 0
### current page:
\glue(\topskip) 5.69446
\hbox(4.30554+0.0)x469.75499, glue set 439.75496fil
.\hbox(0.0+0.0)x20.0
.\tenrm a
.\tenrm a
.\penalty 10000
.\glue(\parfillskip) 0.0 plus 1.0fil
.etc.


If you want to see longer lists without being truncated to etc. add

\showboxbreadth=1000


at the top

also

\showboxdepth=1000


but that makes no difference in this case as this example has no deep nesting.