Ok, this is no doubt an embarrassingly dumb question but ....

In TeXShop, when I select the macro "Close Begin/End" I just get an Apple Script error message:

A “to” can’t go after this “to”.

So what is the correct usage of this macro? The companion "Insert Begin/End" macro works fine.

  • What macOS and TeXShop versions are you using? Also, TeXshop has a Source->Close Current Environment menu item so that macro isn't needed. Finally, if you have \begine{yourenv} directly followed by pressing Esc you will get \end{yourenv} on the next line with the cursor between them using Command Completion. Apr 29, 2019 at 14:55
  • Latest versions of both OSX and TeXShop. Yes, I knew about the others, so not a mission-critical question! But puzzled by macro behaviour, since it has been part of TeXShop for a fair while. Apr 29, 2019 at 14:58

1 Answer 1


There is a bug on this macro. The AppleScript code, which is also available at this page has a bug on line 141: tell me to to set environment_name to do shell script

Replace tell me to to set by tell me to set.

You could do this replacement in TeXShop by open the Macros > Open Macros editor menu.

After that, suppose your .tex code is:

enter image description here

Note the cursor after \begin{center}. Then call this macro. The code become:

enter image description here

You can find a description of all macros provided by Ramon Figueroa-Centeno for TeXShop at http://www2.hawaii.edu/~ramonf/TeXShop/index.html

  • Ahah! Mystery solved. :) Apr 29, 2019 at 15:23

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .