Avoiding parentheses in Formatted or box structures
- To: mathgroup at smc.vnet.net
- Subject: [mg59641] Avoiding parentheses in Formatted or box structures
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 15 Aug 2005 06:50:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I'm producing some formatted output. The following is a simplified version that illustrates the problem I am having. ClearAll[f] Format[f[x_Symbol]] := SequenceForm[g, x] Format[f[x^n_]] := SequenceForm[g, x^n] The first line of output is what I desire. No extra parentheses. But when we multiply these expressions by a constant we obtain an extra set of parentheses, which I don't want. {f[x], f[x^3]} a % {gx, gx^3} {a (gx), a (gx^3)} So I tried the following Format statements. ClearAll[f] f[x_Symbol] := g\[InvisibleApplication]x f[(x_)^(n_)] := g\[InvisibleApplication](x^n) Now I don't get parentheses when I multiply the expression by a constant, but I do get them after the g. The InvisibleApplication does not carry through. {f[x], f[x^3]} a% {g[x],g[x^3]} {a g[x], a g[x^3]} I want {gx, gx^3} {a gx, a gx^3} Is it possible to obtain that? I've also tried RowBox structures without success. The example in the Book on RowBox, for example, produces an extra set of parentheses when multiplied by a constant. step1 = RowBox[{SubscriptBox["a", "1"], SubscriptBox["b", "2"]}] // DisplayForm k step1 David Park djmp at earthlink.net http://home.earthlink.net/~djmp/
- Follow-Ups:
- Re: Avoiding parentheses in Formatted or box structures
- From: ted.ersek@tqci.net
- Re: Avoiding parentheses in Formatted or box structures