0

I have the following code, trying to wrap an image with some sentences beginning with a symbol from packages bbding and utfsym. Probably the problem can occur using and other symbols packages. If I use any symbol from bbding package or a symbol from utfsym package with \large, \Large etc commands then the package wrapfig2 cannot "cut" the lines of text, and they overcame the image. Why this happens and how can we solve it? Here is the MWE:

\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage{utfsym,bbding,wrapfig2}

\begin{document}
    
    \begin{wrapfigure}[7]{r}{0.4\textwidth}
        \begin{center}
            \setlength{\fboxsep}{0pt}%
            \setlength{\fboxrule}{2pt}%
            \vspace{-6mm}
            \fbox{\includegraphics[width=0.33\textwidth]{example-image}}
        \end{center}
        \caption{\footnotesize Example image}
    \end{wrapfigure}

    \usym{1F4D6} This is a test sentence \dotfill
    
    \usym{1F4D7} This is a test sentence \dotfill
    
    \usym{1F4E1} This is a test sentence \dotfill
    
    {\large \usym{1F4D6}} This is a test sentence \dotfill
    
    \PencilRightDown \dotfill
    
    \dotfill
\end{document}

enter image description here

2
  • 1
    you are starting the paragraph in a group. Use \leavevmode{\large ... and \leavevmode\PencilRightDown. Commented Feb 13, 2023 at 17:13
  • Quick and efficient! @Ulrike Fisher
    – miltos
    Commented Feb 13, 2023 at 17:20

1 Answer 1

5

wrapfig has to change the shape of paragraphs at the begin of a paragraph. This code fails if the begin is inside a group. (The bbding commands open a group without leaving vmode first). Use \leavevmode to start the paragraph:

\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage{utfsym,bbding,wrapfig2}

\begin{document}
    
    \begin{wrapfigure}[7]{r}{0.4\textwidth}
        \begin{center}
            \setlength{\fboxsep}{0pt}%
            \setlength{\fboxrule}{2pt}%
            \vspace{-6mm}
            \fbox{\includegraphics[width=0.33\textwidth]{example-image}}
        \end{center}
        \caption{\footnotesize Example image}
    \end{wrapfigure}

    \usym{1F4D6} This is a test sentence \dotfill
    
    \usym{1F4D7} This is a test sentence \dotfill
    
    \usym{1F4E1} This is a test sentence \dotfill \par
    
    \leavevmode{\large \usym{1F4D6}} This is a test sentence \dotfill
    
    \leavevmode\PencilRightDown \dotfill
    
    \dotfill
\end{document}

enter image description here

1
  • \mbox{...} might be even better.
    – egreg
    Commented Feb 13, 2023 at 18:17

You must log in to answer this question.

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