TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to configure TeXshop to automatically run a script on a document at the beginning of the typesetting process? I am interested in having the application run a python script on the document to perform a number of regular expression substitutions, and send the result to TeXShop to typeset.

Slightly more complicated, is it possible to configure TeXShop to do this after expanding any input or include files into the document?

share|improve this question
The closest solution I can suggest is adding an engine to the "typesetting" engine menu. This lets you run your application if you click on "it." The TeXShop documentation explains how to add an engine to the menu. – Marc van Dongen Jan 1 '13 at 8:57
For your second question: as it is not texshop but the (la)tex compiler that reads and expands the input and includes you cannot configure this in texshop. But it shouldn't be too complicated to imitate the behaviour of input and include within your python script or to make your script recognize and follow the input links. – Benedikt Bauer Jan 1 '13 at 19:50

The first part of the question can be addressed by creating a custom script and adding this to the typesetting menu of TeXshop (or indeed any TeX editor). All you are then doing is putting whatever instructions you want to run before a call to latex (or similar).

As commented, the second part is not possible directly as your editor doesn't read the TeX files itself: the TeX engine you use (pdfTeX, XeTeX, ...) does that. The nearest you can get is to parse the file yourself before running the typesetting, but this is non-trivial!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.