Re: Subscript on plus expression
- To: mathgroup at smc.vnet.net
- Subject: [mg128717] Re: Subscript on plus expression
- From: "djmpark" <djmpark at comcast.net>
- Date: Mon, 19 Nov 2012 19:18:19 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20121117084935.868E56AF3@smc.vnet.net> <19898081.6403.1353229345311.JavaMail.root@m06>
How about this?
MakeBoxes[Subscript[(head : (Plus | Times))[args__], k_],
form : (StandardForm | TraditionalForm)] :=
InterpretationBox[#1, #2] & @@
{SubscriptBox[RowBox[{"(", ToBoxes[head[args], form], ")"}],
ToBoxes[k, form]], Subscript[head[args], k]}
Tests:
Subscript[a + b, k]
Subscript[a x, k]
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/index.html
From: Dave Snead [mailto:dsnead6 at charter.net]
Hi,
Mathematica fails to parenthesize the a+b in Subscript[Plus[a,b],k]
so the output looks identical to
Plus[a,Subscript[b,k]]
Is this a bug?
Is there an option to force the parentheses?
Thanks in advance,
Dave Snead
- References:
- Plotting a series of Roots
- From: William Duhe <wjduhe@loyno.edu>
- Plotting a series of Roots