13

Is there a way to allow TeXShop complete common functions to avoid typing the same word multiple times ?

For example, when you type \sub , TeXShop would automatically provide options to complete the word for you. So that you type \sub - [ Press TAB ] - \subsection ..

I find it tedious to type down common functions repeatedly.

jub0bs
  • 58,916
Razor
  • 2,691

2 Answers2

17

According to About TeXShop (available here)

"Auto completion is user configurable. To configure, open the file ˜/Library/TeXShop/Keyboard/autocompletion.plist with TeXShop. Read the comments at the top, edit appropriately to redefine Landweber’s choices or add your own, and save. Be sure to edit and save in UTF-8 format if you use Unicode characters".

The source editor supports command completion. Type the first few letters of a word and hit the escape key. The remaining letters will be entered. Hitting escape again will cycle through all possible completions.

G al Cubo
  • 161
Mario S. E.
  • 18,609
  • 1
    Also, if you don't like using ESC to trigger completion, you can set it to TAB in the TeXShop preferences. – Alan Munn Apr 10 '13 at 22:31
  • 1
    But don't overlook the separate "command completion" feature of TeXShop that allows you, e.g., to type \mt ESC in order to obtain, in the source edit window, the skeleton environment \begin{theorem}\label{thm:•} • \end{theorem} • split up among 3 lines, with the cursor positioned at the first placeholder. – murray Jun 08 '17 at 20:22
2

This is another way, originally commented by murray, but deserves more attention, so I'm posting this after testing:

Suppose, you want a command completion for \textcolor{red}{coloured text}, which can be used to output coloured text in colour red (to be used with \usepackage[]{xcolor} in the preamble.

  1. The GUI way (with less control of course): type and select \textcolor{}{} in the command window, then press command+shift+W (shortcut for: TexShop menu > Source > Command Compeltion > Add Word). You're now ready to use it on the fly, without restarting your work/ TexShop.

  2. The command completion editor way (If you want more advance functionalities like: the cursor jumps to the first {} while autocompletions is triggered) Go to TexShop menu > Source > Command Compeltion > Add Word. Add this: \textcolor{#INS#•#INS#}{•} at the bottom of the file, press command+s & you're good to go.

I believe, if someone takes a look at the entries present already in the editor, he/she can automate all the autocompletion needs by adding simple entries. is very versatile & powerful editor, with nearly all features built-in, IMO.

Cheers!