[texworks] \begin...\end environment completion?

Herbert Schulz herbs at wideopenwest.com
Fri May 6 21:29:24 CEST 2011


On May 6, 2011, at 10:12 AM, Murray Eisenberg wrote:

> I'm using current texworks in Mac TeXShop. Is there some way to cause the texworks editor to supply automatically the \end{env} part of a \begin{env}...\end{env} environment delimiters after I type the "\begin{env}" part?
> 
> This is something I'm accustomed to doing in WinEdt under Windows (with any TeX engine). There, for example, if I type
> 
>  \begin{enumerate}
> 
> and press Alt-Enter, the editor automatically inserts a blank line after what I typed, automatically types \end{enumerate}, and positions the cursor back at the start of the blank line, so what I have is:
> 
>  \begin{enumerate}
>  *
>  \end{enumerate}
> 
> A great time-saver.
> 
> I'm told that the Mac is a more user-friendly place to work than a PC with Windows, but I cannot even find documentation about such a feature for texworks (or TeXShop).

Howdy,

Ummmm... Are you using TeXworks or TeXShop?

If you are using TeXShop there are several ways of getting that completion with the latest version: 

(1)If you have

\begin{myenvironment}

with the cursor just after the closing brace simply press Esc and the corresponding

\end{myenvironment}

will be placed on the next line and the cursor will remain where it started.

(2)If you are using TeXShop 2.41 you can complete an environment (i.e., balance \begin...\end) by using the Source->Close Current Environment (Ctl-Cmd-C) which will give you the \end{myenvironment} with the cursor at the end of the statement.

(3)If you are using any of the usual environments you can use Command Completion (TeXworks has a similar feature as TeXShop in this instance). E.g., to get a skeleton for an enumerate environment simply write

\benu

at the start of a line and press Esc (with TeXworks you press Tab --- TeXShop lets you make the ``trigger'' key Tab too in TeXshop->Preferences->Source->Command Completion Triggered By:) and you'll get (a little bit different in TeXworks)

\begin{enumerate}
\item
|•|
\end{enumerate}•

where |•| is a selected • (called a Mark for Command Completion). You can move from Mark to Mark, etc. For TeXShop take a look at ~/Library/TeXShop/CommandCompletion/Quick Start Guide... or the full documentation for a list of all completions/abbreviations supplied by default with TeXShop (~/Library/ is the Library folder in your HOME folder).

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the texworks mailing list