2

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)

2

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

    enter image description here

  2. Select:

    enter image description here

  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):

    enter image description here

  4. Select:

    enter image description here

  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:

    enter image description here


Now if you highlight the 2+2:

enter image description here

hit b you obtain the desired results:

enter image description here

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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.