1

I try to put two images wrapped in the top of the page but in the same line, so I made the following MWE:

\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum,tikz}
\usepackage{mwe}

\begin{document}

\begin{wrapfigure}{l}[2cm]{0.3\textwidth}
  \vspace{-10pt}
    \includegraphics[width=0.23\textwidth]{example-image}
  \vspace{-10pt}
\end{wrapfigure}


\begin{wrapfigure}{r}[2cm]{0.3\textwidth}
  \vspace{-10pt}
    \includegraphics[width=0.23\textwidth]{example-image}
  \vspace{-10pt}
\end{wrapfigure}

\lipsum[2-18]
\end{document}

And this code give me the following ugly rendering:

But, mysteriously, when I only use the first or the second wrapfigure environment, the rendering work fine:

The problem only appear when I use it twice in the same time in the same page.

So, how can I put on the top of documenter two wrapfigure at the same page height?

2

You can't do this with wrapfigure. The setting of the second will destroy the settings of the first. You need to define your \parshape manually:

\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum,tikz}
\usepackage{mwe}

\begin{document}

\parshape 7  0pt            0.75\textwidth 
             0.25\textwidth 0.5\textwidth 
             0.25\textwidth 0.5\textwidth 
             0.25\textwidth 0.5\textwidth 
             0.25\textwidth 0.5\textwidth 
             0.25\textwidth 0.5\textwidth 
             0pt \textwidth  
\noindent\raisebox{-\height}[0pt][0pt]{%
 \makebox[0.25\textwidth][l]{%
  \makebox[\textwidth]{\includegraphics[width=0.23\textwidth]{example-image}\hfill \includegraphics[width=0.23\textwidth]{example-image}}}}%
\lipsum*

\end{document}

enter image description here

  • Interesting solution, but it didn’t permit to put a part of the graphic in the margin, like we did it with [2cm] wrapfigure’s option. – fauve Dec 13 '17 at 16:36
  • Simply change the value in the raisebox. And for horizontal displacement you can add \hspace to the inner makebox, or use the trim key. – Ulrike Fischer Dec 13 '17 at 16:38

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.