0

I'm using Mac OS X and TeXShop. I wrote a linux script which does some text substitutions and then calls the following main commands:

latex MyFile
biber MyFile
latex MyFile
latex MyFile

After the execution of the script, how can I call the TeXShop-pdf-Viewer?

Right now, I'm obliged to get back to TeXShop and to compile once again to visualize the pdf file and I'd like to automate this step.

  • 1
    You can use open -a TeXShop <file.pdf> – Alan Munn Jan 29 '18 at 15:31
1

The MacOS has an open command which allows you to open any application or document from the command line. So you can use

open -a TeXShop <file.pdf>

to open the PDF from your script.

Since I assume you're using an external editor to edit the source, you should set the TeXShop preferences to Configure for External Editor, and in the Preview panel of the preferences, choose Automatic Preview Update.

  • Thanks @Alan Munn. It works fine. However, if the pdf file is already opened in the viewer, is there a way to update the display instead of opening a new viewer. – rasha Jan 29 '18 at 21:44
  • The displayed file does not correspond to the latest compilation! It opens an older compilation (as said before in a new window file). – rasha Jan 29 '18 at 22:15
  • @rasha Did you change the preferences as I suggested? (Automatic Preview Update)? – Alan Munn Jan 29 '18 at 22:22
  • Yes I did and both issues persist: (i) the first time I execute the suggested command, a new viewer is launched instead of updating the text in the one which is already opened. (ii) The displayed text does not correspond to the latest compilation. Even after executing my script many times (with multiple compilations), an old file is displayed. The former issue is less problematic than the latter, because the new viewer is launched only once. – rasha Jan 30 '18 at 14:43
  • @rasha The solution works for me. When you changed the preferences, did you restart TeXShop? – Alan Munn Jan 30 '18 at 16:13

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.