From 2ca350121961af1d06876475b5c661ebc41993e6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 24 Jul 2013 21:47:34 +0000 Subject: gnuplottex (24jul13) git-svn-id: svn://tug.org/texlive/trunk@31279 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/latex/gnuplottex/gnuplottex.pdf | Bin 170018 -> 173441 bytes .../source/latex/gnuplottex/gnuplottex.dtx | 95 +++++++++++++++------ .../source/latex/gnuplottex/gnuplottex.ins | 4 +- .../texmf-dist/tex/latex/gnuplottex/gnuplottex.sty | 75 +++++++++++----- 4 files changed, 125 insertions(+), 49 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/gnuplottex/gnuplottex.pdf b/Master/texmf-dist/doc/latex/gnuplottex/gnuplottex.pdf index a0e2f3f4e04..aca2aae1063 100644 Binary files a/Master/texmf-dist/doc/latex/gnuplottex/gnuplottex.pdf and b/Master/texmf-dist/doc/latex/gnuplottex/gnuplottex.pdf differ diff --git a/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.dtx b/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.dtx index 08e088d39ca..53cfc15ee0b 100644 --- a/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.dtx +++ b/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (c) 2006-2013, Lars Kotthoff +% Copyright (c) 2006-2013, Lars Kotthoff and contributors % % Large portions copied from pdftex, % Copyright (c) 2001-3, Radhakrishnan CV @@ -42,7 +42,7 @@ % \NeedsTeXFormat{LaTeX2e}[1999/12/01] % \ProvidesPackage{gnuplottex} %<*package> - [2013/06/28 v0.6 gnuplot graphs in LaTeX] + [2013/07/23 v0.7 gnuplot graphs in LaTeX] \RequirePackage{latexsym,graphicx,moreverb,keyval,ifthen} % % @@ -60,7 +60,7 @@ % % \fi % -% \CheckSum{355} +% \CheckSum{407} % % \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 @@ -91,6 +91,7 @@ % \changes{v0.4.6}{2013/04/14}{Fix bug with temporary file creation in LuaTeX (Henri Menke).} % \changes{v0.5}{2013/06/03}{Provide command to include gnuplot code in file verbatim (Michel Vo\ss{}kuhle).} % \changes{v0.6}{2013/06/28}{Support for \texttt{siunitx} package and tikz terminal (Udo H\"ofel).} +% \changes{v0.7}{2013/07/23}{Add cleanup and subfolder option (Udo H\"ofel).} % % \GetFileInfo{gnuplottex.dtx} % @@ -98,7 +99,7 @@ % % \title{The \textsf{gnuplottex} package\thanks{This document % corresponds to \textsf{gnuplottex}~\fileversion, dated \filedate.}} -% \author{Lars Kotthof\/f\\ \texttt{lars@larsko.org}} +% \author{Lars Kotthoff and contrbutors\\ \texttt{lars@larsko.org}} % % \maketitle % @@ -142,6 +143,9 @@ % graphs. You need to load the \texttt{siunitx} package before % \texttt{gnuplottex} for this to work. If the gnuplot terminal does not % support \TeX, a warning will be given and the functionality not used. +% \item[\oarg{subfolder}] Put the generated graphs in a "gnuplottex" +% subfolder, which will be created automatically. +% \item[\oarg{cleanup}] Delete the \texttt{.gnuplot} files after conversion. % \end{description} % % The following environment can be used to include graphs: @@ -184,11 +188,12 @@ % % \section{Acknowledgements} % -% Thanks to Roy Ratcliffe for the suggestion and basic code for the gnuplot -% terminal specification and handling. Additional thanks to Michel Vo\ss{}uhle -% for the implementation of \verb=\gnuplotloadfile=. -% I would also like to thank all the people who sent me bug reports and feature -% requests. Gnuplottex wouldn't be what it is today without you. +% In addition to the people mentioned in the changelog, I would like to thank +% Roy Ratcliffe for the suggestion and basic code for the gnuplot terminal +% specification and handling. Additional thanks to Michel Vo\ss{}uhle for the +% implementation of \verb=\gnuplotloadfile=. I would also like to thank all the +% people who sent me bug reports, feature requests and patches. Gnuplottex +% wouldn't be what it is today without you. % % \StopEventually{} % @@ -199,6 +204,8 @@ \newif\ifShellEscape \newif\ifmiktex \miktexfalse \newif\ifusesiunitx +\newif\ifcleanup +\newif\ifusesubfolder \newwrite\verbatim@out @@ -206,14 +213,15 @@ \DeclareOption{noshell}{\ShellEscapefalse} \DeclareOption{miktex}{\global\miktextrue} \DeclareOption{siunitx}{\usesiunitxtrue} +\DeclareOption{cleanup}{\cleanuptrue} +\DeclareOption{subfolder}{\usesubfoldertrue} \ExecuteOptions{shell} \ProcessOptions\relax %% test if shell escape really works \ifShellEscape - \def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time.tex} + \def\tmpfile{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} @@ -227,6 +235,33 @@ \fi \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}{ + \ifmiktex + \immediate\write18{del "gnuplottex\@backslashchar\tmpfile"} + \def\subfolder{gnuplottex\@backslashchar} + \else + \immediate\write18{rm -f "gnuplottex/\tmpfile"} + \def\subfolder{gnuplottex/} + \fi + }{ + \PackageWarningNoLine{gnuplottex} + {Creation of subfolder failed.\MessageBreak + You'll need to create the folder yourself} + \def\subfolder{} + } +\else + \def\subfolder{} +\fi + + \ifShellEscape \PackageInfo{gnuplottex} {Automatically converting gnuplot files.} @@ -242,15 +277,13 @@ % \begin{macrocode} \def\figname{\jobname-gnuplottex-fig\thefignum} -\def\usesiunitxingnuplot{{\escapechar=-1\edef\percentforgnuplot{\string\%} - \escapechar=-1\edef\backslashforgnuplot{\string\\} - \immediate\write\verbatim@out{set format '\backslashforgnuplot num{\percentforgnuplot g}'}}} +\def\usesiunitxingnuplot{\immediate\write\verbatim@out{set format '\@backslashchar num{\@percentchar g}'}} \def\gnuplotverbatimwrite#1{% \def\BeforeStream {\message{Opening gnuplot stream #1}% \immediate\write\verbatim@out{\string set terminal \gnuplotterminal \gnuplotterminaloptions} - \immediate\write\verbatim@out{\string set output '\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 @@ -303,7 +336,7 @@ \def\gnuplotterminaloptions{} \def\gnuplotscale{1} \setkeys{pic}{#1} - \xdef\gnuplotCutFile{\figname.gnuplot} + \xdef\gnuplotCutFile{\subfolder\figname.gnuplot} \gnuplotverbatimwrite{\gnuplotCutFile}} {\endgnuplotverbatimwrite% \gnuplotgraphicsprocess% @@ -315,25 +348,33 @@ \def\extension{\gnuplottexextension{\gnuplotterminal}} \long\gdef\gnuplotgraphicsprocess{% \ifShellEscape - \IfFileExists{\figname.gnuplot}{% - \immediate\write18{gnuplot \figname.gnuplot} - \IfFileExists{\figname.\extension}{% - \PackageInfo{gnuplottex}{\figname.gnuplot converted}} + \IfFileExists{\subfolder\figname.gnuplot}{% + \immediate\write18{gnuplot \subfolder\figname.gnuplot} + \IfFileExists{\subfolder\figname.\extension}{% + \PackageInfo{gnuplottex}{\subfolder\figname.gnuplot converted} + \ifcleanup + \ifmiktex + \immediate\write18{del "\subfolder\figname.gnuplot"} + \else + \immediate\write18{rm -f "\subfolder\figname.gnuplot"} + \fi + \fi + } {\PackageWarningNoLine{gnuplottex} - {Conversion of \figname.gnuplot failed}}}{} + {Conversion of \subfolder\figname.gnuplot failed}}}{} \fi} % \end{macrocode} % % \subsection{Graph inclusion} % \begin{macrocode} \long\gdef\gnuplotgraphicsinclude{% - \IfFileExists{\figname.\extension}{% + \IfFileExists{\subfolder\figname.\extension}{% \ifthenelse{\equal{\extension}{\string tex}} - {\scalebox{\gnuplotscale}{\input{\figname.\extension}}} - {\includegraphics[scale=\gnuplotscale]{\figname.\extension}} + {\scalebox{\gnuplotscale}{\input{\subfolder\figname.\extension}}} + {\includegraphics[scale=\gnuplotscale]{\subfolder\figname.\extension}} } {\PackageWarningNoLine{gnuplottex} - {Please convert \figname.gnuplot manually}} + {Please convert \subfolder\figname.gnuplot manually}} } % \end{macrocode} % @@ -343,7 +384,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 '\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 @@ -366,7 +407,7 @@ \def\gnuplotterminaloptions{} \def\gnuplotscale{1} \setkeys{pic}{#1} - \xdef\gnuplotCutFile{\figname.gnuplot} + \xdef\gnuplotCutFile{\subfolder\figname.gnuplot} \gnuplotloadfilewrite{\gnuplotCutFile}{#2} \gnuplotgraphicsprocess% \gnuplotgraphicsinclude diff --git a/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.ins b/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.ins index deccc9b9378..23c75099776 100644 --- a/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.ins +++ b/Master/texmf-dist/source/latex/gnuplottex/gnuplottex.ins @@ -1,5 +1,5 @@ %% -%% Copyright (c) 2006-13, Lars Kotthoff +%% Copyright (c) 2006-13, Lars Kotthoff and contributors %% %% Large portions copied from pdftex, %% Copyright (c) 2001-3, Radhakrishnan CV @@ -40,7 +40,7 @@ \preamble -Copyright (c) 2006-13, Lars Kotthoff +Copyright (c) 2006-13, Lars Kotthoff and contributors Large portions copied from pdftex, Copyright (c) 2001-3, Radhakrishnan CV diff --git a/Master/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty b/Master/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty index 290c26d7465..4f1d47f9a9d 100644 --- a/Master/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty +++ b/Master/texmf-dist/tex/latex/gnuplottex/gnuplottex.sty @@ -6,7 +6,7 @@ %% %% gnuplottex.dtx (with options: `package') %% -%% Copyright (c) 2006-13, Lars Kotthoff +%% Copyright (c) 2006-13, Lars Kotthoff and contributors %% %% Large portions copied from pdftex, %% Copyright (c) 2001-3, Radhakrishnan CV @@ -41,11 +41,13 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{gnuplottex} - [2013/06/28 v0.6 gnuplot graphs in LaTeX] + [2013/07/23 v0.7 gnuplot graphs in LaTeX] \RequirePackage{latexsym,graphicx,moreverb,keyval,ifthen} \newif\ifShellEscape \newif\ifmiktex \miktexfalse \newif\ifusesiunitx +\newif\ifcleanup +\newif\ifusesubfolder \newwrite\verbatim@out @@ -53,14 +55,15 @@ \DeclareOption{noshell}{\ShellEscapefalse} \DeclareOption{miktex}{\global\miktextrue} \DeclareOption{siunitx}{\usesiunitxtrue} +\DeclareOption{cleanup}{\cleanuptrue} +\DeclareOption{subfolder}{\usesubfoldertrue} \ExecuteOptions{shell} \ProcessOptions\relax %% 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} +\ifmiktex \immediate\write18{echo t > "\tmpfile"} \else \immediate\write18{touch \tmpfile} @@ -74,6 +77,32 @@ \fi \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}{ + \ifmiktex + \immediate\write18{del "gnuplottex\@backslashchar\tmpfile"} + \def\subfolder{gnuplottex\@backslashchar} + \else + \immediate\write18{rm -f "gnuplottex/\tmpfile"} + \def\subfolder{gnuplottex/} + \fi + }{ + \PackageWarningNoLine{gnuplottex} + {Creation of subfolder failed.\MessageBreak + You'll need to create the folder yourself} + \def\subfolder{} + } +\else + \def\subfolder{} +\fi + \ifShellEscape \PackageInfo{gnuplottex} {Automatically converting gnuplot files.} @@ -85,15 +114,13 @@ \newcounter{fignum} \def\figname{\jobname-gnuplottex-fig\thefignum} -\def\usesiunitxingnuplot{{\escapechar=-1\edef\percentforgnuplot{\string\%} - \escapechar=-1\edef\backslashforgnuplot{\string\\} - \immediate\write\verbatim@out{set format '\backslashforgnuplot num{\percentforgnuplot g}'}}} +\def\usesiunitxingnuplot{\immediate\write\verbatim@out{set format '\@backslashchar num{\@percentchar g}'}} \def\gnuplotverbatimwrite#1{% \def\BeforeStream {\message{Opening gnuplot stream #1}% \immediate\write\verbatim@out{\string set terminal \gnuplotterminal \gnuplotterminaloptions} -\immediate\write\verbatim@out{\string set output '\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 @@ -142,7 +169,7 @@ \def\gnuplotterminaloptions{} \def\gnuplotscale{1} \setkeys{pic}{#1} - \xdef\gnuplotCutFile{\figname.gnuplot} + \xdef\gnuplotCutFile{\subfolder\figname.gnuplot} \gnuplotverbatimwrite{\gnuplotCutFile}} {\endgnuplotverbatimwrite% \gnuplotgraphicsprocess% @@ -150,27 +177,35 @@ \def\extension{\gnuplottexextension{\gnuplotterminal}} \long\gdef\gnuplotgraphicsprocess{% \ifShellEscape -\IfFileExists{\figname.gnuplot}{% -\immediate\write18{gnuplot \figname.gnuplot} -\IfFileExists{\figname.\extension}{% -\PackageInfo{gnuplottex}{\figname.gnuplot converted}} +\IfFileExists{\subfolder\figname.gnuplot}{% +\immediate\write18{gnuplot \subfolder\figname.gnuplot} +\IfFileExists{\subfolder\figname.\extension}{% +\PackageInfo{gnuplottex}{\subfolder\figname.gnuplot converted} + \ifcleanup + \ifmiktex + \immediate\write18{del "\subfolder\figname.gnuplot"} + \else + \immediate\write18{rm -f "\subfolder\figname.gnuplot"} + \fi + \fi + } {\PackageWarningNoLine{gnuplottex} -{Conversion of \figname.gnuplot failed}}}{} +{Conversion of \subfolder\figname.gnuplot failed}}}{} \fi} \long\gdef\gnuplotgraphicsinclude{% -\IfFileExists{\figname.\extension}{% +\IfFileExists{\subfolder\figname.\extension}{% \ifthenelse{\equal{\extension}{\string tex}} -{\scalebox{\gnuplotscale}{\input{\figname.\extension}}} -{\includegraphics[scale=\gnuplotscale]{\figname.\extension}} +{\scalebox{\gnuplotscale}{\input{\subfolder\figname.\extension}}} +{\includegraphics[scale=\gnuplotscale]{\subfolder\figname.\extension}} } {\PackageWarningNoLine{gnuplottex} -{Please convert \figname.gnuplot manually}} +{Please convert \subfolder\figname.gnuplot manually}} } \newcommand{\gnuplotloadfilewrite}[2]{% \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 '\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 @@ -193,7 +228,7 @@ \def\gnuplotterminaloptions{} \def\gnuplotscale{1} \setkeys{pic}{#1} - \xdef\gnuplotCutFile{\figname.gnuplot} + \xdef\gnuplotCutFile{\subfolder\figname.gnuplot} \gnuplotloadfilewrite{\gnuplotCutFile}{#2} \gnuplotgraphicsprocess% \gnuplotgraphicsinclude -- cgit v1.2.3