# Converting a text selection to subscript?

I have expressions with lots of variables which were typed quickly, like for example vx, vy, etc..., but now I wish to convert the important results to a nice formatting. It would be greatly convenient for me to select the x in vx and turn it into subscript, but, however the subscript tool in the typesetting palette just starts a subscript cursor for typing a new subscript.

Isn't it possible to convert some chars to subscript just like when you convert them to bold in a text editor?

newvar[vx_] := Module[{var}, var = Characters[ToString[vx]];
ToExpression[SubscriptBox[StringJoin[var[[1 ;; -2]]], var[[-1]]]]]

newvar[vx]
newvar[uvx]


$\rm v_x$

$\rm uv_x$

z = newvar[uvx]


$\rm uv_x$ =5 (assign value to subscripted variable)

z


5

• I have upvoted your answer because it's certainly helpful, although I wished for a GUI-based format change. Finally I did the changes manually. – cesss Nov 13 '16 at 13:36