Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
what happens if you move the \caption{} inside the \fbox{}? –  samcarter Jul 29 at 15:21

2 Answers 2

up vote 6 down vote accepted
\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}
share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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