![gnuplottex 和 lualatex](https://rvso.com/image/266433/gnuplottex%20%E5%92%8C%20lualatex.png)
編輯:這個問題涵蓋了一個錯誤gnuplottex
該問題將在 TeXLive 2013 中修復。
讓gnu.tex
\documentclass[border=3mm]{standalone}
\usepackage{gnuplottex} % use gnuplot
\usepackage{epstopdf} % convert resulting eps to pdf
\begin{document}
\begin{gnuplot}[terminal=epslatex,terminaloptions=color]
set xlabel '$x$'
set ylabel '$y$'
plot sin(x) title '$\sin x$'
\end{gnuplot}
\end{document}
我現在正在嘗試使用lualatex
;進行編譯不幸的是,這不起作用。我lualatex
以這樣的方式打電話
$ lualatex --shell-escape gnu.tex
日誌檔案讀取
...
\write18 enabled.
...
Package gnuplottex Warning: Shell escape not enabled.
(gnuplottex) You'll need to convert the graphs yourself..
...
如果我使用pdflatex
和 命令列進行編譯
$ pdflatex --shell-escape gnu.tex
它工作得很好。
概括:gnuplottex
與不相容lualatex
?
答案1
我認為這是一個錯誤gnuplottex.sty
:套件透過寫入檔案/tmp
並為其分配名稱來測試 shell 轉義沒有擴大。 TeX 實作在處理檔案名稱中缺少副檔名方面可能有所不同,但在找到副檔名時應該執行相同的操作。所以如果測試是
%% test if shell escape really works
\ifShellEscape
\def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time.tex}
\ifmiktex
\def\tmpfile{w18-test-\the\year\the\month\the\day\the\time.tex}
\immediate\write18{echo t > "\tmpfile"}
\else
\immediate\write18{touch \tmpfile}
\fi
\IfFileExists{\tmpfile}{\ShellEscapetrue}{\ShellEscapefalse}
\ifmiktex
\immediate\write18{del "\tmpfile"}
\else
\immediate\write18{rm -f \tmpfile}
\fi
\fi
一切都會起作用(我已經添加了一個明確的.tex
擴展)。
您可以透過新增自己的測試來解決此錯誤:
\documentclass[border=3mm]{standalone}
\usepackage{gnuplottex} % use gnuplot
\usepackage{pdftexcmds,ifluatex}
\makeatletter
\ifluatex
\ifnum\pdf@shellescape=\@ne
\ShellEscapetrue
\fi
\fi
\makeatother
\usepackage{epstopdf} % convert resulting eps to pdf
\begin{document}
\begin{gnuplot}[terminal=epslatex,terminaloptions=color]
set xlabel '$x$'
set ylabel '$y$'
plot sin(x) title '$\sin x$'
\end{gnuplot}
\end{document}
-shell-escape
您仍然會收到該訊息,但當命令列中給出該訊息時,文件將正確編譯。不過,您需要 LuaTeX 版本 >0.67 才能解決此問題。