如何將外部程式 (Gnuplot) 與 Lualatex 和 Texmaker 一起使用?

如何將外部程式 (Gnuplot) 與 Lualatex 和 Texmaker 一起使用?

我對 LaTeX 沒有太多經驗,我想設定 Texmaker,以便 LuaLaTeX 可以使用外部程式。

在這種情況下,我想重現一個圖表(使用 Gnuplot (已新增至我的路徑環境變數:在此輸入影像描述)) 來自 PGFplots 的文檔:

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[view={0}{90}]
        \addplot3[domain=-2:2, domain y=-1.3:1.3, contour gnuplot={number=14}] 
            {exp(-x^2-y^2)*x};
    \end{axis}
\end{tikzpicture}
\end{document}

但我收到錯誤訊息:

! Package pgfplots Error: sorry, plot file{"Test"_contourtmp0.table} could not be opened.

經過一些在網路上的研究,似乎 LuaLaTeX 預設不能使用外部程式。所以我嘗試配置TeXmaker以使其成為可能,但我認為沒有這樣的選項,並且TeXmaker手冊沒有告訴我更多...

用 Texmaker 可以做到這一點嗎?

注意:我不知道這是否重要,但我使用 Miktex 發行版。

更新

根據 Gigiair 的建議,我更改了 Texmaker 的預設命令。 在此輸入影像描述

答案1

當然,TeXmaker 會呼叫外部程序,因為latexlualatexxelatex是編譯原始碼的外部程式。但要使用gnuplot,編譯器必須呼叫外部程式。它需要獲得授權才能這樣做。為此,請將“-enable-write18”加入編譯命令中。它應該看起來像這樣:"lualatex -interaction=nonstopmode -enable-write18 %.tex"

相關內容