I have not looked at the Maxima display algorithms for a long time. On
the other hand, not too long ago, I did a little work on a Lisp
pretty-printer, which is a related, though different, problem.
A classic Lisp pretty-printer ("grind" is the traditional function name)
does a branch-and-bound tree search of alternative layouts, minimizing
some objective function (badness). The simplest and most usual
objective function is length in lines (for a given width). Though this
is an exponential search in theory, in practice it is fast (even in
interpreted Emacs Lisp...).
I don't know if TeX is set up to do this kind of search. Can Tex be
programmed to try both the linear form of a/b and the built-up form
without having both alternatives in the source? (Which would create the
exponential blowup Richard mentioned.) If I remember correctly, the Tex
language (as opposed to the layout engine) is a horrible (and unpleasant
to debug) macro-based thing which would not really be suitable for
programming algorithms like this. But I may be wrong or out of date on
that.
It would certainly need more information about the structure of the
expression than we're currently giving it. For example, currently
tex(a.b+c) => $$C+a\cdot b$$. How is Tex supposed to know that cdot
binds more closely than plus?