Knuth in the TexBook Chapter 24, gives a short list of the every
commands. The \everyhbox
command inserts a token list - as its name implies- before a horizontal box.
Here is a short example:
\documentclass[11pt]{article}
\begin{document}
\begingroup
\everyhbox{a} % change this to $a$ to see the issue!
\def\oneLineBox#1#2%
{%
\hfuzz=0pt
\overfullrule=0.25pt
\setbox0=\hbox spread#2{#1}%
\setbox1=\hbox{\the\badness}%
\setbox2=\hbox to 5cm{\box0\hfil\box1}%
\box2
}
\oneLineBox{Badness of line }{-1em}
\oneLineBox{Badness of line }{-0.50em}
\oneLineBox{Badness of line }{-0.39em}
\oneLineBox{Badness of line }{0em}
\oneLineBox{Badness of line }{1em}
\oneLineBox{Badness of line }{2em}
\oneLineBox{Badness of line }{3em}
\endgroup
\end{document}
The oneLineBox
macro above set ups some boxes and using \everybox
we add the letter a
in each horizontal box. But when we change the letter to a math letter say $a$
, the badness is shown as zero, why? Surely the badness of the line did not disappear? Similar results can be obtained by changing \badness
to \hbadness
, this time TeX displays 1000 for all the lines. The overfullrule
also seems to go a bit awry!
\badness
. I was playing with the code and copied wrongly. Will you please give it another go?