Texshop macro for braces

How to insert \left( \right) by simply typing e.g. 'cmd+m' on Texshop.

As an example:

write 2+2 and then 'cmd+m' and the output is:

\left(2+2\right)

• There's no need to have \left and \right next to the parentheses. Oct 1 '15 at 22:45
• Nov 30 '15 at 10:01

Although, the left and right are not needed in this specific example, I was looking for a way to create my own macro and this was the first question the popped up. Now that I have figured it out, here is how you would create such a macro in TexShop:

1. In TeXShop go to Macros/Open Macro Editor and a window

2. Select:

3. Chose a name and in the Content: section type

\left(#SEL#\right)#INS#


and select your shortcut key as b (m is used to minimize the window):

4. Select:

5. Optional: Next time you go back into the Macro Editor you will see your custom macro listed and selecting it will show you the contents:

Now if you highlight the 2+2:

hit b you obtain the desired results:

Notes;

• I am currently using v3.57 so if your version is not the same things may be slightly different.
• The #sel# portion is represents the selected text and the #INS# defines where the cursor should be after the macro completes. You can select other commands and see how they are coded if you desire to define a more elaborate macro.

References:

• I should have looked at my own answer in Does TeXShop for Mac have key bindings? before figuring this out all over from scratch, but as this still has new content, decide to answer it. Nov 30 '15 at 9:53