# [OS X TeX] Command completion troubles

Themis Matsoukas tmatsoukas at icloud.com
Wed Aug 27 22:37:12 CEST 2014

Herb,

this a very helpful explanation, I was always confused about these similar but different features. Would be nice to incorporate this in some permanent help file.

Themis

On Aug 25, 2014, at 4:35 PM, Herbert Schulz <herbs at wideopenwest.com> wrote:

>
> Howdy,
>
> There are three features of TeXShop which often get mixed up with each other: Key Bindings (at one time confusingly called Auto-Completion), Macros and Command Completion. Although they share similar features it is possible to tell the difference between them. Key Binding assign a set of keystrokes to the application of a single key; e.g. typing _ produces _{|} (where | is the insertion point --- the place where text will be inserted) or typing ≤ (Opt-, with the English Keyboard) produces \leq. Macros can also can also insert simple text and be given a keyboard shortcut (that always uses the Cmd key plus other keys but are most useful when attached to Applescript programs so they can do special processing of Source text, etc. Command Completion (NOT to be confused with Auto-Completion) allows one to type a partial command or short abbreviation and, when a trigger key is pressed (Esc by default but it can be set to Tab) have that partial command or abbreviation get expanded into a full command or even environment structure. I'll talk about each separately.
>
> Key Bindings:
>
> As stated in TeXShop Tips & Tricks' you turn Key Bindings on by checking TeXShop->Preferences->Source->Editor->Key Bindings. Of course you turn it off by un-checking that preference. You can turn it On/Off for a given document by using the Source->Key Bindings->Toggle On/Off menu item (a Check Mark means it's On). You can see the list of Key Bindings and add more, edit the ones that are already there or delete ones you don't ever want to use by starting up the Key Bindings Editor using the Source->Key Bindings->Eddit Key Bindings File… menu item.
>
> Macros:
>
> The Macros Menu contains a fairly large number of pre-defined macros. Some of them simply insert text but I find the best ones do much more and are embedded Applescript programs. Keyboard shortcuts can be assigned to these macros; they must all contain the Cmd key.
>
> Command Completion:
>
> For Command Completion you enter a partial command name or a short abbreviation, press a trigger key (Esc or, as mentioned above, Tab if so set in TeXShop->Preferences->Source->Command Completion Triggered By:) and it gets expanded. E.g., enter
>
> \sec
>
> on a new line and press the trigger (Esc) and you get
>
> \section{|•|}
>
> (where |•| is a selected bullet [called a Mark in Command Completion parlance] so typing will delete that selected Mark andinsert whatever you type. If you press the trigger again you get the
>
> \section*{|•|}
>
> and another press of the trigger gives
>
> \section[|•|]{•}
>
> for separate section titles in the TOC and the document. For the last case note that there is a second Mark (•) for the second argument. After entering the TOC section title to jump to the next argument (shown by the Mark) by using Source->Command Completion->Marks->Next Mark (Ctl-Cmd-F) which will also select that Mark and then type the section title for the document.
>
> Better yet are abbreviations. E.g., type
>
> \benu
>
> and press the trigger to get
>
> \begin{enumerate}
> \item
> |•|
> \end{enumerate}•
>
> ready to enter the first item. To get a new \item simply type
>
> \it
>
> on a new line and the trigger to add
>
> \item
> |•|
>
> finally to get to the very end of the enumerate environment use (Ctl-Cmd-F) and jump to and select the Mark at the end where simply typing a Return will remove that Mark and take you to the next line.
>
> I hope this straightens things out a bit.
>
> Finally, you say -4- Opened an existing  small .tex file and attempted to invoke the various examples in Herb’s PDF. None of them worked!'' so I'd like to know exactly what you did and what your trigger is set to be. Also, it's bad practice to (re)move anything from ~/Library/TeXShop while TeXShop is active (that's true for any application); first shut TeXShop down and then (re)move the folder/etc.
>
> Good Luck,
>
> Herb Schulz
> (herbs at wideopenwest dot com)
>
>
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

`