15

Before starting the question, I apologize for the large pictures. I had to use some long text to demonstrate the problem.


To generate something like:

I used the following command:

\setlength{\intextsep}{-1.5pt}
\begin{boxedminipage}{\textwidth}
    \begin{wrapfigure}[3]{l}[0pt]{0pt}
        \includegraphics[width=0.5in]{Information.pdf}
        \hspace{-8pt}
    \end{wrapfigure}
    \lipsum[1-2]
\end{boxedminipage}

However, boxedminipage does not split across pages, and I had to use mdframed as mentioned here. So, the above code becomes like this:

\setlength{\intextsep}{-1.5pt}
\begin{mdframed}
    \begin{wrapfigure}[3]{l}[0pt]{0pt}
        \includegraphics[width=0.5in]{Information.pdf}
        \hspace{-8pt}
    \end{wrapfigure}
    \lipsum[1-2]
\end{mdframed}

Unfortunately, the effect is not as expected:

How can I use mdframed and wrapfig together?

PS: The framed package does not seem to suffer from this problem; however, its output is not satisfactory for my purposes: framed closes the frame when it is split across page boundaries, and reopens it on the next page. This does not show that the frame is to be continued on the next page. To see what I mean, compare the output of

\begin{framed}
    \lipsum
\end{framed}

and

\begin{mdframed}
    \lipsum
\end{mdframed}

2 Answers 2

15

Instead of using the wrapfig package, you could use the TeX primitive \parshape to "make room" for the image; something along these lines (of course, change the lengths to use the values that best suit your needs):

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{mdframed}
\usepackage{lipsum}

\newlength\mylena
\setlength\mylena{.6in}
\newlength\mylenb

\newenvironment{myframe}
  {\begin{mdframed}
    \setlength\mylenb{\linewidth}
    \addtolength\mylenb{-0.6in}
    \includegraphics[width=0.5in,height=0.5in]{Information.pdf}\par\vskip-3\baselineskip
    \parshape 4 0.6in \mylenb 0.6in \mylenb 0.6in \mylenb 0in \linewidth
  }
  {\end{mdframed}}

\begin{document}

\begin{myframe}
\lipsum[1-2]
\end{myframe}

\end{document}

enter image description here

I used the demo option of the graphicx package to make my example compilable for everyone; do not use that option in your actual code.

8

You can use the package lettrine:

enter image description here

This is the MWE:

\documentclass[12pt]{article}
\usepackage{graphicx}  
\usepackage{mdframed}
\usepackage{lettrine}
\usepackage{lipsum} % dummy text
\begin{document}
\begin{mdframed}
\lettrine[image,lines=3]{Information}{}
\lipsum[1]
\end{mdframed}
\end{document}

This MWE need a real Information.pdf with the appropiate width and height but

Information symbol saved as Information.png is fine for the MWE although with lower quality.

For a demo with \usepackage[demo]{graphicx} or tunning the picture size, please change the \lettrine line by:

\lettrine[lines=3]{\includegraphics[width=0.5in,height=0.5in]{Information}}

You must log in to answer this question.

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