Update: Just reverse the output of usual Ctrl+/!
Add the following lines to KeyEventTranslations.tr
:
Item[KeyEvent["?", Modifiers -> {Control}],
FrontEndExecute[{
FrontEndTokenExecute["Fraction"],
FrontEndTokenExecute["ExpandSelection"],
NotebookWrite[InputNotebook[], Reverse@NotebookRead@InputNotebook[], Placeholder]
}],
MenuEvaluator -> Automatic
],
and press Ctrl+Shift+/ (? is Shift+/ on my keyboard).
This method is fully compatible with brackets, functions, etc. When nothing is selected the cursor is in the numerator. If you prefer the denominator than use the following
Item[KeyEvent["?", Modifiers -> {Control}],
FrontEndExecute[{
FrontEndTokenExecute["Fraction"],
FrontEndTokenExecute["ExpandSelection"],
NotebookWrite[InputNotebook[], Reverse@NotebookRead@InputNotebook[]],
NotebookFind[InputNotebook[], "\[Placeholder]", Previous, AutoScroll -> False]
}],
MenuEvaluator -> Automatic
],
Previous method:
Item[KeyEvent["?", Modifiers -> {Control}],
FrontEndExecute@Module[{den=NotebookRead@InputNotebook[]},
If[den=={},
SelectionMove[InputNotebook[], All, Expression];
den=NotebookRead@InputNotebook[]];
If[den=={},den="\[Placeholder]"];
NotebookWrite[InputNotebook[],FractionBox["\[Placeholder]",den]];
SelectionMove[InputNotebook[], Previous, Word];
SelectionMove[InputNotebook[], Next, Character];
SelectionMove[InputNotebook[], All, Character]
],
MenuEvaluator -> Automatic
],
MenuEvaluator -> Automatic
is important because without it an unevaluated expression is written.
See also: Customizing Mathematica shortcuts