[Tex/LaTex] How to make wrapped figure float at bottom of page

floatsvertical alignmentwrapfigure

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?

Best Answer

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}
Related Question