Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have very strong desire to use superscript as the index of the variable.

However, it looks like that the Mathematica automatically recognize the superscript as the power and I got message that my variable with superscript is 'protected'.

Could you help me to make the superscript used as the index of the variable instead of power?

UPDATE (16-June-2015):

This question is being reopened and a bounty is being awarded on this. Previous answers are very good, however the bounty is to be awarded on an answer which solve this specific problem:

How to change the behaviour of Ctrl+^ keybinding so that it produces Superscript instead of Power.

share|improve this question
I'm not sure if it's possible to do, although somebody else might have an answer. I've had this problem before, and just use subscripts instead. For example: $$v_{k\_,j\_}:=\mbox{Sin}[k^2+j^3];$$ Is there a reason why subscripts are not as good for your application? – DumpsterDoofus Oct 8 '13 at 18:38
@shivams, these seem related to your update of this question:, – Michael E2 Jun 16 '15 at 19:15
@MichaelE2 Incidentally I believe one will need to edit the Menu items rather than the KeyEvent items if one is to override this particular combination. If you can show me otherwise please do so. – Mr.Wizard Jun 17 '15 at 8:23
I was wondering about that, because I noticed the difference in the other answers and yours. It makes sense that Menu key combinations are intercepted before they become a KeyEvent in a particular notebook. But I assume one could get a superscript with a different combination using KeyEvent, which would be my preferred solution, since I use Ctrl-6 so often -- I want Power! ;-) – Michael E2 Jun 17 '15 at 12:39
@Michael I added that to my answer too. I still don't like the fact that the typesetting menu says Superscript when it means Power however. – Mr.Wizard Jun 17 '15 at 16:24

Superscript is not interpreted as Power:

enter image description here

Presumably you are referring to what happens when you enter a power in superscript notation using the key combination Ctrl+6. Mathematica is capable of representing both this power notation and a formatted plain Superscript. In my opinion it is a failing that the power notation appears in the Typesetting menu while the latter is missing; if anything it should be the other way around I think. Since there is no key combination for raw Superscript I propose using a palette or input alias:


You may enter a formatting template using a palette button which may be created with:

CreatePalette @ PasteButton @ Superscript[\[SelectionPlaceholder], \[Placeholder]]

enter image description here

Click that palette button to insert a template for plain superscript in the current Notebook. Use Tab to move between fields.

Input alias

Either open the Option Inspector, select Global Preferences, type "InputAliases" to find the appropriate entry, and add this to the list of rules:

"sps" -> TemplateBox[{"\[SelectionPlaceholder]", "\[Placeholder]"}, "Superscript"]

Or add it programmatically (run this only once):

 CurrentValue[$FrontEnd, "InputAliases"],
 "sps" -> TemplateBox[{"\[SelectionPlaceholder]", "\[Placeholder]"}, "Superscript"]

Now type: EscspsEsc to enter a template for plain Superscript.

(In version 10.0.0 the first field will not be automatically selected due to a bug; see Input Aliases in Mathematica 10.)


A bounty was added for:

[A] solution to map the Ctrl+^ keybinding to produce superscript instead of power.

To accomplish this first copy from the installation directory to the matching path in your user directory and open the user copy for editing:

os = $OperatingSystem /. "Unix" -> "X";

CopyFile @@ (
  FileNameJoin[{#, "SystemFiles", "FrontEnd", "TextResources", os, ""}] & /@
    {$InstallationDirectory, $UserBaseDirectory})

% // SystemOpen

Then within the user copy edit the appropriate MenuItem to read:

   FrontEnd`SelectionMove[FrontEnd`InputNotebook[], All, Word], 
    TemplateBox[{"\[SelectionPlaceholder]", "\[Placeholder]"}, "Superscript"], 
 MenuKey["6", Modifiers -> {"Control"}]

Restart Mathematica.

You may now enter raw Superscript by using Ctrl+6 where 6 is the number-line six above the alphabetic keyboard.

You can still enter Power notation by using Ctrl+Shift+6 or Ctrl+Keypad-6, the latter assuming that Num Lock is on.

For those you prefer the reverse behavior you can instead copy and edit and change the Item:

Item[KeyEvent["^", Modifiers -> {Control}], "Superscript"]


Item[KeyEvent["^", Modifiers -> {Control}], 
     FrontEnd`SelectionMove[FrontEnd`InputNotebook[], All, Word], 
      TemplateBox[{"\[SelectionPlaceholder]", "\[Placeholder]"}, "Superscript"], 

Now Ctrl+6 is Power and Ctrl+Shift+6 is raw Superscript. However the Typesetting menu item remains misleadingly named Superscript so I would personally change that to Power if adopting this binding.

Also see:

share|improve this answer
Glad that you updated your bounty answer to match Linux systems as well. This should now work for Windows and Linux. However, perhaps if you get your hands around a Mac, then check if this works on that as well. – shivams Jun 23 '15 at 7:54

For internal representation, I prefer avoiding subscripts and superscripts, so I'll give a way for using superscripts for input and output formatting, while the internal expression is of the form x[i].

For output formatting, something like this:

Format[x[i_]] := Superscript[x, i]


Table[x[i], {i, 3}]

Mathematica graphics

For input, this works, but I would wonder whether it is safe:

Power[x, i_] ^:= x[i];
Power /: Set[Power[x, i_], val_] := x[i] = val;

x^i // InputForm
(* x[i] *)

It also works with keyboard input of superscripts.

(x^1 + x^2)^3 // Expand

Mathematica graphics

Mathematica graphics

Mathematica graphics

share|improve this answer

If you want to use superscripts so as to follow some textbook symbols then use Symbolize


I'm going to paste an image because pasting Symbolize gives you this:

Symbolize[ParsedBoxWrapper[SuperscriptBox["y", "1"]]]

enter image description here

share|improve this answer

When I asked people about this before, they wrote up: Displaying index as subscript on output: e.g. C[i] -> C_i with Notation[...] or Interpretation[..]? As with the other answers, this focuses on only output. But uses an Interpretation instead of just changing the functions themselves. You should just be able to copy/paste the code to try it out. To change from subscripts to superscripts for your code, it should just be a copy/replace.

As for why you shouldn't use subscripts/superscripts, it took me a while to figure it out, but basically it is because $x_i$ is not a symbol. Try to call FullForm on $x_i$ to get Subscript[x,i] which is tough to work with.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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