如何配置latexmk編譯tmp檔案然後替換pdf/synctex檔案?

如何配置latexmk編譯tmp檔案然後替換pdf/synctex檔案?

歷史

由於這個問題中解釋的原因如何在 LaTeX 重建 pdf 的同時繼續使用synctex 瀏覽它?我想修改我的latexmk設定。

舊配置

到目前為止,我在文件中具有以下工作配置.latexmkrc

$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');

我想應用此處建議的更改https://tex.stackexchange.com/a/141582/4009但我不知道如何將它們與我現有的設定混合。

新配置

我試過

$preview_prefix="__preview__";
$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');

但這會出現錯誤並且不會產生任何文件:

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:
      'Diss.pdf'
------------
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

使用的系統

我正在TeXLive 2014使用MacOS X 10.6.我的 pdf 檢視器是Skim.app

答案1

%S刪除的定義中後面的單引號$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";

相關內容