How do I get TeXShop to open with a certain engine already selected when it opens a certain file type? Right now the default engine is always LaTeX, which is fine when I am opening .tex files. However when I open .md files in TeXShop I want the default engine to be something called pandoc-pdf. Is there something I can change so that I don't have to select this from the drop-down menu, and it is automatically selected?


1 Answer 1


It seems that you can combine a Markdown comment (as described here: Comments in Markdown) with a TeXShop directive (as described here: When and why should I use % !TEX TS-program and % !TEX encoding?) and have the best of both worlds. Without the markdown comment, pandoc will output the TeXShop directive line.

[//]: % !TEX TS-program = pandoc-pdf

TeXShop correctly sees this directive line, and pandoc correctly ignores it.

  • This works, but it requires me to add that line at the beginning of every .md file that I open in TeXShop in order to typeset correctly. Is there a way to simply get TeXShop to set its default engine based on the type of file it is opening?
    – proteus7
    Aug 17, 2017 at 17:15
  • No that's not possible I'm afraid.
    – Alan Munn
    Aug 17, 2017 at 17:28
  • One possibility would be to use the Stationery function of TeXShop to create a .md template with that line included. Then you choose New from Stationery to start new files. Alternatively, just create a macro in TeXShop to add that line quickly.
    – Alan Munn
    Aug 17, 2017 at 18:12

You must log in to answer this question.

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