Latexmk:函数“run_asy”未达到最终目标

Latexmk:函数“run_asy”未达到最终目标

我正在尝试使用latexmkasymptote我在当前目录中有一个名为 的文件latextest.tex和一个名为 的文件夹build。 的内容latextest.tex如下:

\documentclass{article}
\usepackage{asymptote}
\def\asydir{build}
\begin{document}
Hello World.
\begin{asy}
    size(7cm);
    pair A = dir(120);
    pair B = dir(210);
    pair C = dir(330);
    draw(A--B--C--cycle, red + 1.2);
\end{asy}
\end{document}

当我通过运行以下命令编译此文件时,

pdflatex latextest.tex
asy -o build/ build/latextest-1.asy
pdflatex latextest.tex

它可以毫无问题地编译。

但是,当我运行时latexmk latextest.tex,它会产生以下错误消息。

Rc files read:
  /Users/kyawshinthant/.latexmkrc
Latexmk: This is Latexmk, John Collins, 29 May 2021, version: 4.74b.
Rule 'latex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'latextest.tex'
------------
Run number 1 of rule 'latex'
------------
------------
Running 'latex  -recorder  "latextest.tex"'
------------
Latexmk: Missing input file: 'build/latextest-1.eps' from following:
  'Package asymptote Warning: file `build/latextest-1.eps' not found on input line'
Latexmk: Missing input file: 'build/latextest-1.eps' from following:
  'Package asymptote Warning: file `build/latextest-1.eps' not found on input line 12.'
Latexmk: Log file says output to 'latextest.dvi'
Rule 'cusdep asy eps build/latextest-1': The following rules & subrules became out-of-date:
      'cusdep asy eps build/latextest-1'
------------
Run number 1 of rule 'cusdep asy eps build/latextest-1'
------------
Latexmk: In running custom-dependency rule
  to make 'build/latextest-1.eps' from 'build/latextest-1.asy'
  function 'run_asy' did not make the destination.
Collected error summary (may duplicate other messages):
  cusdep asy eps build/latextest-1: Command for 'cusdep asy eps build/latextest-1' gave return code -1
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.

我的.latexmkrc文件如下:

sub run_asy {return system("asy -o build/ '$_'");}
add_cus_dep("asy", "eps", 0, "run_asy");
add_cus_dep("asy", "pdf", 0, "run_asy");
add_cus_dep("asy", "tex", 0, "run_asy");

.asy执行从到 的转换子程序时似乎出现了问题.eps。这里可能出了什么问题?

答案1

在定义自定义依赖项时,$_应将 替换为$_[0],以便.latexmkrc包含:

sub run_asy {return system("asy -o build/ '$_[0]'");}
add_cus_dep("asy", "eps", 0, "run_asy");
add_cus_dep("asy", "pdf", 0, "run_asy");
add_cus_dep("asy", "tex", 0, "run_asy");

相关内容