[Tex/LaTex] Wrap text around align* environment

alignamsmathwrapwrapfigure

Is there a way I can wrap text around an environment like the one below? I am new to LaTeX, and I have searched everywhere but I can't find help on how to wrap text around a math environment.

\begin{align*}
...
\end{align*}

Best Answer

You have to use the -ed variants of thee amsmath environments. However, I think the plain TeX macro package insbox produces better results in a simple way, with the \InsertBoxR command, which takes two mandatory arguments: the number of untouched lines at the beginning of the paragraph; and its contents. An optional argument (which comes as the last argument) is an integer equal to the number of supplementary shorter lines, in case TeX doesn't compute the number of shorter lines correctly.

\documentclass{article}
\usepackage[svgnames]{xcolor}

\usepackage{wrapfig}
\usepackage{amsmath}
\usepackage{lipsum}

\input{insbox}
\makeatletter
\@InsertBoxMargin =1em
\makeatother

\begin{document}

lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
\begin{wrapfigure}[5]{r}{0cm}
\fcolorbox{Tomato}{white}{$\begin{aligned}
            x & = 2 \\
            3y & = 4
        \end{aligned}$}
\end{wrapfigure}
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum

\InsertBoxR{2}{\fcolorbox{Tomato}{white}{$\begin{aligned}
            x & = 2 \\
            3 y& = 4
        \end{aligned}$}}
\lipsum

\end{document} 

enter image description here