showbox in LaTeX

Not a first time when I need to trace a LaTeX layout by digging into the details, and again I've spend time remembering how to do it. Fixing the magic in writing.

First, content should be wrapped by a box:

\\newsavebox{\\xxx}
\\savebox{\\xxx}{
... content ...
}

Now dump it into the log-file:

\\showboxdepth=100
\\showboxbreadth=100
\\showbox\\xxx

The non-obvious thing here is setting showboxdepth and showboxbreadth. For some reason, LaTeX disables box-printing by setting these values to -1. I don't know where from one could know about it.

Finally, return the box to the document:

\\usebox{\\xxx}

Vibe code with your voice

Stop fighting speech recognition.
Just talk → fix mistakes later

"... _brings_ hello world"   ❌
          ↓
"... _prints_ hello world"   ✅

Get handsfree.vc on Google Play

Categories: TeX

Updated: