How to help maxima get equation grouped nicely



On 08/20/2011 09:38 AM, Stavros Macrakis wrote:
> Something like this, perhaps?:
> 
> (%i13) A:a1+a2^2$
> (%i14) B:b2/(1+b2)$

unfortunately in my problem A and B share two variables and this
complicates your method. I actually managed to get something roughly
correct by using factorout

factorout(expression, <all the variables not in A or B go here>)

gave me roughly the expression that i wanted. Now what I'd like to have
Maxima do is output the expression in TeX as

(numofA/denomofA) (foo+bar+baz) + (numofB/denomofB) (quux)

instead of

numofA (foo+bar+baz) +  numofB quux
--------------------    -----------
denomofA                 denomofB