# Wrap text around align* environment

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*}


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}


You can use two of the packages you provided as tags in your question! amsmath and wrapfig, as follows for example:

\documentclass{article}

\usepackage{wrapfig}
\usepackage{amsmath}

\begin{document}

lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
\begin{wrapfigure}[4]{r}{2cm}
\begin{aligned} 1 & 2 \\ 3 & 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
\end{document}


To explore more options, have a look at the documentation for each:

texdoc wrapfig
texdoc amsmath

• I tried this, but for some reason latex included the equations in defined in \begin{aligned} at the end of the document (i.e. in the appendix) and not where I need it to be (i.e. wrapped within the following paragraph) – wirdis May 8 '17 at 21:27