I'm using the adjust package to add the frame
option in \includegraphics
command. The package is loaded in this way:
\usepackage[export]{adjustbox}
Now I can write the following command:
\includegraphics[width=\textwidth, frame]{foo.png}
and borders will be automagically added to the image.
Unfortunately using this options I get the well-known overfull \hbox (.. too wide) in paragraph
warning. Without the frame
option the warning disappears.
Does exixst a way to defeat this warning using the frame
option?
Best Answer
Here's how you can do; which one to choose between the second and third example is a matter of taste and of what your pictures contain.
The
frame
option draws a frame with rule of width\fboxrule
(by default) and zero space between the frame and the box. But the rule width is added to the width of the box, so you have to do something about it: either reduce a bit the width of the box, or draw the frame inside the box, by specifying a negative separation (second parameter to theframe
option).Don't include the
minipage
environments, they are just to show the effect while using\textwidth
(that's reset in aminipage
) and not having a huge picture of the result.Defining a command for this kind of job is quite easy:
so you can call
or
where
<other options>
might even countermand the default ones for special cases.