7

I have an image wich is beside some text, and I would want to frame the image and the caption.

My code is for now:

\begin{wrapfigure}[4]{r}{8cm}
    \centering
     \fbox{\includegraphics[width=7cm]{Encodages}}
    \caption[Différents encodages]{Différents types d'encodage pour «Wikipédia, l'encyclopédie libre»}
\end{wrapfigure}
BLABLABLA TEXT

but the fbox is only around the image. How could I do that?

  • what happens if you move the \caption{} inside the \fbox{}? – user36296 Jul 29 '14 at 15:21
7
\begin{wrapfigure}[4]{r}{8cm}
 \fbox{%
   \begin{minipage}{\dimexpr8cm-2\fboxsep-2\fboxrule}\centering
    \includegraphics[width=7cm]{Encodages}
    \caption[Différents encodages]{Différents types d'encodage pour «Wikipédia, l'encyclopédie libre»}
   \end{minipage}}
\end{wrapfigure}
7

Here is a solution with the framed package:

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage{heuristica}

    \usepackage{graphicx}
    \usepackage{wrapfig, framed, caption}
    \usepackage{lipsum}%

    %\captionsetup{ width = 2cm}%singlelinecheck = false,

    \begin{document}

    \begin{wrapfigure}{r}{\dimexpr 6cm + 2\FrameSep + 2\FrameRule\relax}%
    \begin{framed}\raggedleft%\centering
    \includegraphics[width=6cm]{0sendak}%
    \caption{Where the Wild Things Are,  by \emph{Maurice Sendak}}
    \end{framed}
    \end{wrapfigure}
    \lipsum[1-2]

    \end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.