Perfect positioning of an image on top of text

Out of curiosity, would it be possible to have the following layout in LaTeX?

That is image a top of text with the text automatically stopping on the border of the image. The left and right margin would probably be the same but is it possible to have different left and right margins?

• It would be helpful for contributors if you give a minimal working example (MWE) to show how far you progressed to achieve what you need. Hopefully you can use the wrapfig package for this. – Partha D. Feb 5 '19 at 14:00
• @ParthaD. I was not aware of the wrapfig and according to its documentation it looks it does exactly what I want, hence I suggest that you turn your comment into an answer. – 永劫回帰 Feb 5 '19 at 14:12

Based on this perfect answer, using pullquote environment, following code maybe help:

\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum,graphicx}
\usepackage[latin]{babel}
\usepackage{pullquote}

\usetikzlibrary{shapes,backgrounds,calc}

\def\mygraphic
{%
\begin{tikzpicture}
\node (0,0) {\includegraphics[width=4cm]{example-image-a}};
\end{tikzpicture}%
}

\begin{document}

\begin{pullquote}{shape=rectangular,object=\mygraphic}
\lipsum[1-4]
\end{pullquote}

\end{document}


• Thank you very much for your answer and for the link to the perfect answer, that looks very promising. – 永劫回帰 Feb 5 '19 at 20:56
• @永劫回帰, Your welcome. – ferahfeza Feb 5 '19 at 21:31
• Problem is that pullquote is not a package generally available and not maintained nor developed further. It only exists as part of the answer and as its author say he doesn't consider it being ready in any way for general use. Which is why I tend to prefer the wrapfigure approach (given in another answer here) aven though that means more manual labor. Of course, if pullquote got to a state where it could deal with most inputs and would be available from CTAN that would be nice. – Frank Mittelbach Feb 6 '19 at 9:27

wrapfig isn't actually suited for this-- I came to realize-- thanks to the interesting question put up @永劫回帰 (the package documentation particularly warns: "It does work in two-column format, but are your figures that small ?" Rather the previous answer @ferahfeza seems far closer up to the mark !

But still, there are situations where one tries and tries one's own way... even to fall short of perfect success. The trial should count, I believe, at least in terms of developers. So, I'm posting this answer fully aware that it might be too clumsy to implement (at least when there's a straightforward pullquote), but could extend the wrapfigure environment to somewhere its developer Donald Arse­neau might not have wondered when creating it sixteen years ago !

Here's my tailored solution, inspired by a ctan documentation:

\documentclass[twocolumn]{article}
\usepackage{lipsum,graphicx,wrapfig}
\begin{document}

\lipsum[1]

\begin{wrapfigure}[15]{r}[0.35\columnwidth]{5.2cm}
\includegraphics[width=5cm,height=10\baselineskip]{example-image-a}
\caption{This wrapfigure spans two-columns of text}
\end{wrapfigure}

\lipsum[3-5]  %  deciding the break is vital to the
%  nice functioning of a 2-col wrapfigure

\begin{wrapfigure}[17]{l}[0.35\columnwidth]{5.2cm}
%  this only creates free space without inserting anything
\end{wrapfigure}

\lipsum[6-7]

\end{document}


producing this output: