summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/gnuplottex/gnuplottex.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/gnuplottex/gnuplottex.dtx')
-rw-r--r--macros/latex/contrib/gnuplottex/gnuplottex.dtx87
1 files changed, 45 insertions, 42 deletions
diff --git a/macros/latex/contrib/gnuplottex/gnuplottex.dtx b/macros/latex/contrib/gnuplottex/gnuplottex.dtx
index 8cb288f83d..35d3da96e2 100644
--- a/macros/latex/contrib/gnuplottex/gnuplottex.dtx
+++ b/macros/latex/contrib/gnuplottex/gnuplottex.dtx
@@ -42,7 +42,7 @@
%<package> \NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package> \ProvidesPackage{gnuplottex}
%<*package>
- [2019/12/22 v0.9.4 gnuplot graphs in LaTeX]
+ [2020/03/19 v0.9.5 gnuplot graphs in LaTeX]
\RequirePackage{graphicx,moreverb,keyval,ifthen,catchfile}
%</package>
%
@@ -67,7 +67,7 @@
%</driver>
% \fi
%
-% \CheckSum{457}
+% \CheckSum{465}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -108,6 +108,7 @@
% \changes{v0.9.2}{2016/08/21}{Misc bugfixes (thanks fostermaier, Enrico Gregorio, Jan-Benedict Glaw).}
% \changes{v0.9.3}{2019/09/22}{Whitespace fixes (thanks Johannes Hielscher).}
% \changes{v0.9.4}{2019/12/22}{Whitespace fixes (thanks Johannes Hielscher).}
+% \changes{v0.9.5}{2020/03/19}{Make subfolder creation test conditional on shell escape being enabled (thanks Alex Serenko).}
%
% \GetFileInfo{gnuplottex.dtx}
%
@@ -562,7 +563,7 @@
% \fi
\begin{figure}%
\centering%
- \begin{gnuplot}[terminal=tikz, terminaloptions={color dashed providevars a,c}]
+ \begin{gnuplot}[terminal=tikz, terminaloptions={color providevars a,c}]
set key box top left
set key width -0.9
set key height 0.25
@@ -596,7 +597,7 @@
%~\\
%\verb+\begin{figure}%+\\
%\verb+ \centering%+\\
-%\verb+ \begin{gnuplot}[terminal=tikz, terminaloptions={color dashed providevars a,c}]+\\
+%\verb+ \begin{gnuplot}[terminal=tikz, terminaloptions={color providevars a,c}]+\\
%\verb+ set key box top left+\\
%\verb+ set key width -0.9+\\
%\verb+ set key height 0.25+\\
@@ -639,7 +640,7 @@
% \verb+ \centering%+\\
% \verb+ \tikzsetnextfilename{ThisIsASinus}+\\
% \verb+ \begin{tikzpicture}[gnuplot]+\\
-% \verb+ \begin{gnuplot}[terminal=tikz, terminaloptions=color dashed nopicenvironment]+\\
+% \verb+ \begin{gnuplot}[terminal=tikz, terminaloptions=color nopicenvironment]+\\
%\verb+ set grid xtics mxtics lt 0 ls 0+\\
%\verb+ set grid ytics mytics lt 0 ls 0+\\
%\verb+ set key box top left+\\
@@ -698,7 +699,7 @@
\immediate\write18{touch \tmpfile}
\fi
\ifmiktex
- \IfFileExists{\tmpfile.}{\ShellEscapetrue}{\ShellEscapefalse}
+ \IfFileExists{\tmpfile}{\ShellEscapetrue}{\ShellEscapefalse}
\immediate\write18{del "\tmpfile"}
\else
\IfFileExists{\tmpfile}{\ShellEscapetrue}{\ShellEscapefalse}
@@ -708,38 +709,40 @@
\fi
\ifusesubfolder
- \ifmiktex
- \immediate\write18{mkdir gnuplottex}
- \immediate\write18{echo test > "gnuplottex/\tmpfile"}
- \else
- \immediate\write18{mkdir -p "gnuplottex"}
- \immediate\write18{touch "gnuplottex/\tmpfile"}
- \fi
- \IfFileExists{gnuplottex/\tmpfile}{
+ \def\subfolder{gnuplottex}
+ \ifShellEscape
\ifmiktex
- \immediate\write18{del "gnuplottex\@backslashchar\tmpfile"}
+ \immediate\write18{mkdir \subfolder}
+ \immediate\write18{echo test > "\subfolder/\tmpfile"}
\else
- \immediate\write18{rm -f "gnuplottex/\tmpfile"}
+ \immediate\write18{mkdir -p "\subfolder"}
+ \immediate\write18{touch "\subfolder/\tmpfile"}
\fi
- \def\subfolder{gnuplottex/}
- }{
- \PackageWarningNoLine{gnuplottex}
- {Creation of subfolder failed.\MessageBreak
- You'll need to create the folder yourself}
- \def\subfolder{}
- }
+ \IfFileExists{gnuplottex/\tmpfile}{
+ \ifmiktex
+ \immediate\write18{del "\subfolder\@backslashchar\tmpfile"}
+ \else
+ \immediate\write18{rm -f "\subfolder/\tmpfile"}
+ \fi
+ }{
+ \PackageWarningNoLine{gnuplottex}
+ {Creation of subfolder failed.\MessageBreak
+ You'll need to create the folder yourself}
+ \def\subfolder{}
+ }
+ \fi
\else
- \def\subfolder{}
+ \def\subfolder{.}
\fi
\ifShellEscape
\PackageInfo{gnuplottex}
- {Automatically converting gnuplot files.}
+ {Automatically converting gnuplot files}
\else
\PackageWarningNoLine{gnuplottex}
{Shell escape not enabled.\MessageBreak
- You'll need to convert the graphs yourself.}
+ You'll need to convert the graphs yourself}
\fi
\newcounter{fignum}
% \end{macrocode}
@@ -754,7 +757,7 @@
\def\BeforeStream
{\message{Opening gnuplot stream #1}%
\immediate\write\verbatim@out{\string set terminal \gnuplotterminal \gnuplotterminaloptions}%
- \immediate\write\verbatim@out{\string set output '\subfolder\figname.\gnuplottexextension{\gnuplotterminal}'}%
+ \immediate\write\verbatim@out{\string set output '\subfolder/\figname.\gnuplottexextension{\gnuplotterminal}'}%
\ifusesiunitx
\ifthenelse{\equal{\extension}{\string tex}}{\usesiunitxingnuplot}{\PackageWarningNoLine{gnuplottex}{Axis numbers not written in \noexpand\num{}. Use a terminal that allows TeX output to enable this feature.}}
\else
@@ -808,7 +811,7 @@
\def\gnuplotterminaloptions{}%%
\def\gnuplotscale{1}%%
\setkeys{pic}{#1}%%
- \xdef\gnuplotCutFile{\subfolder\figname.gnuplot}%%
+ \xdef\gnuplotCutFile{\subfolder/\figname.gnuplot}%%
\gnuplotverbatimwrite{\gnuplotCutFile}}
{\endgnuplotverbatimwrite%
\gnuplotgraphicsprocess%
@@ -820,24 +823,24 @@
\def\extension{\gnuplottexextension{\gnuplotterminal}}
\long\gdef\gnuplotgraphicsprocess{%
\ifShellEscape%
- \IfFileExists{\subfolder\figname.gnuplot}{%
+ \IfFileExists{\subfolder/\figname.gnuplot}{%
\ifmiktex
- \immediate\write18{\gnuplotexe\space \subfolder\figname.gnuplot}%
+ \immediate\write18{\gnuplotexe\space \subfolder/\figname.gnuplot}%
\else
- \immediate\write18{\gnuplotexe\space \subfolder\figname.gnuplot\space 2>>\jobname.gnuploterrors}%
+ \immediate\write18{\gnuplotexe\space \subfolder/\figname.gnuplot\space 2>>\jobname.gnuploterrors}%
\fi%
- \IfFileExists{\subfolder\figname.\extension}{%
- \PackageInfo{gnuplottex}{\subfolder\figname.gnuplot converted}%
+ \IfFileExists{\subfolder/\figname.\extension}{%
+ \PackageInfo{gnuplottex}{\subfolder/\figname.gnuplot converted}%
\ifcleanup
\ifmiktex
- \immediate\write18{del "\subfolder\figname.gnuplot"}%
+ \immediate\write18{del "\subfolder/\figname.gnuplot"}%
\else
- \immediate\write18{rm -f "\subfolder\figname.gnuplot"}%
+ \immediate\write18{rm -f "\subfolder/\figname.gnuplot"}%
\fi%
\fi%
}
{\PackageWarningNoLine{gnuplottex}
- {Conversion of \subfolder\figname.gnuplot failed}}}{}%
+ {Conversion of \subfolder/\figname.gnuplot failed}}}{}%
\fi}
\long\def\gnuploterrors@eatpar#1#2\@nil{\def\gnuploterrors@{#2}}
\AtEndDocument{%
@@ -858,13 +861,13 @@
% \subsection{Graph inclusion}
% \begin{macrocode}
\long\gdef\gnuplotgraphicsinclude{%
- \IfFileExists{\subfolder\figname.\extension}{%
+ \IfFileExists{\subfolder/\figname.\extension}{%
\ifthenelse{\equal{\extension}{\string tex}}
- {\scalebox{\gnuplotscale}{\input{\subfolder\figname.\extension}}}
- {\includegraphics[scale=\gnuplotscale]{\subfolder\figname.\extension}}
+ {\scalebox{\gnuplotscale}{\input{\subfolder/\figname.\extension}}}
+ {\includegraphics[scale=\gnuplotscale]{\subfolder/\figname.\extension}}
}
{\PackageWarningNoLine{gnuplottex}
- {Please convert \subfolder\figname.gnuplot manually}}
+ {Please convert \subfolder/\figname.gnuplot manually}}
}
% \end{macrocode}
%
@@ -874,7 +877,7 @@
\immediate\openout \verbatim@out #1%
\message{Opening gnuplot stream #1}%
\immediate\write\verbatim@out{\string set terminal \gnuplotterminal \gnuplotterminaloptions}%
- \immediate\write\verbatim@out{\string set output '\subfolder\figname.\gnuplottexextension{\gnuplotterminal}'}%
+ \immediate\write\verbatim@out{\string set output '\subfolder/\figname.\gnuplottexextension{\gnuplotterminal}'}%
\ifusesiunitx
\ifthenelse{\equal{\extension}{\string tex}}{\usesiunitxingnuplot}{\PackageWarningNoLine{gnuplottex}{Axis numbers not written in \noexpand\num{}. Use a terminal that allows TeX output to enable this feature.}}
\else
@@ -897,7 +900,7 @@
\def\gnuplotterminaloptions{}
\def\gnuplotscale{1}
\setkeys{pic}{#1}
- \xdef\gnuplotCutFile{\subfolder\figname.gnuplot}
+ \xdef\gnuplotCutFile{\subfolder/\figname.gnuplot}
\gnuplotloadfilewrite{\gnuplotCutFile}{#2}
\gnuplotgraphicsprocess%
\gnuplotgraphicsinclude