10
$\begingroup$

The document for Subsuperscript says that:

To enter a subsuperscript in a notebook, use either Ctrl+_ to begin a regular subscript or Ctrl+^ to begin a regular superscript. After typing the first script, use Ctrl+% to move to the opposite script position. Ctrl+Space moves out of the subscript or superscript position.

This just create a expresion that looks like a symbol with subsuperscript! Specifically, I typed Ctrl+- / Ctrl+6 and a regular subscript / superscript appeared, Ctrl+5 and the opposite script appeared, and after I moved the cursor out of the symbol by pressing and checked its InputForm, what I saw is not something like

Subsuperscript[a, x, y]

but

Subscript[a, x]^y

Snapshot:

Mathematica graphics

What's wrong with it, I misunderstood the document? I use Mathematica 8.0.4 and Windows Vista Home Basic 32bit.

$\endgroup$
7
  • $\begingroup$ works as expected with 8.0.4 on OS X 10.6.8 $\endgroup$ Jan 16, 2013 at 8:03
  • $\begingroup$ The standard procedure (i.e. Ctrl+^ then Ctrl+%) works for me at Win. XP or Win. 7/Math. 8 or 9. May it be the Vista peculiarity? $\endgroup$ Jan 16, 2013 at 8:09
  • $\begingroup$ @Szabolcs My keyboard is the same as yours i.e. I actually type Ctrl+6 and then Ctrl+5. Let me add it to the question. $\endgroup$
    – xzczd
    Jan 17, 2013 at 5:52
  • $\begingroup$ @AlexeiBoulbitch A friend of mine reproduced the error with 8.0.4 on Windows 7 64bit… $\endgroup$
    – xzczd
    Jan 17, 2013 at 5:53
  • $\begingroup$ This error also appears in version 7 on Windows Vista 32bit. The StandardForm for Subscript[a, x]^y looks just like that for Subsuperscript[a, x, y], have you checked its InputForm or tried to Set a value to it? $\endgroup$
    – xzczd
    Jan 18, 2013 at 8:32

3 Answers 3

7
$\begingroup$

It appears that when you use Control-% to create something that looks like $x_a^b$, the underlying box representation will be a SubsuperscriptBox. However, the interpretation of a SubsuperscriptBox["x", "a", "b"] box is the expression Subscript[x, a]^b. The expression Subsuperscript[x, a, b]is formatted as TemplateBox[{"x","a","b"}, "Subsuperscript"]] in StandardForm.

As you noticed, as of version 9, the documentation doesn't match the actual behaviour.

Can you contact WRI about this so they can sort it out (either on the documentation side or the software side)?

$\endgroup$
3
  • $\begingroup$ Well, OK, let me try to contact them. $\endgroup$
    – xzczd
    Jan 19, 2013 at 3:23
  • $\begingroup$ The reply from WRI: "Hello, Thank you for taking the time to let us know about this issue in the documentation. I have forwarded this report to our developers in charge of this are of the documentation so that it can be fixed in a future release of Mathematica. Sincerely, Technical Support Wolfram Research, Inc." $\endgroup$
    – xzczd
    Jan 24, 2013 at 6:04
  • $\begingroup$ Documentation will be fixed in a future release (probably not in the v9.0.x cycle). $\endgroup$
    – John Fultz
    Jan 24, 2013 at 11:15
2
$\begingroup$

If you want to have SubsuperscriptBox parse as Subsuperscript instead of Power[Subscript[..], ..], you could do the following:

Unprotect[SubsuperscriptBox];
SubsuperscriptBox /: MakeExpression[SubsuperscriptBox[x_,y_,z_], f:StandardForm] :=
Thread[
    Subsuperscript[
        MakeExpression[x, f],
        MakeExpression[y, f],
        MakeExpression[z, f]
    ],
    HoldComplete
]
Protect[SubsuperscriptBox];
$\endgroup$
1
$\begingroup$

Use Mathematica's Notation package to define what your particular form means. Here I create a datatype G[] from sub- and superscripted letter e. Note in the final example that regular superscripting still means raise to a power.

Here's the code:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.