# [OS X TeX] Command completion troubles

Herbert Schulz herbs at wideopenwest.com
Sun Aug 31 13:44:08 EDT 2014

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

>
> 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.
>

Howdy,

All the information I gave about Command Completion above is available in Help->TeXShop Tips and Tricks. That information is meant to get one started and, hopefully, comfortable using Command Completion. Combined with the list of supplied completions and abbreviations found at the end of the latest, version 0.7.2, TeXShop Tips & Tricks' document (found in Help->TeXShop Tips and Tricks in TeXShop 3.39 or available as TeXShopTips-0.7.2.pdf.zip from <https://dl.dropboxusercontent.com/u/10932738/index.html>).

Those tables are rather long and intimidating so there are several things you should know:

First and foremost, don't even attempt to memorize them!!! It will drive you crazy. Start by picking out a few you use quite a bit, e.g., \benu (to generate an enumerated environment), \bite (ditto for an itemized environment), \it to generate a new \item, \em for \emph, \bf to \textbf.

Second, notice there are many abbreviations that start the same way. If you use just the common part as the abbreviation successive presses of the trigger key (Esc by default) will go down that list. E.g. bali starts quite a few of abbreviations

bali         (align env)
balis        (align* env)
baliat       (alignat env)
baliats      (alignat* env)
balied       (aligned env)
baliedat     (alignedat env)
baliedato    (alignedat env with optional argument)

so if you type

\bali

and press the trigger you will first get and align environment; pressing the trigger again will give an align* environment, etc. So memorizing all of these separately isn't worth the trouble even if you take it as a challenge.

Finally, there are many fine points that can make using Command Completion even easier to use. E.g., there is no need to use the leading \ if the abbreviation comes just after a space, tab or pressing Return (newline) so

\benu

and

benu

will both give you an enumerated environment if you place benu at the start of a line (or after a space or tab character.

I think that's more than enough additional information for now. If you want still more details please let me know. there is certainly lots more!

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

`