gnuplottex と lualatex

gnuplottex と lualatex

編集:この質問は、gnuplottexこれは TeXLive 2013 で修正される予定です。それでもバグを修正したい場合は、CTAN から最新のアップストリーム バージョンをダウンロードして自分でコンパイルしてください。


させて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、それに名前を割り当てることでシェルエスケープをテストします。それなし拡張子。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 が必要です。

関連情報