Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

EDIT: This question covers a bug in gnuplottex which will be fixed in TeXLive 2013.If you still want to have the bug fixed, download the latest upstream version from CTAN and compile it yourself.


Let 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}

I am now trying to compile with lualatex; unfortuantely this doesn't work. I called lualatex in the manner

$ lualatex --shell-escape gnu.tex

The log file reads

...
 \write18 enabled.
...
Package gnuplottex Warning: Shell escape not enabled.
(gnuplottex)                You'll need to convert the graphs yourself..
...

If I compile with pdflatex and the command line

$ pdflatex --shell-escape gnu.tex

it works just fine.

Summary: Is gnuplottex incompatible with lualatex?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

I'd consider this a bug in gnuplottex.sty: the package tests shell escape by writing a file in /tmp and assigning it a name without extension. TeX implementations may differ in the treatment of missing extensions in file names, but should do the same thing when an extension is found. So if the test is

%% 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

all will work (I've added an explicit .tex extension).

You can work around this bug by adding your own test:

\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}

You'll still get the message, but the document will compile correctly when -shell-escape is given in the command line. You need LuaTeX version >0.67 for this workaround, though.

share|improve this answer
    
What a great and helpful answer. Thank you very much! –  Henri Menke Apr 14 '13 at 11:19
    
I've e-mailed the developer this bug fix. Is it possible to get this fix back to TeXLive 2012, which is frozen since a week? –  Henri Menke Apr 14 '13 at 11:45
2  
No, as tlmgr says: TeX Live 2012 is frozen forever and will no longer be updated. But you could take the updated package and put it in the same folder as your main tex-file (meaning the one where you are writing you thesis, paper, etc.). To myself: I haven't known gnuplottex, but I think it might be to slow if you have many or complicated graphics. Maybe you would like to let gnuplot run beside (lua/pdf)latex and include the eps- oder converted pdf-files that are generated? Will give you a real speed-up if you have more than lets say...ten plots? –  DL6ER Apr 14 '13 at 11:48
    
@DL6ER Thank you for your answer, although it's a pity that you cannot backport fixes. Regarding the speed issue: You're right, but normally I don't have more than 3 plots and if I'm writing a paper I have to split them off as all the journals only accept separate plots. –  Henri Menke Apr 14 '13 at 12:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.