I'm trying to create some exercises along with sample solutions. For each solution I want a small table on the left with the data from the exercise description and the actual calculations plus explanations for them on the right.
To achieve this I'm using the wrapfig package. Unfortunately the solution doesn't wrap to the right of the data table – it instead appears above the table, under the exercise description.
How do I get the solution to actually wrap the data table, instead of jumping above it?
MWE:
% !TeX program = xelatex
\documentclass{article}
\usepackage{wrapfig}
\newenvironment{data}[1]%
{\begin{wraptable}{l}{#1}\begin{tabular}{|l|}\hline}%
{\hline\end{tabular}\end{wraptable}}
\newcommand{\goals}{\hline}
\begin{document}
\section{Calculating}
\subsection{Addition}
$\alpha=30$° and $\beta=15$°. Divide $\alpha$ with $\beta$!
\begin{data}{2cm}
$\alpha=30$°\\
$\beta=15$°\\
\goals
$\gamma=?$\\
\end{data}
This is the formula:
$\gamma=\frac{\alpha}{\beta}$
This is the actual calculation:
$\gamma=\frac{30°}{15°}=2$°
Hopefully this was easy!
\end{document}
Result:
Mockup of the desired result:


