[Tex/LaTex] How to wrap text around a figure? (revised)

line-breakingparagraphspicinspositioningwrapfigure

This question has been asked before (and in fact I stole the diagram below from that question) but the answers are not sufficient for my needs (at least near as I can tell).

What I want is the following:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Aenean quis mi ut elit interdum imperdiet quis non ante.
Sed imperdiet, sapien quis    +------------------------+
viverra rhoncus, tellus dui   |                        |
dictum nisl, at porta purus   |                        |
ipsum ac turpis. Fusce auctor |         FIGURE         |
ullamcorper adipiscing. Nunc  |          HERE          |
non quam ac orci egestas con- |                        |
sequat ut eget quam. Cras     |                        |
blandit condimentum ornare.   +------------------------+
Curabitur aliquam, nulla sit amet iaculis tristique, mi
nulla auctor magna, sit amet imperdiet ante arcu a libero.

However, I do not want the "figure here" bit to start at the top of the paragraph. I've played around with wrapfig and picins and looked at the documentation for floatflt, and haven't really found anything. (wrapfig seems to always put it at the top, floatflt doesn't have any options for that sort of placement, and picins appears to start a new paragraph.)

Is there any way to do it besides render the document without the figure, look where the line break is, force a line break at that point, start a new paragraph, and \noindent? As much as I enjoy doing that sort of thing and think it falls right in line with TeX's philosophy of "don't worry about layout specifics", ideally that wouldn't apply here. Also ideal is if it can figure out how big the figure is, instead of me telling it.

Best Answer

I recommend you take a look at the cutwin package. Here's an MWE (Minimum Working Example) that demonstrates how it might be used in practice:

\documentclass{article}
\usepackage{cutwin,lipsum}
\usepackage[demo]{graphicx}
\opencutright
\begin{document}

% Define contents of "cutout window" before starting
%   the cutout environment. For this MWE, use a
%   "dummy" image (a black rectangle).
\def\windowpagestuff{\flushright 
   \includegraphics[width=2in,height=1in]{DummyFileName}}

% Set the cutout to start after 3 lines of text
%   and to have a height of 8 lines; width of
%   this cutout: 0.5\textwidth .
\begin{cutout}{3}{0.5\textwidth}{0pt}{8}
     \noindent
     \lipsum[1]
\end{cutout}
\end{document}

enter image description here

Note that I've loaded the graphicx package with the demo option, which allows me to load a "dummy" graphics file. In actual practice, one would omit the demo option and load a "real" graphics file.

Addendum If the paragraph in question is located close to a page break, things may become a bit unpredictable. When in doubt, you could "encase" the cutout environment in a pair of \begin{minipage}{\textwidth} and \end{minipage} statements.

Related Question