For the reasons explained in this question How can I keep browsing my pdf with synctex at the same time as LaTeX is rebuilding it? I want to modify my latexmk settings.

old configuration

Up to now I had the following working configuration for in the .latexmkrc file:

$pdf_mode = 1;
$pdflatex = 'pdflatex -synctex=1 -interaction=nonstopmode %O %S';
$pdf_previewer = 'open %S';
$pdf_update_method = 0;
$clean_ext = "synctex.gz";

@default_files = ('Diss.tex');

I want to apply the changes proposed here https://tex.stackexchange.com/a/141582/4009 but I am not sure how to mix them with my exiting setup.

new configuration

I tried

$preview_file = "$preview_prefix%R__.pdf";
$sync_file = "$preview_prefix%R__.synctex.gz";

$pdf_mode = 1;
$pdflatex = "pdflatex -synctex=1 -interaction=nonstopmode %O %S'; cp %R.pdf $preview_file; cp %R.synctex.gz $sync_file";
$pdf_previewer = 'open $preview_file';
$pdf_update_method = 0;
$clean_ext = "synctex.gz";

@default_files = ('Diss.tex');

but that gives an error and no files are produced:

Latexmk: This is Latexmk, John Collins, 10 Nov 2013, version: 4.39.
**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Non-existent destination files:
Run number 1 of rule 'pdflatex'
Running 'pdflatex -synctex=1 -interaction=nonstopmode  -recorder  "Diss.tex"'; cp "Diss".pdf __preview__"Diss"__.pdf; cp "Diss".synctex.gz __preview__"Diss"__.synctex.gz'
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  pdflatex: (Pdf)LaTeX failed to generate the expected log file 'Diss.log'
Latexmk: Did not finish processing file 'Diss.tex':
   (Pdf)LaTeX failed to generate the expected log file 'Diss.log'
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.
It took 0 seconds (0 minutes)
grep: Diss.log: No such file or directory

used system

I'm using TeXLive 2014 on MacOS X 10.6. My pdf viewer is Skim.app

  • 1
    Try removing the single quote after %S in your definition of $pdflatex. That works for me. – John Collins Dec 16 '14 at 23:11
  • thanks a lot, if you turn this comment into an answer, I can accept it to close this question. – MostlyHarmless Dec 17 '14 at 9:04

Remove the single quote after %S in your definition of $pdflatex.

$pdflatex = "pdflatex -synctex=1 -interaction=nonstopmode %O %S'; cp %R.pdf $preview_file; cp %R.synctex.gz $sync_file";
$pdflatex = "pdflatex -synctex=1 -interaction=nonstopmode %O %S; cp %R.pdf $preview_file; cp %R.synctex.gz $sync_file";

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.