Adding a frame to an image
One way to add a basic frame to an image or to text is by using one of the following commands: \frame{...}, \framebox{...}, or \fbox{...}. However, these commands generate a plain box with thin black lines and a certain distance to the content. How about changing the color, line thickness, or distance? The classic way to do the latter is by changing the LaTeX lengths, \fboxrule and \fboxsep. It can be a bit cumbersome, particularly when dealing with varying lengths. Fortunately, there’s an easier way to accomplish that.
How to do it...
We will load the adjustbox package. It provides several handy commands for modifying boxes. It implicitly loads the graphicx package and exports its own features to the \includegraphics command. Follow these steps:
- Load the xcolor package:
\usepackage{xcolor}
- Load the adjustbox package together with the export option:
\usepackage[export]{adjustbox}
- At the place in your document where the image is...