Shell escape not enabled, is a frequent issue especially when combined with components that are not native to a tex distro path such as Gnuplot in MiKTeX.

For my sins, I run dozens of editor configurations across multiple distros and frequently switch compilation settings, thus need a fairly uniform way to simply check what is or is not active.

I am unclear as to how much each TeX / OS platform variant can internally feed back with reliable file locations when target files are missing. As an example, when calling \addplot3[contour gnuplot on windows I can run the following MWE, but think it could be better done or expanded for broader use by variables, such as a package name. Can any one point me towards good diagnostic routines, possibly platform independent?

%% First sanity test if pdfLaTeX is active
  \errmessage{OK ! pdfLaTeX IS active PRESS ENTER TO CONTINUE}
  \errmessage{plain latex and dvipdf ? PLEASE SWITCH to pdfLaTeX}
%% Second sanity test if shell escape is available
    \errmessage{OK   Shell-Escape IS active  PRESS ENTER TO CONTINUE}
    \errmessage{Shell-Escape is NOT working. PLEASE ADD --shell-escape to pdfLaTeX arguments}
%% if shell escape is working we can get console feedback
\immediate\write18{echo echo Shell-Escape is active > "\tmpfile"}
  \immediate\write18{echo echo You are using pdflatex >> "\tmpfile"}
  \immediate\write18{echo echo plain latex and dvipdf ? switch to pdflatex >> "\tmpfile"}
% Check where gnuplot is Fist check if we can get version info feedback
\immediate\write18{echo gnuplot -e  'show version long' >> "\tmpfile"}
\immediate\write18{echo echo If you do not see version above then add any of the following locations to your path >> "\tmpfile"}
% these lines are under review as it should traverse editor roots, but for present we check relative to root and system path
\immediate\write18{echo where /r \ gnuplot.exe >> "\tmpfile"}
\immediate\write18{echo where gnuplot.exe >> "\tmpfile"}

\immediate\write18{echo set path >> "\tmpfile"}
% Store latest results WILL be overwritten on each run
\immediate\write18{"\tmpfile" >results.txt}
% Add a pause in case user wants to manually edit / run cmd file
\immediate\write18{echo pause>> "\tmpfile"}
\immediate\write18{del "\tmpfile"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.