summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pstool
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-10-13 21:40:42 +0000
committerKarl Berry <karl@freefriends.org>2017-10-13 21:40:42 +0000
commiteb1d91e185ce0b605a76da41e16cf0eb736edc06 (patch)
treebef231291b34b119512e515902a1f475c0e4afce /Master/texmf-dist/tex/latex/pstool
parentc97f4fb8eda9e467d7694621cc5916d75acef5c7 (diff)
pstool (13oct17)
git-svn-id: svn://tug.org/texlive/trunk@45534 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pstool')
-rw-r--r--Master/texmf-dist/tex/latex/pstool/pstool.sty61
1 files changed, 30 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/latex/pstool/pstool.sty b/Master/texmf-dist/tex/latex/pstool/pstool.sty
index 7c5c56e6586..19a1f996df1 100644
--- a/Master/texmf-dist/tex/latex/pstool/pstool.sty
+++ b/Master/texmf-dist/tex/latex/pstool/pstool.sty
@@ -1,12 +1,12 @@
% TODO: convert this package into expl3 syntax (will save many lines of code).
-\ProvidesPackage{pstool}[2014/05/11 v1.5c
+\ProvidesPackage{pstool}[2017/10/13 v1.5d
Wrapper for processing PostScript/psfrag figures]
% External packages:
\RequirePackage{
catchfile,color,ifpdf,ifplatform,filemod,
- graphicx,psfrag,suffix,trimspaces,xkeyval,expl3
+ graphicx,psfrag,shellesc,suffix,trimspaces,xkeyval,expl3
}
% Add an additional command before trimspaces.sty is updated formally:
@@ -156,7 +156,7 @@
}
\def\pstool@echo@verbose#1{%
- \immediate\write18{echo "#1"}%
+ \ShellEscape{echo "#1"}%
}
\let\pstool@includegraphics\includegraphics
@@ -166,33 +166,33 @@
\edef\pstool@rm@cmd{\ifwindows del \else rm -- \fi}
\edef\pstool@cp@cmd{\ifwindows copy \else cp -- \fi}
-% Delete a file if it exists:
-% #1: path
-% #2: filename
+% Delete a file if it exists:\\
+% \#1: path\\
+% \#2: filename
\newcommand\pstool@rm[2]{%
\IfFileExists{#1#2}{%
- \immediate\write18{%
+ \ShellEscape{%
cd "#1"\pstool@cmdsep\pstool@rm@cmd "#2"
}%
}{}%
}
-% Copy a file if it exists:
-% #1: path
-% #2: filename
-% #3: new filename
+% Copy a file if it exists:\\
+% \#1: path\\
+% \#2: filename\\
+% \#3: new filename
\newcommand\pstool@cp[3]{%
\IfFileExists{#1#2}{%
- \immediate\write18{%
+ \ShellEscape{%
cd "#1"\pstool@cmdsep\pstool@cp@cmd "#2" "#3"
}%
}{}%
}
-% Generic function to execute a command on the shell and pass its exit status back into \LaTeX. Any number of \cmd\pstool@exe\ statements can be made consecutively followed by \cmd\pstool@endprocess, which also takes an argument. If \emph{any} of the shell calls failed, then the execution immediately skips to the end and expands \cmd\pstool@error\ instead of the argument to \cmd\pstool@endprocess.
-% #1: `name' of process
-% #2: relative path where to execute the command
-% #3: the command itself
+% Generic function to execute a command on the shell and pass its exit status back into \LaTeX. Any number of \cmd\pstool@exe\ statements can be made consecutively followed by \cmd\pstool@endprocess, which also takes an argument. If \emph{any} of the shell calls failed, then the execution immediately skips to the end and expands \cmd\pstool@error\ instead of the argument to \cmd\pstool@endprocess.\\
+% \#1: `name' of process
+% \#2: relative path where to execute the command
+% \#3: the command itself
\newcommand\pstool@exe[3]{%
\pstool@echo{^^J=== pstool: #1 ===}%
\pstool@shellexecute{#2}{#3}%
@@ -231,7 +231,7 @@
% It is necessary while executing commands on the shell to write the exit status to a temporary file to test for failures in processing. (If all versions of \texttt{pdflatex} supported input pipes, things might be different.)
\def\pstool@shellexecute#1#2{%
- \immediate\write18{%
+ \ShellEscape{%
cd "#1" \pstool@cmdsep
#2 \pstool@cmdsep
\ifwindows
@@ -243,14 +243,14 @@
> \pstool@statusfile}%
% That's the execution; now we need to flush the write buffer to the status file. This ensures the file is written to disk properly (allowing it to be read by \cmd\CatchFileEdef). Not necessary on Windows, whose file writing is evidently more crude/immediate.
\ifwindows\else
- \immediate\write18{%
+ \ShellEscape{%
touch #1\pstool@statusfile}%
\fi
}
\def\pstool@statusfile{pstool-statusfile.txt}
% Read the exit status from the temporary file and delete it.
-% #1 is the path
+% \#1 is the path
% Status is recorded in \cmd\pstool@status.
\def\pstool@retrievestatus#1{%
\CatchFileEdef{\pstool@status}{#1\pstool@statusfile}{}%
@@ -302,9 +302,9 @@
}
\fi
-% Process the figure when:
-% -- the PDF file doesn't exist, or
-% -- the EPS is newer than the PDF, or
+% Process the figure when:\\
+% -- the PDF file doesn't exist, or\\
+% -- the EPS is newer than the PDF, or\\
% -- the TeX file is new than the PDF.
\ExplSyntaxOn
\newcommand\pstool@maybeprocess[3][]
@@ -424,7 +424,7 @@
}
\newcommand\pstool@write@aux{%
- \endlinechar=-1
+ \endlinechar=-1\relax
\@tempswatrue
\@pstool@write@auxfalse
\in@false
@@ -447,7 +447,7 @@
\fi
\fi
\fi
- }
+ }%
\closein \pstool@auxfile@ior
}
@@ -487,7 +487,7 @@
\pstool@rm{\pstool@path}{\pstool@jobname.bbl}%
\pstool@cp{}{\jobname.bbl}{\pstool@path\pstool@jobname.bbl}%
% Scan the main document line by line; print preamble into auxiliary file until the document begins or \cs{EndPreamble} is found:
- \endlinechar=-1
+ \endlinechar=-1\relax
\def\@tempa{\pdfoutput=0\relax}%
\in@false
\openin\pstool@mainfile@ior "\jobname"\relax
@@ -585,12 +585,11 @@
}%
}
-% Search for both `filename' and `filename'-psfrag inputs.
-%
-% #1: possible graphicx options
-% #2: graphic name (possibly with path)
-% #3: \cs{pstool} suffix (i.e., \texttt{!} or \texttt{*} or `empty')
-% #4: possible \pkg{psfrag} (or other) macros
+% Search for both `filename' and `filename'-psfrag inputs.\\
+% \#1: possible graphicx options\\
+% \#2: graphic name (possibly with path)\\
+% \#3: \cs{pstool} suffix (i.e., \texttt{!} or \texttt{*} or `empty')\\
+% \#4: possible \pkg{psfrag} (or other) macros
\newcommand\pstool@@psfragfig[4]{%
% Find the .eps file to use.
\IfFileExists{#2-psfrag.eps}{%