# [OS X TeX] TeXShop balance begin/end

Herbert Schulz herbs at wideopenwest.com
Wed Sep 15 20:38:21 EDT 2010

On Sep 15, 2010, at 5:55 PM, M. Tamer Özsu wrote:

> There is one available that Ramón Figueroa-Centeno had announced some time ago. You can get it from here:
>
> http://www2.hawaii.edu/~ramonf/TeXShop/index.html
>
> ==Tamer
>
> On 2010-09-16, at 3:55 AM, Herbert Schulz wrote:
>
>>
>> On Sep 15, 2010, at 1:44 PM, Nestor Aguilera wrote:
>>
>>> El Mie, 15 de Septiembre de 2010, 14:28, Herbert Schulz escribió:
>>>>
>>>> On Sep 15, 2010, at 9:34 AM, Nestor Aguilera wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Does the TeXShop editor have a command for balancing begin/end pairs (in
>>>>> the source file)?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Nestor
>>>
>>>> Howdy,
>>>>
>>>> Do you mean that it inserts matched pairs when you press the opening
>>>> delimiter; e.g., you press { and you get {} with any selection and the
>>>> insertion point between them?
>>> [...]
>>>> If you mean matching the delimiters as they are created, e.g., when you
>>>> press the closing delimiter it flashes back to the matching starting
>>>> delimiter, make sure TeXshop->Preferences->Source->Parens Matching is
>>>> checked.
>>> [...]
>>>
>>> No, I don't have problems with that. Rather I was wondering if there is a
>>> method for selecting anything between matching begin/end pairs, e.g.,
>>> given
>>>
>>> \begin{enumerate}
>>> \item one
>>> \begin{itemize}
>>> \item two
>>> \end{itemize}
>>> \end{enumerate}
>>>
>>> I would like to select anything between \begin{itemize} - \end{itemize} or
>>> between \begin{enumerate} - \end{enumerate}.
>>>
>>> Thanks,
>>>
>>> Nestor
>>
>> Howdy,
>>
>> Not built into TeXShop but you might be able to build a Macro using Applescript. It would have to check about possible nesting, etc., so it wouldn't be trivial.
>>
>> Good Luck,
>>
>> Herb Schulz
>> (herbs at wideopenwest dot com)

Howdy,

Unless I'm interpreting things wrong, I don't think those macros do what Nestor wants them to do.

If you really want to produce full, balanced environments to fill in I think the best thing is to use Command Completion. See the documentation in ~/Library/TeXShop/CommandCompletion/. If the documentation isn't there update to the latest TeXShop, remove that CommandCompletion folder and restart TeXShop.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)