David Arnold wrote:
Hans, Willi, et al,
I was thinking there are pros and cons to each solution, Hans' and Willi's. So I tried:
Here are some simple examples of adding fractions already having common denominators.
%output=pdf
\input math-ext
\starttext
\placeformula[-] \startformula \startalign[m=2,distance=5em] \frac5{21}-\frac3{21}&=\frac{5-3}{21} & \frac{2}{x+2}-\frac{x-3}{x+2}&=\frac{2-(x-3)}{x+2}\\ &=\frac2{21} & &=\frac{2-x+3}{x+2}\\ &&&=\frac{5-x}{x+2} \stopalign \stopformula
\startbuffer[1] \framed[frame=on,width=fit] {\startformula \eqalign{ \frac{5}{21}-\frac{3}{21} &=\frac{5-3}{21}\cr &=\frac{2}{21}} \stopformula} \stopbuffer
\startbuffer[2] \framed[frame=on,width=fit] {\startformula \eqalign{ \frac2{x+2}-\frac{x-3}{x+2} &=\frac{2-(x-3)}{x+2}\cr &=\frac{2-x+3}{x+2}\cr &=\frac{5-x}{x+2}} \stopformula} \stopbuffer
\startbuffer \startcombination[2*1] {\externalfigure[1][width=0.45\textwidth,type=buffer]}{} {\externalfigure[2][width=0.45\textwidth,type=buffer]}{} \stopcombination \stopbuffer
\placefigure [][-] {none} {\getbuffer}
\stoptext
As you can see, Hans' solution works perfectly, but note the very ugly source code for that section. Willi's source is cleaner, much easier to read (especially at a later date when I will have to revisit for revisions), but it doesn't work (the output is scaled of course).
Any suggestions as to how I can fix Willi's approach so it doesn't scale?
wikiable: \definecombination[twoformulas][location=top,align=middle] \startalignment[middle] \dontleavehmode \startcombination[twoformulas][2*1] {\getbuffer[1]} {} {\getbuffer[2]} {} \stopcombination \stopalignment \def\StartTwo{\startalignment[middle] \dontleavehmode \startcombination[twoformulas][2*1]} \def\StopTwo {\stopcombination \stopalignment}] \StartTwo {\getbuffer[1]} {} {\getbuffer[2]} {} \StopTwo \StartTwo {\getbuffer[1]} {correct} {\getbuffer[2]} {wrong} \StopTwo