1

I was able to create customized typesetting engines according to the procedure below. How can I force TeXShop to always pick my custom engine by default when opening a new file?

It is quite annoying to have to change this for every new file I'm opening.


How to create a custom typesetting engine (instructions for MacOS):

  • Create new typesetting engines by adding bash files (with file ending .engine) to ~/Library/TeXShop/Engines. Below is an example for myLaTeX.engine.
  • Make sure to set the executable bit for new engines: chmod +x ~/Library/TeXShop/Engines/myLaTeX.engine
  • Restart TeXShop
  • Choose the engine from the drop-down list: "myLaTeX"

Screenshot of the engine selection

#!/bin/bash

###############################################################################
# myLaTeX.engine
###############################################################################

# Typeset with pdflatex using a separate build folder.
# Fast typesetting.
BUILD_DIR="build"
mkdir -p "$BUILD_DIR"

# In case that the source files reside in subfolders...
echo "Creating subfolders..."
for d in $(find "." -type d -not -path '*/\.*'); do
    echo "    $d"
    # Exclude symlinks
    [ -L "${d%/}" ] && continue
    # Exclude the BUILD_DIR
    [[ $d = ./$BUILD_DIR/* ]] && continue
    mkdir -p build/$d
done

pdflatex --output-dir="$BUILD_DIR" \
         --file-line-error \
         --shell-escape \
         --synctex=1 "$1"

# For TeXShop to work properly, copy the pdf and the sync file to
# the source directory.
cp "$BUILD_DIR/${1%.*}.synctex.gz" "${1%.*}.synctex.gz"
cp "$BUILD_DIR/${1%.*}.pdf" "${1%.*}.pdf"
#open -a TeXShop "$(echo $1 | sed 's/\(.*\)\..*/\1\.pdf/')"

1 Answer 1

1

In the TeXShop preferences you can set the default engine in the Typesetting panel's "Default Command":

Additionally, you can always specify the engine to be used on a per document basis using a magic comment. See:

TeXShop panel

1
  • Thanks. I thought it was something easy... :)
    – normanius
    Oct 7, 2022 at 14:41

You must log in to answer this question.

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