![如何配置 latexmk 编译 tmp 文件然后替换 pdf/synctex 文件?](https://linux22.com/image/476821/%E5%A6%82%E4%BD%95%E9%85%8D%E7%BD%AE%20latexmk%20%E7%BC%96%E8%AF%91%20tmp%20%E6%96%87%E4%BB%B6%E7%84%B6%E5%90%8E%E6%9B%BF%E6%8D%A2%20pdf%2Fsynctex%20%E6%96%87%E4%BB%B6%EF%BC%9F.png)
历史
出于此问题中解释的原因我怎样才能在 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";