% 
% example file for latex2dnd
%

\documentclass{article}
% \usepackage{amsmath}
\input{latex2dnd}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

% define drag-drop labels

\DDlabel{term1}{$-b$}
\DDlabel{term1p}{$+b$}
\DDlabel{term2}{$b^2$}
\DDlabel{dubexp}{$b^{2^\alpha}$}
\DDlabel{dubsub}{$b_{2_\alpha}$}
\DDlabel{fac}{$-4ac$}
\DDlabel{facp}{$+4ac$}
\DDlabel{ta}{$+2a$}
\DDlabel{tam}{$-2a$}

% shorthand macro to make all boxes the same size (6 by 4)
\newcommand\DDB[2]{\DDbox{#1}{6ex}{4ex}{#2}}

% the formula with boxes
$$\lambda = \frac{\DDB{1}{term1}\pm \sqrt{\DDB{2}{term2}\DDB{3}{fac}}}{\DDB{4}{ta}}$$

% output labels, with fixed box heights
\writeDDlabels[4.3ex]

\end{document}
