This is a frequently asked question but none I have seen actually helped me. My problem is that I installed Gnuplot 5 and I have not been able to make it work in the TeXworks. The figure I have been trying to plot is this:



        title={Contour plot, view from top},
        contour gnuplot={levels={0.8, 0.4, 0.2, -0.2}}

As many answers have suggested I tried to call gnuplottex in the preamble with the code


yet this did not help and instead I have been getting the error

Package pgfplots Error: sorry, plot file{.._contourmp0.table} could not be opened. See the pgfplots package documentation for explanation 

followed by the warning that Shell escape is not enabled.

Could you please help me in making this work?

EDIT I am aware that there is a phenomenally identical question on this site, namely gnuplottex with windows 8.1 but it does not address my problem. The problem persists even after using \usepackage[miktex]{gnuplottex}, as I pointed out from the beginning.

Following suggestions, I have made sure there is a path towards the bin directory and have included the statement --enable-write18 in the PdfLaTeX command line of TeXworks. All other suggestions are of course welcome.

Also here is my attempt to compile through the command line:

enter image description here

And my Texmaker configuration:

enter image description here

  • Have you seen How to enable shell-escape in TeXworks? Apr 3, 2015 at 13:59
  • @TorbjørnT. I have but the version of TeXWorks discussed is a much older one and many settings have changed. I cannot quite follow it.
    – JohnK
    Apr 3, 2015 at 14:02
  • Huh? Looks exactly the same as the one I have, which according to Help -> About Texworks is version 0.5. Which version do you have, and how does the Preference-window look? Apr 3, 2015 at 14:05
  • @TorbjørnT. Oh dear, it's not TeXworks but Texmaker the one I am working with. Very sorry for the confusion. I amended the name.
    – JohnK
    Apr 3, 2015 at 14:07
  • possible duplicate of gnuplottex with windows 8.1
    – egreg
    Apr 3, 2015 at 14:09

1 Answer 1


You seem to have a MiKTeX distribution. Add the --enable-write18 option to pdflatex options by opening the Options menu, Configure TeXmaker submenu. You'll get this pop-up window:

enter image description here

  • @JohnK It might just be me, and I have no tested it, but on my machine I have in the past successfully used -enable-write18 with just one dash.
    – moewe
    Apr 3, 2015 at 14:48
  • @JohnK You will have to locate the folder with gnuplot.exe in it (on my system that is C:\Program Files (x86)\gnuplot\bin) and add that directory to the PATH variable, see windowsitpro.com/systems-management/… on how to do that.
    – moewe
    Apr 3, 2015 at 15:01
  • @JohnK No, you will have to have something pointing to the bin directory. That might not solve the problem, though. I was just able to reproduce your issue on my computer. The problem seems to be that the file <tksjs>_contourtmp0.table is not created by the packages.
    – moewe
    Apr 3, 2015 at 15:11
  • It should be C:\Program Files (x86)\Gnuplot\bin.
    – Bernard
    Apr 3, 2015 at 15:16
  • @JohnK Have you tried running the compilation of the .tex file from the command line? Via pdflatex -enable-write18 <filename without extension>. If you have changed the PATH the old "have you tried turning it off and on again" trick might help. If all fails, please prepare a MWE and update your question.
    – moewe
    Apr 3, 2015 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .