0

I'm trying to get a right justified image that is all bounded by a box. The problem is that the framed box is excluding the figure caption, and only framing the image:

\begin{wrapfigure}{r}{0.5\textwidth}

    \begin{framed}
        \caption{A test figure with its caption}\label{fig:plots}
        \includegraphics[width=1\textwidth]{figures/plot_placeholder.png}
    \end{framed}

\end{wrapfigure}

With the result:

enter image description here

How can I force the frame to include the caption?

1 Answer 1

1
\documentclass{article}

\usepackage{wrapfig}
\usepackage{framed}
\usepackage{graphicx}

\begin{document}

\begin{wrapfigure}{r}{0.5\textwidth}

    \begin{framed}
        \caption{A test figure with its caption}\label{fig:plots}
        \includegraphics[width=1\textwidth]{example-image}
    \end{framed}

\end{wrapfigure}
a aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a
a aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a
a aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a
a aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa a
\end{document}

Produces

enter image description here

Please edit your question to have a complete small document that shows how you have defined the commands and produces the output you show.

1
  • I was thinking the "caption" package might be relocating the caption. A simple test with '\usepackage{caption}' only improved the vertical spacing. Nov 17, 2022 at 12:02

You must log in to answer this question.

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