diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/pstool/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pstool/example/example.tex | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pstool/pstool.pdf | bin | 401851 -> 424582 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/pstool/pstool.tex | 104 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pstool/pstool.sty | 86 |
5 files changed, 151 insertions, 46 deletions
diff --git a/Master/texmf-dist/doc/latex/pstool/README b/Master/texmf-dist/doc/latex/pstool/README index f79652298f1..8e45f3581c5 100644 --- a/Master/texmf-dist/doc/latex/pstool/README +++ b/Master/texmf-dist/doc/latex/pstool/README @@ -1,6 +1,6 @@ __________________ The pstool package -v1.0 +v1.1 A package like "pst-pdf" for processing PostScript graphics with psfrag labels within pdfLaTeX documets. The difference diff --git a/Master/texmf-dist/doc/latex/pstool/example/example.tex b/Master/texmf-dist/doc/latex/pstool/example/example.tex index e2d3f4d77c5..3c5e8210fcb 100644 --- a/Master/texmf-dist/doc/latex/pstool/example/example.tex +++ b/Master/texmf-dist/doc/latex/pstool/example/example.tex @@ -2,7 +2,6 @@ \documentclass[12pt]{memoir} \usepackage[a5paper]{geometry} \usepackage{color} -\color{red} \usepackage[ process=all, % mode=nonstop, @@ -10,12 +9,14 @@ % cleanup={} ]{pstool} \input macros.tex -\begin{document} \EndPreamble +\begin{document} +\color{red} External macros: \a, \b, \c \psfragfig{trial}{% + \tiny \psfrag{[Mp]}{$M_\a$!}% } diff --git a/Master/texmf-dist/doc/latex/pstool/pstool.pdf b/Master/texmf-dist/doc/latex/pstool/pstool.pdf Binary files differindex a6239824660..7d25e63e325 100644 --- a/Master/texmf-dist/doc/latex/pstool/pstool.pdf +++ b/Master/texmf-dist/doc/latex/pstool/pstool.pdf diff --git a/Master/texmf-dist/source/latex/pstool/pstool.tex b/Master/texmf-dist/source/latex/pstool/pstool.tex index 8290e8905a9..00773481d3b 100644 --- a/Master/texmf-dist/source/latex/pstool/pstool.tex +++ b/Master/texmf-dist/source/latex/pstool/pstool.tex @@ -2,7 +2,7 @@ \begin{filecontents*}{README.txt} __________________ The pstool package -v1.0 +v1.1 A package like "pst-pdf" for processing PostScript graphics with psfrag labels within pdfLaTeX documets. The difference @@ -22,7 +22,7 @@ Copyright 2008 \end{filecontents*} \begin{filecontents}{pstool.sty} -\ProvidesPackage{pstool}[2008/08/31 v1.0 +\ProvidesPackage{pstool}[2009/04/24 v1.1 Wrapper for processing PostScript/psfrag figures] % External packages @@ -78,6 +78,22 @@ Copyright 2008 \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% @@ -130,8 +146,11 @@ Copyright 2008 \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 @@ -267,18 +286,19 @@ Copyright 2008 -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{% @@ -349,15 +369,21 @@ Copyright 2008 } % 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% @@ -366,18 +392,38 @@ Copyright 2008 }% }% }% - \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% }% } @@ -469,9 +515,9 @@ This package defines the \cmd\psfragfig\ user command for including \EPS\ files While directly producing \PDF\ output with pdf\/\LaTeX\ is a great improvement in many ways over the `old method' of \DVI$\to$\PS$\to$\PDF, it loses the ability to interface with a generic PostScript workflow, used to great effect in numerous packages, most notably \pkg{PSTricks} and \pkg{psfrag}. -Until now, the best way to use these packages while running pdf\/\LaTeX\ has been to use the \pkg{pst-pdf} package, which processes the entire document through a filter, sending the relevant PostScript environments (only) through a single pass of \LaTeX\ producing \DVI$\to$\PS$\to$\PDF. The resulting \PDF\ versions of each graphic are then included into the pdf\/\LaTeX\ document in the next compilation. The \pkg{auto-pst-pdf} package provides a wrapper to perform all of this automatically. +Until now, the best way to use these packages while running pdf\/\LaTeX\ has been to use the \pkg{pst-pdf} package, which processes the entire document through a filter, sending the relevant PostScript environments (only) through a single pass of \LaTeX\ producing \DVI$\to$\PS$\to$\PDF. The resulting \PDF\ versions of each graphic are then included into the pdf\/\LaTeX\ document in a subsequent compilation. The \pkg{auto-pst-pdf} package provides a wrapper to perform all of this automatically. -The disadvantage with this method is that for every document compilation, \emph{every} graphic must be re-processed. The \pkg{pstool} package uses a different approach to allow each graphic to be processed only as-needed, speeding up and simplifying the typesetting of the main document. +The disadvantage with this method is that for every document compilation, \emph{every} graphic must be re-processed. The \pkg{pstool} package uses a different approach to allow each graphic to be processed only as needed, speeding up and simplifying the typesetting of the main document. At present this package is designed solely as a replacement for \pkg{pst-pdf} in the r\^ole of supporting the \pkg{psfrag} package (which it loads) in pdf\/\LaTeX. @@ -545,13 +591,25 @@ Each graphic echoes the output of its auxiliary process to the console window; u \end{description} These three package options correspond to the \LaTeX\ command line options \texttt{-interaction=batchmode}, \texttt{=nonstopmode}, and \texttt{=errorstopmode}, respectively. When \pkgopt{mode=batch} is activated, then \pkg{dvips} is also run in `quiet mode'. +\subsection{Auxiliary processing command line options} +The command line options passed to each program of the auxiliary processing can be changed with the following package options: +\begin{description} +\item[\pkgopt{latex-options}] ; +\item[\pkgopt{dvips-options}] ; +\item[\pkgopt{ps2pdf-options}] ; and, +\item[\pkgopt{pdfcrop-options}] . +\end{description} +For the most part these will be unnecessary, although passing the correct options to |ps2pdf| can sometimes be a little obscure. For example, I use the following for generating figures in my thesis:\par +{\centering|ps2pdf-options={-dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress}|\par} +I believe this incantation forces fonts to be embedded within the individual figure files, without which some printers and \textsc{pdf} viewers have trouble with the textual labels. + \section{Miscellaneous details} \subsection{The \cmd\EndPreamble\ command} At present, \pkg{pstool} scans the preamble of the main document by redefining |\begin{document}|, but this is rather fragile because many classes and packages do their own redefining which overwrites \pkg{pstool}'s attempt. In this case, place the command\par {\centering|\EndPreamble|\par}\noindent -where-ever you'd like the preamble in the auxiliary processing to end. This is also handy to bypass anything in the preamble that will never be required for the figures but which will slow down or otherwise conflict with the auxiliary processing. +where-ever you'd like the preamble in the auxiliary processing to end (although is must be placed before |\begin{document}| for obvious reasons). This is also handy to bypass anything in the preamble that will never be required for the figures but which will slow down or otherwise conflict with the auxiliary processing. \subsection{Cross-reference limitations} 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% }% } |