29

There's a Macro's and Key Binding option in the Preferences Menu, but the only way to utilize these macros is to click through the menus.

How do I get the good ol' classic Ctrl+B -> \textbf{} behaviour that I am so accustomed to?

Do I really have to write my own KeyEquivalents.plistfile? Say it ain't so.

Example:

I have written a block of text and want to mark that entire passage and make it bold. I know I can select Bold from the Macros menu, but is there a keyboard shortcut for this?

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Parham
  • 527
  • Excellent last question. I don't need key bindings to auto-complete environments/commands when writing. Mostly I write a text section first and then I want to format it. So it would be nice to have the text section selected and then do something like right-click and choose from a menu of formatting commands / environments, URL linking etc. – Paglia Orba Aug 15 '13 at 12:17

1 Answers1

45

1. Built-in Short Cuts:

When you pull down the menu items you see the keyboard shortcuts. Here is an example of the Source menu:

enter image description here


2. Command Completion:

If you simply start typing the command you want

enter image description here

hit esc you get:

enter image description here

Hitting esc again:

enter image description here


3. Abbreviations:

Besides command completion there are also abbreviations. All abbreviations for environments start with a ‘b’. For example if you type \bite and hit esc you get the itemize environment:

enter image description here


4. System Preferences:

Furthermore, you can always add your own keyboard shortcuts. For example going to System Preferences → Keyboard, you can define the COMMAND-B option to select the Bold pull down (which does not have a keyboard shortcut defined):

enter image description here

After restart, COMMAND-B yields:

enter image description here


5. Key-Bindings Editor

Under the Source → Key Bindings you can access the key-bindings editor with which (I assume, have not tried this myself) you can set up other keyboard sequences:

enter image description here

From Page 6 of the TeXShop Tips & Tricks which can be accessed from the Help menu:

e.g. pressing Opt-, with a US keyboard layout, usually enters into your document but with Key Binding enabled \leq will be entered. Similarly, with some text selected pressing " will surround the selected text with `` and ''.

6. Macros Editor:

From Page 7 of TeXShop Tips & Tricks:

Text macros are simple text substitutions. You can also tell TEXShop to insert any selected text using #SEL#, place the cursor using #INS# and even put in multiple lines in the macro itself. Then you can assign the text macro to a keyboard shortcut. I like to use Cmd-B and Cmd-I to insert \textbf{...} and \emph{...} into the document where ... is any possible selected text. Macros to do that are already under the Macros → Text Styles Menu so we need only assign keyboard shortcuts to them. To assign Cmd-I to the emphasize macro: open the Macro Editor where the form of the Macros menu appears in the left hand pane; click the emphasize macro found under Text Styles; click the Key insertion box and simply insert a lower case ‘i’ (the Cmd key is assumed and additional modifier keys can be checked off ).

enter image description here

Peter Grill
  • 223,288
  • 1
    Ah, I did not know about the autocompletion part. Is it possible to change the button from 'esc'? I do know that those menu items' shortcuts are visible. But for more common commands such as producing italic, bold, emphasized text, are there any shortcuts? – Parham Nov 12 '12 at 09:47
  • @Parham: updated answer. – Peter Grill Nov 12 '12 at 10:00
  • It's a general tendency that things that use Ctrl elsewhere show up with Cmd on Mac. – Mikael Vejdemo-Johansson Nov 12 '12 at 10:40
  • @MikaelVejdemo-Johansson: It was just my way of referring to commonly known shortcuts; I am aware of Mac shortcut customs! – Parham Nov 13 '12 at 04:54
  • 2
    check out this tutorial I made, which shows how to do this this: http://www.youtube.com/watch?v=_N5F8ZBywPI – Jonathan Komar Jan 09 '13 at 18:00
  • @macmadness86: Good tutorial. Personally, not sure I like the auto addition of the closing brace after opening, and repositioning of the cursor. Many macros require more than one pair, and I prefer to have all the matching pairs of {} before going back and filling in the content. Example, for \frac, I'd prefer to have \frac{}{} before filling the numerator and denominator. But others may prefer it the way you have defined it. – Peter Grill Jan 09 '13 at 18:13
  • Very helpful answer. To think I'd been typing out \textit{} manually for the past year... –  Dec 03 '13 at 15:15
  • 1
    Also, you can get \textbf directly by typing \bf and pressing ESC (called the trigger key). You can change the trigger key to TAB in the Source tab of TeXShop->Preferences. If you really want Cmd-B to give \textbf the easiest thing is to create a simple Macro that contains \textbf{#SEL##INS#} and tie it to Cmd-B: that macro already exists in the default set of macros so it only needs to bound to Cmd-B. I also bind \emph{#SEL##INS#} to Cmd-I. – Herb Schulz Dec 05 '18 at 15:25