Ramón's TeXShop Applescripts/Macros

The following are a few of applescripts that I wrote that might be useful when typing a document in TeXShop, which is a very nice frontend for LaTeX on Mac Os X. They were tested with TeXShop version 2.10beta10, on Mac Os X 10.4.10.

To use one of them select "Open Macro Editor…" from the "Macro" menu in TeXShop and create a new macro (assign each a key combination if you wish). Paste the text of the macros, which you can copy directly from your browser after clicking on "view source" below.

  1. Close Begin/End [view source | open in Script Editor]
    This script will close a TeX Begin/End environment. It will handle nested Begin/End environments correctly, and knows if an environment is already closed.
    For example, if an environment starts with \begin{equation*}, then an invocation of the script will close it with \end{equation*}.
  2. Insert Begin/End [view source | open in Script Editor]
    One of the default TeXShop macros, called Begin/End, inserts an Begin/End environment, where the environment name is taken from the current selection. That entails having to type the environment name, select it and then invoke the macro. This script auto selects the environment name (the cursor can be anywhere form the beginning to the end of the word). It also does a better job of handling the situations when the environment name is at the beginning, end or the middle of a line.
  3. Program [view source]
    This script improves on the TeXShop default macro called "Program", i.e., %!TEX TS-program = #INS#, It assumes that engines are installed in ~/Library/TeXShop/Engines/
  4. Encoding [view source]
    Does for "Encoding" the same as the above script does for "Program"
  5. Root [view source]
    Does for "Root" the same as the above two scripts do for "Program" and "Encoding".
    It has the nice feature of letting the user choose between an absolute or a relative path to the root document (it uses Perl to accomplish this).

License

These scripts are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

These scripts are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Copyright

Copyright ©2007 Ramón M. Figueroa-Centeno. All Rights Reserved.

Page updated: Monday, August 6, 2007 8:36 PM HST