# Define Macros to automatically change keyboard input

When using Solve for example, I find myself having to use it in conjunction with other types of functions, like Flatten or Simplify, like:

Flatten[Simplify[Solve[x^2 + 3 x == 2, x]]]

Since I am a complete beginner in building macros in Mathematica, I was trying to see if it were possible to create a macro, where you would type say fss, and it automatically converts it into Flatten[Simplify[Solve[]]], where if possible the cursor is placed right inside the Solve automatically.

I tried to do something like:

InputAutoReplacements -> {"fss" -> Flatten[Simplify[Solve[]]]};

Unfortunately, this did not work...

• related: live-code-templates – Kuba Feb 20 '19 at 15:11
• Why a macro? Just define fss[e_,v_]:=Flatten@Siimplify@Solve[e,v]; – Somos Feb 20 '19 at 16:13

With an input auto replacement like "fss", you need to have some way of telling Mathematica that "fss" is a complete token. That is, "fss" only gets replaced when the next character is not a letter. The usual input auto replacements typically get replaced when you type a letter, e.g., a->b only becomes $$a\to b$$ after you type the letter "b".