# How to change brackets in TraditionalForm output

I'm trying to improve TraditionalForm's output by using different brackets when there are more than one. For instance, instead of $u(v(r(b))))$, I'd like to get $u\{v[r(b)]\}$.

I am not sure how to recognize order of brackets when I have lot of brackets. How can I do this?

-
Why all these downvotes? It is about TraditionalForm and I always thought that e.g. differently colored or sized brackets could help sometimes. – Rolf Mertig Feb 1 '13 at 20:55

This is a nice exercise on boxing:

MakeBoxes[u[v_[r_[b_]]], TraditionalForm] :=
Module[{b1, b2, b3, t},
{bl1, bl2, bl3} =
StyleBox[#1, #2] & @@@ { {"{", {20, Orange}}, {"[", {15,
Purple}}, {"(", {12, Blue}}};
{br1, br2,
br3} = {bl1, bl2, bl3} /. {"[" -> "]", "{" -> "}", "(" -> ")"};
RowBox[{"u", bl1, t@v, bl2, t@r, bl3, t@b, br3, br2, br1
}]]


-
Thank you very much Rolf, but what to do with this TraditionalForm[( y - y2 (y3 + y4 (2 y1 + y5)))/((y3^2 - y1) [Alpha]^2)] code doesn't work – Pipe Feb 1 '13 at 22:13
In general that is hard to do. You can do some special cases yourself, but in general I would just not do this. If you want to find out which bracket belongs where, then either use Ctrl Shift B (Check Balance of the Edit menu) or just put the cursor before the bracket (in Mathematica 9 at least) and you get already a greenish highlighting of the matching bracket. That is usually all good enough. – Rolf Mertig Feb 2 '13 at 0:44
Thank you very much Rolf – Pipe Feb 2 '13 at 2:25
but it is not working automatically when I have large term with many coupled brackets? – Pipe Jun 18 '13 at 18:36