4

Background

There are several questions asking how to put a box around an image, such as question 1, question 2 and question 3.

Question

How to create a box that includes the image and the caption both. Something like as shown below:

\begin{yyyyyyyyyyyy}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{xxxxxxxxx}
\caption[xxxxxxxxxxxxx]{xxxxxx}
\label{fig:base-case-constant-circulation}
\end{figure}
\end{yyyyyyyyyyyy}

1 Answer 1

5

With the framed package:

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage{framed}

\begin{document}

\begin{figure}
  \begin{framed}
    \centering
    \includegraphics[width=\linewidth]{example-image}
    \caption[xxxxxxxxxxxxx]{xxxxxx}
    \label{fig:base-case-constant-circulation}
  \end{framed}
\end{figure}

\end{document}
2
  • Thank you, it worked. How can I change the liewidth of this frame? May 30, 2020 at 10:56
  • 1
    To change the width of the framing rule, you can use \setlength{\FrameRule}{<width>} with a value of your choice. Pleace thic ocmmand in the preamble to influecne all framed environments in the document. Place it inside figure but before framed to only change this specific frame.
    – leandriis
    May 30, 2020 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .