In TeXShop, my current knitr engine is

export PATH=$PATH:/usr/texbin:/usr/local/bin
Rscript -e "library(knitr); knit('$1')"
latexmk -pdf "${1%.*}"

My current XeLaTeX engine is


set path= ($path /Library/TeX/texbin /usr/texbin /usr/local/bin)
xelatex  -file-line-error -synctex=1 "$1"
  1. How do I replace latexmk with an equivalent xelatex command in the knitr engine?
  2. The current default shell in MacOS is zsh. Could the response to 1 include a modification for zsh.
  • Try latexmk -xelatex "${1%.*}" – DG' Sep 20 '20 at 19:29

I suggest you might want to keep latexmk, to make sure the document is fully compiled. If you create a latexmkrc file in your working directory containing

$pdf_mode = 1;
$pdflatex = 'xelatex -file-line-error -synctex=1 %O %S';

then latexmk will use the invocation there, and you can even remove "-pdf" from the call.

(%O stands for latexmk options, e.g. if you set $recorder = 1, then -recorder will be added here; %S stands for the file name.)

You could also set this using the -pdflatex switch to latexmk.

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.