Superscript prime symbol

This is following Jens's suggestion to use a different Unicode glyph, but different from the answer linked in the corresponding comment. We can use Unicode directly, so let's just find a letter-like modifier glyph that looks good. A quick search for "prime" gives a nice solution in MODIFIER LETTER PRIME. You can type it using the notation \:02b9 which renders as ʹ, or just copy and paste the character itself:

enter image description here

This does not require any packages or prior code.

Closely related \:02c8 and \:02ca are also options and work just as well, the choice is a matter of preference.


This is not really ideal, but it gets you most of the way there:

SetAttributes[makeSuperscript, HoldAllComplete];
makeSuperscript[sym_Symbol] := (
   sym /: MakeBoxes[sym, form_] = With[{name = SymbolName[sym]},
     InterpretationBox[SuperscriptBox[name, "\[Prime]"], sym]
    ];
   sym
  );

makeSuperscript[q]
(* -> InterpretationBox[SuperscriptBox["q", "\[Prime]"], q] *)

The symbol is still called q, but it now looks like $q'$, as the InterpretationBox is not visible. You can either copy and paste the superscripted form (to make assignments, or use in other expressions) or enter it as q, as you prefer.


As mentioned in my comment to the question, I think the best solution is to use a Unicode character (see also the answer by The Vee). Here is a modified version of my earlier answer:

SetOptions[EvaluationNotebook[], 
 InputAliases -> 
  DeleteDuplicates@
   Join[{"'" -> FromCharacterCode[700]}, 
    InputAliases /. 
      Quiet[Options[EvaluationNotebook[], InputAliases]] /. 
     InputAliases -> {}]]

eʼ = 1

(* ==> 1 *)

eʼʼ = 2

(* ==> 2 *)

eʼ + eʼʼ

(* ==> 3 *)

The only modification is that I defined the shortcut so that you can now really enter the prime by typing the actual prime symbol on the keyboard, just surrounded by escape, i.e., Esc'Esc.

As you can see in the example, the input alias immediately converts this to primed variable names, which can be used like any other symbol.