'Code formatting of mathematical expressions

I want the code formatter (invoked by Ctrl+D) to format mathematical expressions more like in math textbooks, i.e., spaces around plus and minus signs and no spaces around multiplication and division. This means I want something like

y := x + i*h;
z := a*b - j*(c + d);

The options of the code formatter ("Set spacing around binary operators") allow no or one blank around the operator, but this is identical for addition/subtraction and multiplication/division. So, I can select between

y := x + i * h;
z := a * b - j * (c + d);

and

y := x+i*h;
z := a*b-j*(c+d);

Both possibilities are not well readable (in any case less readable than the topmost formatting), especially if the formulas get more complex.

Is a somehow possible that the code formatter produces the topmost result?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source