I have a problem with latexmk on my Mac. I'm using emacs as my latex editor, and have configured it to use latexmk. I have specified an output directory, but for synctex to work I need the pdf and .synctex file in the working directory.
On my Windows computer this works perfectly fine with the following lines in my .latexmkrc file:
$out_dir = 'build';
$pdflatex = 'cmd /c lualatex -interaction=nonstopmode -synctex=1 %O %S && copy %D %R.pdf && copy %Z%B.synctex.gz';
If however, I try to use the same line on my Mac, only the pdf is copied, the .synctex file stays untouched. I cannot figure out why it does not work. I have not yet tested it on Linux to see if it works there.
This is the line I use on the Mac:
$out_dir = 'build';
$pdflatex = 'lualatex -interaction=nonstopmode -synctex=1 %O %S;cp %D %R.pdf;cp %Z%B.synctex.gz';
According to latexmks manual the syntax and placeholders should be correct, and as I said it does work on Windows. I tried things like adressing the 'build' directory directly instead of using the placeholder %Z, but it didn't do the trick.
I hope that someone can help me with that problem, thanks in advance ;-)
copy
should take a single argument as 'copy the argument to the current working directory'. Unix (including OS X) will not take a single argument forcp
. You'll need to provide it a destination directory, either as an absolute or relative path. If%Z
is one directory below your real destination, you should be able to use%Z/..
, as incp %Z%B.synctex.gz %Z/..
-- you might get away withcp %Z%B.synctex.gz .
, too.