summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pstool
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-04-25 08:02:24 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-04-25 08:02:24 +0000
commit8db463317016335cd456246a0b8b4c94c7978755 (patch)
tree5ee8754e928c1f06d1f95a8ea7ee326d968f4db6 /Master/texmf-dist/tex/latex/pstool
parent942ed3ad7e765266dadcdc94c38622f39d340158 (diff)
Pstool v1.1.
git-svn-id: svn://tug.org/texlive/trunk@12816 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pstool')
-rw-r--r--Master/texmf-dist/tex/latex/pstool/pstool.sty86
1 files changed, 66 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/latex/pstool/pstool.sty b/Master/texmf-dist/tex/latex/pstool/pstool.sty
index 930d5d6f07b..2066b5f25fd 100644
--- a/Master/texmf-dist/tex/latex/pstool/pstool.sty
+++ b/Master/texmf-dist/tex/latex/pstool/pstool.sty
@@ -1,8 +1,8 @@
%% LaTeX2e file `pstool.sty'
%% generated by the `filecontents' environment
-%% from source `pstool' on 2008/08/31.
+%% from source `pstool' on 2009/04/24.
%%
-\ProvidesPackage{pstool}[2008/08/31 v1.0
+\ProvidesPackage{pstool}[2009/04/24 v1.1
Wrapper for processing PostScript/psfrag figures]
% External packages
@@ -58,6 +58,22 @@
\DeclareOptionX{suffix}{\def\pstool@suffix{#1}}
\ExecuteOptionsX{suffix={-pstool}}
+% \HideAllDefining
+% \Define*{latex-options}
+% \Define*{dvips-options}
+% \Define*{ps2pdf-options}
+% \Define*{pdfcrop-options}
+\DeclareOptionX{latex-options}{\def\pstool@latex@opts{#1}}
+\DeclareOptionX{dvips-options}{\def\pstool@dvips@opts{#1}}
+\DeclareOptionX{ps2pdf-options}{\def\pstool@pspdf@opts{#1}}
+\DeclareOptionX{pdfcrop-options}{\def\pstool@pdfcrop@opts{#1}}
+% \ResumeAllDefining
+\ExecuteOptionsX{%
+ latex-options={},
+ dvips-options={},
+ ps2pdf-options={},
+ pdfcrop-options={}}
+
\ifshellescape\else
\ExecuteOptionsX{process=none}
\PackageWarning{pstool}{^^J\space\space%
@@ -110,8 +126,11 @@
\fi}
% Edit this definition to print something else when graphic processing fails.
-\def\pstool@error{\fbox{\parbox{0.8\linewidth}{\color{red}\raggedright\ttfamily\scshape\small
- An error occured processing graphic \upshape`\ip@directpath\ip@lastelement'}}}
+\def\pstool@error{%
+ \fbox{%
+ \parbox{0.8\linewidth}{%
+ \color{red}\raggedright\ttfamily\scshape\small
+ An error occured processing graphic \upshape`\ip@directpath\ip@lastelement'}}}
\def\pstool@abort#1\pstool@endprocess{\pstool@error\@gobble}
\let\pstool@endprocess\@firstofone
@@ -247,18 +266,19 @@
-output-format=dvi
-output-directory="\ip@directpath"
-interaction=\pstool@mode\space
+ \pstool@latex@opts\space
"\pstool@jobname.tex"}%
-% Execute dvips in quiet mode if latex is run in (non/error)stop mode:
+% Execute dvips in quiet mode if latex is not run in (non/error)stop mode:
\pstool@exe{dvips}{\ip@directpath}{%
- dvips \if@pstool@verbose@\else -q \fi -Ppdf "\pstool@jobname.dvi"}%
+ dvips \if@pstool@verbose@\else -q \fi -Ppdf \pstool@dvips@opts\space "\pstool@jobname.dvi"}%
\if@pstool@pdfcrop@
\pstool@exe{ps2pdf}{\ip@directpath}{%
- ps2pdf "\pstool@jobname.ps" "\pstool@jobname.pdf"}%
+ ps2pdf \pstool@pspdf@opts\space "\pstool@jobname.ps" "\pstool@jobname.pdf"}%
\pstool@exe{pdfcrop}{\ip@directpath}{%
- pdfcrop "\pstool@jobname.pdf" "\ip@lastelement.pdf"}%
+ pdfcrop \pstool@pdfcrop@opts\space "\pstool@jobname.pdf" "\ip@lastelement.pdf"}%
\else
\pstool@exe{ps2pdf}{\ip@directpath}{%
- ps2pdf "\pstool@jobname.ps" "\ip@lastelement.pdf"}%
+ ps2pdf \pstool@pspdf@opts\space "\pstool@jobname.ps" "\ip@lastelement.pdf"}%
\fi
\pstool@echo{^^J=== pstool: end processing ===^^J}%
\pstool@endprocess{%
@@ -329,15 +349,21 @@
}
% Search for both \<filename> and \<filename>|-psfrag| inputs.
+%
+% |#1|: possible graphicx options\\
+% |#2|: graphic name (possibly with path)\\
+% |#3|: |\pstool| suffix (i.e., |!| or |*| or empty\\
+% |#4|: possible \pkg{psfrag} macros
\newcommand\pstool@@psfragfig[4]{%
+ % Find the.eps file to use.
\IfFileExists{#2-psfrag.eps}{%
- \def\pstool@eps{#2-psfrag}%
+ \edef\pstool@eps{#2-psfrag}%
\OnlyIfFileExists{#2.eps}{%
\PackageWarning{pstool}{Graphic "#2.eps" exists but "#2-psfrag.eps" is being used}%
}%
}{%
\IfFileExists{#2.eps}{%
- \def\pstool@eps{#2}%
+ \edef\pstool@eps{#2}%
}{%
\PackageError{pstool}{%
No graphic "#2.eps" or "#2-psfrag.eps" found%
@@ -346,18 +372,38 @@
}%
}%
}%
- \pstool#3[#1]{\pstool@eps}{%
- \InputIfFileExists{#2-psfrag.tex}{%
- \OnlyIfFileExists{#2.tex}{%
- \PackageWarning{pstool}{%
- File "#2.tex" exists that may contain macros for "\pstool@eps.eps"^^J%
- But file "#2-psfrag.tex" is being used instead.%
- }%
+ % Find the .tex file to use.
+ \IfFileExists{#2-psfrag.tex}{%
+ \edef\pstool@tex{#2-psfrag.tex}%
+ \OnlyIfFileExists{#2.tex}{%
+ \PackageWarning{pstool}{%
+ File "#2.tex" exists that may contain macros for "\pstool@eps.eps"^^J%
+ But file "#2-psfrag.tex" is being used instead.%
}%
+ }%
+ }{%
+ \IfFileExists{#2.tex}{%
+ \edef\pstool@tex{#2.tex}%
}{%
- \InputIfFileExists{#2.tex}{}{}%
+ \let\pstool@tex\@empty
+ \PackageWarning{pstool}{%
+ No file "#2.tex" or "#2-psfrag.tex" can be found
+ that may contain macros for "\pstool@eps.eps"%
+ }%
}%
- #4%
+ }%
+ \ifx\pstool@tex\@empty
+ \pstool#3[#1]{\pstool@eps}{#4}%
+ \else
+ \expandafter\pstool@@@psfragfig\expandafter{\pstool@tex}{#3[#1]}{#4}%
+ \fi
+}
+
+% Break out the separate function in order to expand |\pstool@tex| before writing it.
+\newcommand\pstool@@@psfragfig[3]{%
+ \pstool#2{\pstool@eps}{%
+ \csname @input\endcsname{#1}%
+ #3%
}%
}