TeXStudio:为什么 pgfplots 不能再打开 gnuplot 输出?

TeXStudio:为什么 pgfplots 不能再打开 gnuplot 输出?

这是最小不起作用的示例:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
    title={$0 = \gamma cos(\phi) - 1$},
    view={0}{90},
    xlabel=$\gamma$, ylabel=$\phi$,
    ]
        \addplot3[
        domain=1:1.5,
        domain y=0:6.2831853072,
        contour gnuplot={number=1},
        thick,
        ]
        {x*cos(deg(y)) - 1};
        \end{axis}
\end{tikzpicture}
\end{document}

另一个已知有效的例子是借用现有问题的答案,但它也无效:

\documentclass{article}
\usepackage{pgfplots}

\pgfplotsset{compat=newest}

\begin{document}

\begin{tikzpicture}
\begin{axis}
\addplot +[no markers,
raw gnuplot,
thick,
empty line = jump % not strictly necessary, as this is the default behaviour in the development version of PGFPlots
] gnuplot {
    set contour base;
    set cntrparam levels discrete 0.003;
    unset surface;
    set view map;
    set isosamples 500;
    splot exp(x)*cos(y)-1;
};
\end{axis}
\end{tikzpicture}

\end{document}

第一次运行 *.tex 文件时,出现以下错误和警告:

line 21: Package pgfplots Error: Sorry, the gnuplot-result file 'contour_pgfplot_v2.pg> gnuplot <file>.gnuplot' manually on the respective gnuplot file.. };
: No file contour_pgfplot_v2.aux.
line 22: You have an axis with empty range (in direction y). Replacing it with a default range and clearing all plots.

第二次,我只得到以下内容:

line 21: Package pgfplots Error: Sorry, the gnuplot-result file 'contour_pgfplot_v2.pg> gnuplot <file>.gnuplot' manually on the respective gnuplot file.. };
line 22: You have an axis with empty range (in direction y). Replacing it with a default range and clearing all plots.

答案1

由于我之前强制重启电脑,TeX Studio 出现非正常关闭。这导致它恢复了许多设置,尤其是--shell-escape命令行选项pdflatex。特别是设置恢复到上次保存时的状态,这就是应该会发生这种情况。因此,这些示例不起作用。但是,--shell-escape再次设置选项后,一切正常。

特别是,查看更完整的“日志”窗口而不是“消息”窗口中的错误会给出设置--shell-escape已消失的线索。

相关内容