RE: RE: Why do parentheses spuriously appear when I type in a formula?
- To: mathgroup at smc.vnet.net
- Subject: [mg34518] RE: [mg34458] RE: [mg34410] Why do parentheses spuriously appear when I type in a formula?
- From: "DrBob" <majort at cox-internet.com>
- Date: Fri, 24 May 2002 02:42:35 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
>>the b subscript of T raised to the a power I read that wrong before. Sorry. If you mean (the b subscript of T) raised to the a power, the keystrokes are T Ctrl-_ b Ctrl-space Ctrl-^ a, and there are no parentheses. If you mean the b subscript of (T raised to the a power), the keystrokes are T Ctrl-^ a Ctrl-space Ctrl-_ b, and there MUST be parentheses in order to distinguish between that and the other answer. If you care. If you don't, then use the other method and avoid the parentheses. I see no other reasonable way to read it, and I see no reliable way to visually distinguish between the two forms without parentheses in one of them. >>You can also check the input which does work: first the subscript, then the subscript; the ctrl-space escape *is* needed! That's obviously a typo... so I still haven't seen the answer you DO want. Bobby -----Original Message----- From: Wolf, Hartmut [mailto:Hartmut.Wolf at t-systems.com] To: mathgroup at smc.vnet.net Subject: [mg34518] RE: [mg34458] RE: [mg34410] Why do parentheses spuriously appear when I type in a formula? > -----Original Message----- > From: DrBob [mailto:majort at cox-internet.com] To: mathgroup at smc.vnet.net > Sent: Thursday, May 23, 2002 5:01 PM > Subject: [mg34518] RE: [mg34458] RE: [mg34410] Why do parentheses spuriously > appear when I type in a formula? > > > >>My exact key strokes are T Ctrl-^ a Ctrl-space Ctrl-_ b. > > Omit "Ctrl-space" and you get what you want. [Hartmut Wolf] No, Bobby, this gives something different: mark the box, Menu Format > Show Expression to see Cell[BoxData[ SuperscriptBox["T", SubscriptBox["a", "b"]]], "Input"] which was *not* wanted, see also Out[2] of my first reply. You can also check the input which does work: first the subscript, then the subscript; the ctrl-space escape *is* needed! Quite obviously there is a bug at forming the input stream (or rather it's display in StandardForm). Comparing Out[13] with Out[3] (of my first reply) shows what: instead of invisible brackets \(...\) visible ones (...) are interspersed at box formation around T\^a at the very moment when ctr-_ is pressed. I tried adding a semantic rule to the parser (expression formation) In[3]:= MakeExpression[SubscriptBox[RowBox[{"(", SuperscriptBox[T_, a_], ")"}], b_], StandardForm] := MakeExpression[SubscriptBox[SuperscriptBox[T, a], b], StandardForm] but it doesn't trigger (or shouldn't?, or couldn't because this is no issue of expression formation? already too late? I'd like to know!) Trying InputForm... In[6]:= \!\(\((T\^a)\)\_b // InputForm\) Out[6]//InputForm= Subscript[T^a, b] In[7]:= \!\(\(T\^a\)\_b // InputForm\) Out[7]//InputForm= Subscript[T^a, b] ...shows that both forms, with and without explicit parentheses, convert to the same InputForm (i.e. same expression). However doing it in reverse In[8]:= Subscript[T^a,b]//StandardForm Out[8]//StandardForm= \!\(\((T\^a)\)\_b\) brings up again the unwanted parentheses. Perhaps for calculation just don't bother with them, but if you finally want to show something printable for publication, the spurious parentheses are disturbing and more than ugly! -- Hartmut > > Bobby Treat > > -----Original Message----- > From: Wolf, Hartmut [mailto:Hartmut.Wolf at t-systems.com] To: mathgroup at smc.vnet.net > Sent: Wednesday, May 22, 2002 1:46 AM > Subject: [mg34518] [mg34458] RE: [mg34410] Why do parentheses spuriously appear > when I type in a formula? > > > -----Original Message----- > > From: Carl K. Woll [mailto:carlw at u.washington.edu] To: mathgroup at smc.vnet.net > > Sent: Saturday, May 18, 2002 9:52 AM > > Subject: [mg34518] [mg34458] [mg34410] Why do parentheses spuriously > appear when > > > I type in a > > formula? > > > > > > Hi all, > > > > For some strange reason, I want to type into Mathematica an > > expression that > > should look like T^a_b, that is, the b subscript of T raised > > to the a power. > > My exact key strokes are T Ctrl-^ a Ctrl-space Ctrl-_ b. > > However, when I > > enter this expression into mathematica, it adds (spuriously > > in my mind) some > > parentheses, so that I get (T^a)_b. I would like to know what > > causes these > > parentheses to be added, and if there is anything I can do to > > prevent them > > from appearing. What I have to do now is go back into the > > expression and > > edit out the parentheses. > > > > Carl Woll > > Physics Dept > > U of Washington > > > > > > > > Dear Carl, > > of course as to the why, I could at most speculate. I > wouldn't do that, > instead just add an observation: > > If we input "T Ctrl-^ a Ctrl-space Ctrl-_ b" as you described, we get > > Cell[BoxData[ > SubscriptBox[ > RowBox[{"(", > SuperscriptBox["T", "a"], ")"}], "b"]], "Input"] > > What you desired however is this: > > Cell[BoxData[ > SubscriptBox[ > SuperscriptBox["T", "a"], "b"]], "Input"] > > If I try one-dimensional input, to reach that I must add a bracket \( > ... \) > > In[13]:= \(\(T\^a\)\_b\) > Out[13]= SubscriptBox[SuperscriptBox[T,a],b] > > otherwise I'd get something different and unwanted > > In[2]:= \(T\^a\_b\) > Out[2]= SuperscriptBox[T,SubscriptBox[a,b]] > > Parenthesis as from your undesired behaviour are reproduced with > > In[3]:= \((T\^a)\_b\) > Out[3]= SubscriptBox[RowBox[{(,SuperscriptBox[T,a],)}],b] > > (without the backslashes!) In contrast the complementary T can be > reached by > "T ctrl-_ a ctrl-blank ctrl-^ b" > > Cell[BoxData[ > SuperscriptBox[ > SubscriptBox["T", "a"], "b"]], "Input"] > > or simply as > > In[5]:= \(T\_a\^b\) > Out[5]= SuperscriptBox[SubscriptBox[T,a],b] > > Related forms are produced as they should: > > In[23]:= \(T\_\(a\^b\)\) > Out[23]= SubscriptBox[T,SuperscriptBox[a,b]] > > In[25]:= \(T\^\(a\_b\)\) > Out[25]= SuperscriptBox[T,SubscriptBox[a,b]] > > > If you want to input fluently, perhaps it helps to first enter the > subscription: > "T ctl-_ b arrowleft arrowleft ctrl-^ a end" > > Perhaps you can use the form > > In[29]:= \(T\^a\%b\)//DisplayForm > Out[29]//DisplayForm= > \!\(\* TagBox[\(T\_b\%a\), DisplayForm]\) > > which inputs straight foreword as "T ctrl-^ a ctrl-% b" > > Cell[BoxData[ > SubsuperscriptBox["T", "b", "a"]], "Input"] > > -- > Hartmut > > > >