4

I have a wrapped figure and I want to make it float the bottom of the page (like one can do with the figure environment).

Using wrapfigure I can choose left or right {l}({L}) or right {r}({R}), but I can't choose top or bottom. I read the manual many times, it mentions the enviroment of wrapfloat but still I cannot tell how to force it to be at bottom of page.

Perhaps wrapfigure is not the right tool (see linked questions); if so, I welcome alternative ways of getting the same or very similar result.

In summary, what I want is to have frame or figure that is both floated (for example at the bottom of the page) and that the main text wraps around it (see figure below).

This is the MWE

\documentclass{article}
\usepackage{mdframed}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}

\section{Hello}
\lipsum[2]

\begin{wrapfigure}{l}{0.5\textwidth}
\begin{mdframed}
    should be at left (ok), bottom (how?)
\end{mdframed}
\end{wrapfigure}

\section{Bye}
\lipsum[30]
\lipsum[30]
\lipsum[30]

\end{document}

objective

This was asked before but I don't think it is a general solution: Wrapfig floating to bottom (Article) . There is another failed attempt: Package wrapfig and vertical float. Is it possible?

4
  • You can't. This isn't what wrapfig does. Indeed, something too close to a page break has a tendency to disappear.
    – cfr
    Nov 10, 2015 at 2:19
  • @cfr, I see, it has been tried before but it is not possible it seems. Do you know another way to do it?
    – alfC
    Nov 10, 2015 at 2:23
  • It depends what 'it' is. But the answer is almost certainly 'no'. If the figure belongs with a particular paragraph and both of those can float, you're fine. You can wrap minipage environments in a figure and let the whole thing float wherever. But the text won't wrap in that case - you'll get two blocks, one for the image and one for the text, say. That can work well but it only works if there is specific text which belongs with the image or diagram or whatever. For specialist uses, you can use something like flowfram but that seriously mutilates the usual output routine, of course.
    – cfr
    Nov 10, 2015 at 2:42
  • I recommend editing your question to be as specific as possible about what you actually want. The more constraints you can accept, the more likely it is somebody will know a workaround. There is no way, ordinarily, to tell LaTeX to 'put this at the bottom of the page and wrap whatever text happens to be there around it'. Not that I'm aware of. My understanding is that this kind of thing is very difficult in TeX. flowfram is the only option I know which provides anything remotely approaching that, but it is for quite specialist uses. If this is a magazine or newsletter, it might work.
    – cfr
    Nov 10, 2015 at 2:49

1 Answer 1

4

TeX breaks paragraphs into lines before deciding where to make page breaks so it is hard to automate floating of any kind of cutout that affects line lengths locally.

However if you just place the wrapfig "somewhere close" then it is usually a simple matter to move it by hand when the document is done, just see where the linebreak naturally happens and then force a "fake" paragraph at that point using {\parfillskip0pt\par} to end the partial paragraph without leaving a short line and \noindent to re-start the paragraph without an indent, you can then insert the wrapfig at this point.

enter image description here

\documentclass{article}
\usepackage{mdframed}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}

\section{Hello}
\lipsum[2]



\section{Bye}
\lipsum[30]
\lipsum[30]

Sed mattis, erat sit amet gravida malesuada,
  elit augue egestas diam, tempus scelerisque nunc nisl vitae libero.
  Sed consequat feugiat massa. Nunc porta, eros in eleifend varius,
  erat leo rutrum dui, non convallis lectus orci ut nibh. Sed lorem
  massa, nonummy quis, egestas id, condimentum at, nisl.
  Maecenas  at
  nibh.  Aliquam et augue at nunc pellentesque ullamcorper. Duis nisl
  nibh,
laoreet suscipit, convallis ut, rutrum id, enim. Phasellus
  odio.  Nulla nulla elit,{\parfillskip0pt\par}

\begin{wrapfigure}{l}{0.5\textwidth}
\begin{mdframed}
    should be at left (ok), bottom (how?)
\end{mdframed}
\end{wrapfigure}
\noindent  molestie non, scelerisque at, vestibulum
  eu, nulla. Ut odio nisl, facilisis id, mollis et, scelerisque nec,
  enim.  Aenean sem leo, pellentesque sit amet, scelerisque sit amet,
  vehicula pellentesque, sapien.

\end{document}

You must log in to answer this question.

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