TransWikia.com

wrapfig: frame around image and caption

TeX - LaTeX Asked by user3314570 on July 10, 2021

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?

2 Answers

begin{wrapfigure}[4]{r}{8cm}
 fbox{%
   begin{minipage}{dimexpr8cm-2fboxsep-2fboxrule}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}

Correct answer by user2478 on July 10, 2021

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 + 2FrameSep + 2FrameRulerelax}%
    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

Answered by Bernard on July 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP