如何配置 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 2014MacOS 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";

相关内容