summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-05-13 22:11:05 +0000
committerKarl Berry <karl@freefriends.org>2014-05-13 22:11:05 +0000
commit00fcabaa49e161d67333186698bd138d19379f1b (patch)
treed75a4a02c0883c6cce3b7963b1ca90a4d1528ff4 /Master/texmf-dist/tex
parenta24fc3622e5dd5faa555ff702953f83bb38d0bb3 (diff)
pstool (11may14)
git-svn-id: svn://tug.org/texlive/trunk@34015 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/pstool/pstool.sty44
1 files changed, 32 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/latex/pstool/pstool.sty b/Master/texmf-dist/tex/latex/pstool/pstool.sty
index 89fd0b24ff9..7c5c56e6586 100644
--- a/Master/texmf-dist/tex/latex/pstool/pstool.sty
+++ b/Master/texmf-dist/tex/latex/pstool/pstool.sty
@@ -1,6 +1,6 @@
% TODO: convert this package into expl3 syntax (will save many lines of code).
-\ProvidesPackage{pstool}[2013/03/11 v1.5b
+\ProvidesPackage{pstool}[2014/05/11 v1.5c
Wrapper for processing PostScript/psfrag figures]
% External packages:
@@ -58,7 +58,19 @@
}
\ExecuteOptionsX{mode=batch}
-\DeclareOptionX{cleanup}{\def\pstool@rm@files{#1}}
+\DeclareOptionX{cleanup}{%
+ \edef\pstool@rm@files{\zap@space #1 \@empty}%
+ \@for\@ii:=\pstool@rm@files\do{%
+ \edef\@tempa{\@ii}%
+ \def\@tempb{.aux}%
+ \ifx\@tempa\@tempb
+ \PackageWarning{pstool}{^^J\space\space%
+ You have requested that ".aux" files be deleted.^^J\space\space
+ Cross-referencing within pstool graphics therefore disabled.^^J%
+ This warning occurred}
+ \fi
+ }
+}
\ExecuteOptionsX{cleanup={.tex,.dvi,.ps,.pdf,.log}}
\DeclareOptionX{suffix}{\def\pstool@suffix{#1}}
@@ -165,6 +177,18 @@
}{}%
}
+% Copy a file if it exists:
+% #1: path
+% #2: filename
+% #3: new filename
+\newcommand\pstool@cp[3]{%
+ \IfFileExists{#1#2}{%
+ \immediate\write18{%
+ 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
@@ -444,9 +468,9 @@
% We need to cache the aux file, so here goes.
% This is because the aux file is cleared for writing after \cs{begin{document}}.
\ifpdf
- \IfFileExists{\jobname.oldaux}{\immediate\write18{\pstool@rm@cmd \jobname.oldaux}}{}
- \immediate\write18{\pstool@cp@cmd \jobname.aux \jobname.oldaux}
- \AtEndDocument{\immediate\write18{\pstool@rm@cmd \jobname.oldaux}}
+ \pstool@rm{}{\jobname.oldaux}
+ \pstool@cp{}{\jobname.aux}{\jobname.oldaux}
+ \AtEndDocument{\pstool@rm{}{\jobname.oldaux}}
\fi
\edef\pstool@auxmarker#1{\string\@percentchar\space <#1PSTOOLLABELS>}
@@ -459,13 +483,9 @@
\edef\pstool@label{pstool-\pstool@path\pstool@filestub}%
\protected@write\@auxout{}%
{\string\newlabel{\pstool@label}{{\@currentlabel}{\the\c@page}}}%
-% And copy the main file's bbl file too: (necessary only for biblatex)
- \IfFileExists{\jobname.bbl}{%
- \IfFileExists{\pstool@path\pstool@jobname.bbl}{%
- \immediate\write18{\pstool@rm@cmd \pstool@path\pstool@jobname.bbl}%
- }{}%
- \immediate\write18{\pstool@cp@cmd \jobname.bbl \pstool@path\pstool@jobname.bbl}%
- }{}%
+% And copy the main file's bbl file too: (necessary only for biblatex but do it always)
+ \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
\def\@tempa{\pdfoutput=0\relax}%