# An understanding trouble with \framebox

I'm reading More Math Into LaTeX, and it introduces the command of \framebox at section 3.9.2 on page 91-92. There are the two following code examples which show different output:

\framebox{\makebox[\totalheight]{1}}
\framebox[\totalheight]{1}


The book explains as follows:

Indeed, \totalheight is the height of 1, which becomes the width of the box. The total height of the box, however, is the height of the character 1 to which you have to add twice the \fboxsep, the separation between the contents of the box and the frame, defined as 3 points, and twice the \fboxrule, the width of the line, or rule, defined as 0.4 points. These lengths are in general also added to the width of the box, but not in this case, because we forced the width to equal the height of the character.

Then how should I understand the last sentences and the totally different output? Hope someone could give me a hand.

• Welcome to TeX-SE! Could you perhaps indicate which explanation is not clear to you? To me this explanation seems good to me, (And sorry, I cannot give a hand, I only have claws. ;-) – user121799 May 23 '19 at 4:06
• @marmot From the previous parts of the book, it says \totalheight = \height + \depth, but for \framebox[\totalheight]{1} the explanation seems show totalheight = \height + 2\fboxsep + 2\fboxrule, so it should be wilder than that of \framebox{\makebox[\totalheight]{1}}, and the last sentences make confusion of me – smallk May 23 '19 at 4:25

\documentclass{article}
\newsavebox\CBox
\begin{document}

\sbox\CBox{g}
\the\wd\CBox | \the\ht\CBox+\the\dp\CBox

\framebox{\makebox[\totalheight]{g}}
\framebox[\totalheight]{g}
\framebox[\width]{g}
\framebox[\the\dimexpr\ht\CBox+\dp\CBox]{g}

\sbox\CBox{\framebox[\totalheight]{g}}
\the\wd\CBox | \the\ht\CBox+\the\dp\CBox

\end{document}


A g has a width of 5pt, a height of 4.53pt and a depth of 2.05pt, which is a total height of 6.5899pt. With \framebox[\totalheight]{g} we get a width of the box of 6.5899pt-0.8pt=5.711pt (the line width of the frame is subtracted from the box! 5.711pt is nearly the same as the natural width of the box and \totalheight minus two times the line width makes no real difference.

Saving all in a box we get the width of 6.5899 (the line width is now part of the box), a height of 7.93pt which is the old height of the g plus \fboxsep (3pt) and \fboxrule (0.4pt). And the depth is the old value, plus also the \fboxsep and \fboxrule.

• Thanks for your patient answer! I think I understand now and I need to give a correction to your answer. In the output of your code, the left/right border of the output of \framebox[\width]{g} is tangent to g, so the width of box line seems not included in the \width. To give my summary of my understanding, \makebox functions as modification of the box dimension and \framebox functions as \makebox but padds more with \fboxsep and \fboxrule. And in the command option parameter field, the dimension parameter is set according to the dimension of the mandatory box content. – smallk May 23 '19 at 11:30