I'm launching TexShop table from a statistical package. However upon launching I want it to typeset automatically to see the PDF. Now it opens the tex-file and I still have to press the typeset button to see the PDF. Is there a way to execute TexShop files upon opening a tex-file? I'm using Mac.

1 Answer 1


As far as I understood, you just want to use TeXShop to compile your document and open it afterwards, automatically. So your are not using TeXShop as an editor.

If so, you could try to change the command in your statistics package to use pdflatex on the commandline instead of opening TeXShop.

Because I have no idea which statistics package your are using, I'm going to explain using pdflatex on the commandline in general: Open your Terminal and navigate to your working directory using cd <path to your dir> and call pdflatex by simply typing:

pdflatex foo.tex && open foo.PDF

The first part pdflatex foo.tex will compile your tex-file called 'foo.tex' and the second part of the given command && open foo.PDF will open the output PDF-document after compiling was finshed.

You can also pass the path of your file directly to the provided code snippet, so you don't need to navigate to your directory by hand.

If you are not able to change the run command of your statistical package as needed, maybe you could use the commandline instead of the automatically executed run or think about a self-written shell script, which does the commandline stuff for you.

  • @user66806: I do not know 'STATA', so unfortunately I can't give you hints without knowing the used workflow. However, I'm using a Mac, too. So if you could describe how 'TeXShop' is run out of 'STATA' or what your current workflow is like, we propably could find a way solving your problem...
    – albert
    Nov 24, 2014 at 23:10
  • Thanks eventually the solution you gave was working!, The problem was that I had an underscore in my file name, (such as Tab1_cohrt1.tex). When I removed the underscore it worked!
    – user66806
    Nov 25, 2014 at 0:34
  • And I had to use "shell /usr/texbin/pdflatex file.tex" instead of just "shell pdflatex file.tex". "shell" is a stata command, which launch external apps.
    – user66806
    Nov 25, 2014 at 0:40

You must log in to answer this question.

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