texblog

Figure with border in LaTeX

Often, figures have a white background which makes the figure border invisible on white paper. If a figure has several disconnected elements, it looks better to delimit them with a frame around figure. The adjustbox package scales, resizes, trims, rotates, and also frames LaTeX content. Conveniently, these functions can be exported to the \includegraphics command, which is what I will show below.

Load the adjustbox package with the export option to make functions available to the \includegraphics command (graphicx package).

\usepackage{graphicx}
\usepackage[export]{adjustbox}

To add a border to a figure, we simply use the frame option.

\includegraphics[width=\linewidth, frame]{figure-filename}

 

Figure without frame

 

Figure with frame

 

Subfigure/subfig with frame

Similarly, we can add a border to subfigures. Here, I used the subfig package, but it works with subfigure and subcaption too. See my code snippets section under figures for code examples.

Exit mobile version