As discussed here, there are many commands which can be used to "debug" (La)TeX composing process.

I also know that sometimes the \show command can be used to show the macro definitions.

Nevertheless I know that there are some debug/tracing commands which start with show, for example \showboxbreadth=xx as one can see here.

Is there any list of such commands and their doings?

  • 2
    The TeXBook lists all the ones in TeX, and etex (texdoc etex) adds a few more. there are also some convenience latex macros starting with show such as \showoutput (or rather etex adds more \tracing... commands) – David Carlisle Apr 16 '17 at 12:29
up vote 8 down vote accepted

The book TeX By Topic by Victor Eijkhout describes some \show... macros.

In the following overview X means some integer value and Y and 8-bit number, \Z is short for some 'internal quantity' such as a count, dimen, \skip or token register, W is a word or space separated list of words.

  • \show is primitive command and shows the meaning of a token, i.e. what \meaning\foo does within the document.
  • \showboxdepth=X has the value of the deepest level of box nesting, defaulting to X=3 in plain TeX
  • \showboxbreadth=X has the maximum number of items shown per level This has a plain TeX default of X=5
  • \showlists is a primitive and writes the content of partial box lists in all of the 4 non-math TeX modes (i.e. horizontal/vertical and the restricted versions)
  • \showthe\Y prints the content of a \Y quantity as in the document with \the, \the\footoks
  • \showhyphens{W} displays the hyphenation of W on the terminal/log according to the hyphenation rules.

Now, the eTeX standard (which is a standard by now as of writing this in April 2017) adds some more \show... tools

  • \showifs (activated with \tracingifs=1)
  • \showgroups (\tracinggroups=1)
  • \showtokens for token lists and content, that is not possible to show with \show or \showthe.

These three eTeX additions are mode-independent.

LaTeX adds some wrapper macros, such as

  • \showoutput
  • \showoverfull
  • \showhyphens (being redefined)

and sets initially \showboxbreadth=-1 and \showboxdepth=-1 as well.

Here's a sample LaTeX document for the plain TeX \show... entities.

\documentclass{article}


\newbox\foobox

\setbox\foobox=\hbox{A nice text}


\newcount\foocnt
\foocnt=17


\newtoks\footok
\footok={Gandalf The Grey}

\tracingoutput=1
\tracingonline=1

\begin{document}
\showboxbreadth=10 
\showboxdepth=2
\scrollmode
\showbox\foobox

\showthe\footok

\showthe\foocnt

% Show lists 
a\hfil\break b\par
c\hfill\break d
\hbox{e\vbox{f\showlists}}

\end{document}

The output is both on console as in the .log file (here I cut the header and the bottom statistics to provide the \show... related output only):

> \box26=
\hbox(6.83331+0.0)x48.88896
.\OT1/cmr/m/n/10 A
.\glue 3.33333 plus 1.66498 minus 1.11221
.\OT1/cmr/m/n/10 n
.\OT1/cmr/m/n/10 i
.\OT1/cmr/m/n/10 c
.\OT1/cmr/m/n/10 e
.\glue 3.33333 plus 1.66666 minus 1.11111
.\OT1/cmr/m/n/10 t
.\OT1/cmr/m/n/10 e
.\OT1/cmr/m/n/10 x
.etc.

! OK.
l.23 \showbox\foobox


> Gandalf The Grey.
l.25 \showthe\footok


> 17.
l.27 \showthe\foocnt



### horizontal mode entered at line 32
\hbox(0.0+0.0)x15.0
\OT1/cmr/m/n/10 f
spacefactor 1000
### internal vertical mode entered at line 32
prevdepth ignored
### restricted horizontal mode entered at line 32
\OT1/cmr/m/n/10 e
spacefactor 1000
### horizontal mode entered at line 31
\hbox(0.0+0.0)x15.0
\OT1/cmr/m/n/10 c
\glue 0.0 plus 1.0fill
\penalty -10000
\OT1/cmr/m/n/10 d
\glue 3.33333 plus 1.66666 minus 1.11111
spacefactor 1000
### vertical mode entered at line 0
### current page:
\write-{}
\glue(\topskip) 5.69446
\hbox(4.30554+0.0)x345.0, glue set 324.99998fil
.\hbox(0.0+0.0)x15.0
.\OT1/cmr/m/n/10 a
.\glue 0.0 plus 1.0fil
.\penalty -10000
.\glue(\rightskip) 0.0
\penalty 300
\glue(\baselineskip) 5.05556
\hbox(6.94444+0.0)x345.0, glue set 339.44443fil
.\OT1/cmr/m/n/10 b
.\penalty 10000
.\glue(\parfillskip) 0.0 plus 1.0fil
.\glue(\rightskip) 0.0
\glue(\parskip) 0.0 plus 1.0
total height 22.0 plus 1.0
 goal height 550.0
prevdepth 0.0

! OK.
l.32 \hbox{e\vbox{f\showlists
                             }}


Overfull \hbox (12.22223pt too wide) in paragraph at lines 31--33
\OT1/cmr/m/n/10 d [] 

\hbox(6.94444+0.0)x345.0, glue set - 1.0
.\OT1/cmr/m/n/10 d
.\glue 3.33333 plus 1.66666 minus 1.11111
.\hbox(6.94444+0.0)x349.44444
..\OT1/cmr/m/n/10 e
..\vbox(6.94444+0.0)x345.0 []
.\penalty 10000
.\glue(\parfillskip) 0.0 plus 1.0fil
.\glue(\rightskip) 0.0


Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0
.\glue 16.0
.\vbox(617.0+0.0)x345.0, shifted 62.0
..\vbox(12.0+0.0)x345.0, glue set 12.0fil []
..\glue 25.0
..\glue(\lineskip) 0.0
..\vbox(550.0+0.0)x345.0, glue set 503.94617fil []
..\glue(\baselineskip) 23.55556
..\hbox(6.44444+0.0)x345.0, glue set 170.0fil []
  • I will update with some examples later on – Christian Hupfer Apr 16 '17 at 12:34
  • Ok, I'll wait for the examples :) – Moriambar Apr 16 '17 at 15:54
  • 1
    \tracingoutput=1 is not needed for \show... to have effect; \tracingonline=1 is needed for \showbox to list the box's contents on the terminal, in addition to the log file. The macro \showhyphens is defined also in plain TeX. Being picky, but… +1 anyway. ;-) – egreg Apr 16 '17 at 17:52
  • 1
    Fantastic! @egreg on such detailed posts is always good to be picky, imo! – Moriambar Apr 16 '17 at 17:59
  • @egreg: Yes, I wasn't precise enough about the \tracing...=1 statements. And indeed, I missed \showhyphens – Christian Hupfer Apr 16 '17 at 18:06

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.