I have a program that generates .tex files and then compiles them using pdflatex through the Mac Terminal. I am simply using some python code to achieve the same effect as the following command:

pdflatex filename.tex

Is it possible to make pdflatex open the final pdf after it has finished generating it?

  • 1
    No, what should pdflatex do with the PDF once it is finished with it. You might want to ask your python script to ask the Mac to open the file in a PDF viewer. BTW: I usually use latexmk -pdf -pv file.tex for this (it is a PERL script that usually comes with MacTeX) – daleif May 27 '15 at 12:33
  • 3
    The command you're looking for is called open. – Mike Renfro May 27 '15 at 17:50
  • I use Skim as PDF viewer, which sports an “autorefresh” option for regenerated PDF files. Just open the PDF file with Skim (open -a Skim <filename>.pdf) and upon recompilation it will refresh (the first time you'll be asked if you want automatic refresh). – egreg May 27 '15 at 20:28

No. You should ask your OS's PDF viewer to do that. Most PDFviewers (except Acrobat, afaik), allow you to update the pdf file while still open. See the comments to complete the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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