20.2 \fbox & \framebox

Synopses, one of:


Create a box with an enclosing frame, four rules surrounding the text. These commands are the same as \mbox and \makebox except for the frame (see \mbox & \makebox). The \fbox command is robust, the \framebox command is fragile (see \protect).

\fbox{Warning! No work shown, no credit given.}

LaTeX puts the text into a box, the text cannot be hyphenated. Around that box, separated from it by a small gap, are four rules making a frame.

The first two command invocations, \fbox{...} and \framebox{...}, are roughly the same. As to the third and fourth invocations, the optional arguments allow you to specify the box width as width and the position of the text inside that box as position. See \mbox & \makebox, for the full description but here is an example creating an empty box that is 1/4in wide.


The \strut ensures a total height of \baselineskip (see \strut).

These parameters determine the frame layout.


The thickness of the rules around the enclosed box. The default is 0.2pt. Change it with a command such as \setlength{\fboxrule}{0.8pt} (see \setlength).


The distance from the frame to the enclosed box. The default is 3pt. Change it with a command such as \setlength{\fboxsep}{0pt} (see \setlength). Setting it to 0pt is useful sometimes: this will put a frame around the picture with no white border.


The extra curly braces keep the effect of the \setlength local.

As with \mbox and \makebox, LaTeX will not break lines in text. But this example has LaTeX break lines to make a paragraph, and then frame the result.

    My dear, here we must run as fast as we can, just to stay in place.
    And if you wish to go anywhere you must run twice as fast as that.

See Colored boxes, for colors other than black and white.

The picture environment has a version of the \framebox command where the units depend on picture’s \unitlength (see \framebox (picture)).

Unofficial LaTeX2e reference manual