# Package framed

Default LaTeX style in knitr

By default, knitr uses a LaTeX package named framed for typesetting; the most obvious feature is the light gray shading. In this page, we introduce some tricks and known problems.

As listed in FAQ’s, you may see the output overflow the shading box, and you can set options('width') to a smaller value in this case.

## Overflow of elements

Besides text overflow, figures may also exceed the margin of the shading. If a figure is too wide, LaTeX may complain there is something wrong with the kframe environment, which is what knitr uses to wrap up the chunk output. A known case is about PNG graphics in #154. To make sure your figures do not exceed the page margin, knitr uses the following command in the LaTeX preamble:

The chunk option out.width is set to '\\maxwidth' by default if the output format is LaTeX.

It does not work well with the figure* environment in two-column documents; see knitr-twocolumn.pdf for one approach to deal with this situation.
If you use the Tufte handout/book classes, the fullwidth environment does not work well with the framed package either; see discussion in #222 for possible solutions.