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"
#!/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/')"