Latexmk、gnuplot 和子文件夹

Latexmk、gnuplot 和子文件夹

我尝试设置 latexmk,以便自动生成我的 gnuplot 文件。以下是我所做的:

文件夹/文件结构:

latexmkrc
foo.tex
graphics/plot.gp

latexmk:

add_cus_dep('gp', 'tex', 0, 'gp_to_tex');
sub gp_to_tex {
    system("gnuplot \"$_[0].gp\"");
}

foo.tex:

\begin{figure}[ht]
    \centering
    \input{graphics/plot.tex}
\end{figure}

情节.gp:

# Version: gnuplot 5.0 patchlevel 0
set terminal cairolatex monochrome
set output "graphics/plot.tex"
set format "$%g$"
set sample 200
set xrange [-pi:pi]
set yrange [-1:1]
set xlabel "$x$"
set ylabel "$y=\sin(x)$"
plot sin(x) linewidth 4 dashtype 1


不幸的是,它不起作用,我不知道为什么。有人知道问题出在哪里吗?


latexmk 的相关输出:

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on foo.log.
Latexmk: Missing input file: 'graphics/plot.tex' from line
  '! LaTeX Error: File `graphics/plot.tex' not found.'
Rule 'cusdep gp tex graphics/plot': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'graphics/plot.gp'
   Non-existent destination files:
      'graphics/plot.tex'
------------
Run number 1 of rule 'cusdep gp tex graphics/plot'
------------
=== Creating rule for 'cusdep gp tex graphics/plot'
Latexmk: applying rule 'cusdep gp tex graphics/plot'...
For rule 'cusdep gp tex graphics/plot', running '&do_cusdep( gp_to_tex )' ...


^
"graphics/plot.gp", line 1: invalid command

Rule 'cusdep gp tex graphics/plot', function 'gp_to_tex'
   failed with return code = 256



谨致问候,
菲利普

相关内容