summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-07-22 22:47:33 +0000
committerKarl Berry <karl@freefriends.org>2009-07-22 22:47:33 +0000
commitc3e77d64d6cd4a78f811f055c8e66fad01d86afd (patch)
tree691ea5bd93df429ff5e7f81edbc239d35c5f7820 /Master/texmf-dist/source
parent20e5e430bf97131e6017ba654705d49ec2cf28dd (diff)
pstool 1.3 (22jul09)
git-svn-id: svn://tug.org/texlive/trunk@14373 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/pstool/pstool.ins2
-rw-r--r--Master/texmf-dist/source/latex/pstool/pstool.tex351
2 files changed, 215 insertions, 138 deletions
diff --git a/Master/texmf-dist/source/latex/pstool/pstool.ins b/Master/texmf-dist/source/latex/pstool/pstool.ins
index db826218d17..7177afc608e 100644
--- a/Master/texmf-dist/source/latex/pstool/pstool.ins
+++ b/Master/texmf-dist/source/latex/pstool/pstool.ins
@@ -1,4 +1,4 @@
%&latex
\def\pstoolCompile{N}
\input pstool.tex
-\csname@@end\endcsname
+\csname @@end\endcsname
diff --git a/Master/texmf-dist/source/latex/pstool/pstool.tex b/Master/texmf-dist/source/latex/pstool/pstool.tex
index d4b434b399f..cf7901521ef 100644
--- a/Master/texmf-dist/source/latex/pstool/pstool.tex
+++ b/Master/texmf-dist/source/latex/pstool/pstool.tex
@@ -2,34 +2,44 @@
\begin{filecontents*}{README.txt}
__________________
The pstool package
-v1.2b
+v1.3
-A package like "pst-pdf" for processing PostScript graphics
-with psfrag labels within pdfLaTeX documets. The difference
-with this package is that every graphic is compiled individually,
+A package like "pst-pdf" for processing PostScript graphics
+with psfrag labels within pdfLaTeX documets. The difference
+with this package is that every graphic is compiled individually,
drastically speeding up compilation time when only a single
figure needs re-processing.
Running `latex` on pstool.tex will produce the files
pstool.ins, pstool.sty, and README.txt,
-and compile the PDF documentation.
+and compile the PDF documentation.
-Executing `tex pstool.ins` produces the files above
+Executing `latex pstool.ins` produces the files above
except pstool.ins (and the PDF file, obviously).
+Please see the PDF documentation for further information.
+
Will Robertson & Zebb Prime
-Copyright 2008
+Copyright 2008-2009
+
+____________________
+Brief change history
+
+v1.3, July 2009:
+ - [bitmap] option to control compression of bitmap graphics,
+ - Package options may now be set anywhere with \pstoolsetup{},
+ - localised pstool options can be set per-graphic.
+
\end{filecontents*}
\begin{filecontents}{pstool.sty}
-\ProvidesPackage{pstool}[2009/07/03 v1.2b
+\ProvidesPackage{pstool}[2009/07/17 v1.3
Wrapper for processing PostScript/psfrag figures]
% External packages
\RequirePackage{%
catchfile,color,ifpdf,ifplatform,
- graphicx,psfrag,suffix,xkeyval}
-\RequirePackage{inversepath}[2008/07/31 v0.2]
+ graphicx,pdftexcmds,psfrag,suffix,xkeyval}
% Allocations
\newif\if@pstool@pdfcrop@
@@ -57,13 +67,13 @@ Copyright 2008
\ExecuteOptionsX{process=auto}
\define@choicekey*{pstool.sty}{mode}
- [\@tempa\@tempb]{errorstop,nonstop,batch}{%
- \ifnum\@tempb=2\relax
- \@pstool@verbose@false
- \else
- \@pstool@verbose@true
- \fi
- \edef\pstool@mode{\@tempa mode}%
+ [\@tempa\@tempb]{errorstop,nonstop,batch}{%
+ \ifnum\@tempb=2\relax
+ \@pstool@verbose@false
+ \else
+ \@pstool@verbose@true
+ \fi
+ \edef\pstool@mode{\@tempa mode}%
}
\ExecuteOptionsX{mode=batch}
@@ -73,6 +83,29 @@ Copyright 2008
\DeclareOptionX{suffix}{\def\pstool@suffix{#1}}
\ExecuteOptionsX{suffix={-pstool}}
+% There is an implicit |\space| after the bitmap options.
+\define@choicekey*{pstool.sty}{bitmap}
+ [\@tempa\@tempb]{auto,lossless,lossy}{%
+ \ifcase\@tempb
+ \let\pstool@bitmap@opts\@empty
+ \or
+ \def\pstool@bitmap@opts{%
+ "-dAutoFilterColorImages=false"
+ "-dAutoFilterGrayImages=false"
+ "-dColorImageFilter=/FlateEncode"
+ "-dGrayImageFilter=/FlateEncode" % space
+ }
+ \or
+ \def\pstool@bitmap@opts{%
+ "-dAutoFilterColorImages=false"
+ "-dAutoFilterGrayImages=false"
+ "-dColorImageFilter=/DCTEncode"
+ "-dGrayImageFilter=/DCTEncode" % space
+ }
+ \fi
+}
+\ExecuteOptionsX{bitmap=lossless}
+
% \HideAllDefining
% \Define*{latex-options}
% \Define*{dvips-options}
@@ -83,11 +116,12 @@ Copyright 2008
\DeclareOptionX{ps2pdf-options}{\def\pstool@pspdf@opts{#1}}
\DeclareOptionX{pdfcrop-options}{\def\pstool@pdfcrop@opts{#1}}
% \ResumeAllDefining
-\ExecuteOptionsX{%
+\ExecuteOptionsX{
latex-options={},
dvips-options={},
- ps2pdf-options={},
- pdfcrop-options={}}
+ ps2pdf-options={"-dPDFSETTINGS=/prepress"},
+ pdfcrop-options={}
+}
\ifpdf
\ifshellescape\else
@@ -101,6 +135,11 @@ Copyright 2008
\ProcessOptionsX
+% A command to set \pkg{pstool} options after the package is loaded.
+\newcommand\pstoolsetup{%
+ \setkeys{pstool.sty}%
+}
+
% \section{Macros}
% Used to echo information to the console output.
@@ -109,7 +148,8 @@ Copyright 2008
\def\pstool@echo#1{%
\if@pstool@verbose@
\pstool@echo@verbose{#1}%
- \fi}
+ \fi
+}
\def\pstool@echo@verbose#1{%
\immediate\write18{echo "#1"}%
@@ -127,7 +167,9 @@ Copyright 2008
\newcommand\pstool@rm[2]{%
\OnlyIfFileExists{#1#2}{%
\immediate\write18{%
- cd "#1"\pstool@cmdsep\pstool@rm@cmd "#2"}}%
+ cd "#1"\pstool@cmdsep\pstool@rm@cmd "#2"
+ }%
+ }%
}
% 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.
@@ -142,14 +184,19 @@ Copyright 2008
\ifnum\pstool@status > \z@
\PackageWarning{pstool}{Execution failed during process:^^J\space\space#3^^JThis warning occurred}%
\expandafter\pstool@abort
- \fi}
+ \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'}}}
+ An error occured processing graphic
+ \upshape`\pstool@path\pstool@filestub'%
+ }%
+ }%
+}
\def\pstool@abort#1\pstool@endprocess{\pstool@error\@gobble}
\let\pstool@endprocess\@firstofone
@@ -170,7 +217,8 @@ Copyright 2008
\ifwindows\else
\immediate\write18{%
touch #1\pstool@statusfile}%
- \fi}
+ \fi
+}
\def\pstool@statusfile{pstool-statusfile.txt}
% Read the exit status from the temporary file and delete it.\\
@@ -184,62 +232,52 @@ Copyright 2008
Status of process unable to be determined:^^J #1^^J%
Trying to proceed... }%
\def\pstool@status{0}%
- \fi}
+ \fi
+}
\def\pstool@statusfail{\par }% what results when \TeX\ reads an empty file
% \subsection{File age detection}
-% Use |ls| (or |dir|) to detect if the EPS is newer than the PDF.
\def\pstool@IfnewerEPS{%
- \edef\pstool@filenames{\ip@lastelement.eps\space \ip@lastelement.pdf\space}%
- \immediate\write18{%
- cd "\ip@directpath"\pstool@cmdsep
- \ifwindows
- dir /T:W /B /O-D "\ip@lastelement.eps" "\ip@lastelement.pdf" > \pstool@statusfile
- \else
- ls -t "\ip@lastelement.eps" "\ip@lastelement.pdf" > \pstool@statusfile
- \fi
- }%
- \pstool@retrievestatus{\ip@directpath}%
- \ifx\pstool@status\pstool@filenames
+ \ifnum\pdf@strcmp{\pdf@filemoddate{\pstool@path\pstool@filestub.pdf}}
+ {\pdf@filemoddate{\pstool@path\pstool@filestub.eps}}
+ < \z@
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
}
-% A wrapper for \cs{inversepath*}. Long story short, always need a relative path to a filename even if it's in the same directory.
+% Grab filename and filepath. Always need a relative path to a filename even if it's in the same directory.
\def\pstool@getpaths#1{%
- \edef\@tempa{\unexpanded{\inversepath*}{#1}}%
- \@tempa% calculate filename, path \& inverse path
- \ifx\ip@directpath\@empty
- \def\ip@directpath{./}%
+ \filename@parse{#1}%
+ \ifx\filename@area\@empty
+ \def\pstool@path{./}%
+ \else
+ \let\pstool@path\filename@area
\fi
-% Strip off a possible wayward |.eps| suffix.
- \edef\ip@lastelement{%
- \expandafter\pstool@stripEPS\ip@lastelement.eps\@nil
- }%
+ \let\pstool@filestub\filename@base
}
-\def\pstool@stripEPS#1.eps#2\@nil{#1}
-% |test.eps\@nil| $\to$ |test| (|#2| $\to$ \<empty>)\\
-% |test.eps.eps\@nil| $\to$ |test| (|#2| $\to$ |.eps|)
-
% \section{Command parsing}
% User input is \cmd\pstool\ (with optional |*| or |!| suffix) which turns into one of the following three macros depending on the mode.
\newcommand\pstool@alwaysprocess[3][]{%
\pstool@getpaths{#2}%
- \pstool@process{#1}{#3}}
+ \pstool@process{#1}{#3}%
+}
\ifpdf
\newcommand\pstool@neverprocess[3][]{%
- \pstool@includegraphics{#2}}
+ \pstool@includegraphics{#2}%
+ }
\else
\newcommand\pstool@neverprocess[3][]{%
\begingroup
+ \setkeys*{pstool.sty}{#1}%
#3%
- \pstool@includegraphics[#1]{#2}%
- \endgroup}
+ \expandafter\pstool@includegraphics\expandafter[\XKV@rm]{#2}%
+ \endgroup
+ }
\fi
% For regular operation, which processes the figure only if
@@ -254,24 +292,33 @@ Copyright 2008
}%
}{%
\pstool@process{#1}{#3}%
- }}
+ }%
+}
% \section{User commands}
% Finally, define \cmd\pstool\ as appropriate for the mode: (|all|, |none|, |auto|, respectively)
\ifpdf
- \ifcase\pstool@process@choice
- \let\pstool\pstool@alwaysprocess
- \WithSuffix\def\pstool!{\pstool@alwaysprocess}
- \WithSuffix\def\pstool*{\pstool@alwaysprocess}
- \or
- \let\pstool\pstool@neverprocess
- \WithSuffix\def\pstool!{\pstool@neverprocess}
- \WithSuffix\def\pstool*{\pstool@neverprocess}
- \or
- \let\pstool\pstool@maybeprocess
- \WithSuffix\def\pstool!{\pstool@neverprocess}
- \WithSuffix\def\pstool*{\pstool@alwaysprocess}
- \fi
+ \newcommand\pstool{%
+ \ifcase\pstool@process@choice\relax
+ \expandafter \pstool@alwaysprocess \or
+ \expandafter \pstool@neverprocess \or
+ \expandafter \pstool@maybeprocess
+ \fi
+ }
+ \WithSuffix\def\pstool!{%
+ \ifcase\pstool@process@choice\relax
+ \expandafter \pstool@alwaysprocess \or
+ \expandafter \pstool@neverprocess \or
+ \expandafter \pstool@neverprocess
+ \fi
+ }
+ \WithSuffix\def\pstool*{%
+ \ifcase\pstool@process@choice\relax
+ \expandafter \pstool@alwaysprocess \or
+ \expandafter \pstool@neverprocess \or
+ \expandafter \pstool@alwaysprocess
+ \fi
+ }
\else
\let\pstool\pstool@neverprocess
\WithSuffix\def\pstool!{\pstool@neverprocess}
@@ -280,88 +327,97 @@ Copyright 2008
% \section{The figure processing}
-% \cmd\ip@lastelement\ is the filename of the figure stripped of its path (if any)
-\def\pstool@jobname{\ip@lastelement\pstool@suffix}
+% \cmd\pstool@filestub\ is the filename of the figure stripped of its path (if any)
+\def\pstool@jobname{\pstool@filestub\pstool@suffix}
% And this is the main macro.
\newcommand\pstool@process[2]{%
+ \begingroup
+ \setkeys*{pstool.sty}{#1}%
\pstool@echo@verbose{%
^^J^^J=== pstool: begin processing ===}%
\pstool@write@processfile{#1}
- {\ip@directpath\ip@lastelement}{#2}%
- \pstool@exe{auxiliary process: \ip@lastelement\space}
+ {\pstool@path\pstool@filestub}{#2}%
+ \pstool@exe{auxiliary process: \pstool@filestub\space}
{./}{latex
-shell-escape
-output-format=dvi
- -output-directory="\ip@directpath"
+ -output-directory="\pstool@path"
-interaction=\pstool@mode\space
\pstool@latex@opts\space
"\pstool@jobname.tex"}%
% Execute |dvips| in quiet mode if |latex| is not run in (non/error)stop mode:
- \pstool@exe{dvips}{\ip@directpath}{%
+ \pstool@exe{dvips}{\pstool@path}{%
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@pspdf@opts\space
+ \pstool@exe{ps2pdf}{\pstool@path}{%
+ ps2pdf \pstool@bitmap@opts \pstool@pspdf@opts \space
"\pstool@jobname.ps" "\pstool@jobname.pdf"}%
- \pstool@exe{pdfcrop}{\ip@directpath}{%
+ \pstool@exe{pdfcrop}{\pstool@path}{%
pdfcrop \pstool@pdfcrop@opts\space
- "\pstool@jobname.pdf" "\ip@lastelement.pdf"}%
+ "\pstool@jobname.pdf" "\pstool@filestub.pdf"}%
\else
- \pstool@exe{ps2pdf}{\ip@directpath}{%
- ps2pdf \pstool@pspdf@opts\space
- "\pstool@jobname.ps" "\ip@lastelement.pdf"}%
+ \pstool@exe{ps2pdf}{\pstool@path}{%
+ ps2pdf \pstool@bitmap@opts \pstool@pspdf@opts \space
+ "\pstool@jobname.ps" "\pstool@filestub.pdf"}%
\fi
\pstool@endprocess{%
\pstool@cleanup
\pstool@includegraphics{%
- \ip@directpath\ip@lastelement}%
+ \pstool@path\pstool@filestub}%
}%
\pstool@echo@verbose{^^J=== pstool: end processing ===^^J}%
+ \endgroup
}
% The file that is written for processing is set up to read the preamble of the original document and set the graphic on an empty page (cropping to size is done either here with \pkg{preview} or later with \pkg{pdfcrop}).
\def\pstool@write@processfile#1#2#3{%
- \immediate\openout\pstool@out #2\pstool@suffix.tex\relax
- \immediate\write\pstool@out{%
+ \immediate\openout\pstool@out #2\pstool@suffix.tex\relax
+ \immediate\write\pstool@out{%
% Input the main document; redefine the document environment so only the preamble is read:
- \unexpanded{%
- \pdfoutput=0^^J% force DVI mode if not already
- \let\origdocument\document^^J%
- \let\EndPreamble\endinput^^J%
- \def\document{\endgroup\endinput}^^J}%
- \noexpand\input{\jobname}^^J%
+ \unexpanded{%
+ \pdfoutput=0^^J% force DVI mode if not already
+ \let\origdocument\document^^J%
+ \let\EndPreamble\endinput^^J%
+ \def\document{\endgroup\endinput}^^J%
+ }%
+ \noexpand\input{\jobname}^^J%
%
% Now the preamble of the process file: (restoring document's original meaning; empty \cmd\pagestyle\ removes the page number)
- \if@pstool@pdfcrop@\else
- \noexpand\usepackage[active,tightpage]{preview}^^J%
- \fi
- \unexpanded{%
- \let\document\origdocument^^J%
- \pagestyle{empty}^^J}%
+ \if@pstool@pdfcrop@\else
+ \noexpand\usepackage[active,tightpage]{preview}^^J%
+ \fi
+ \unexpanded{%
+ \let\document\origdocument^^J%
+ \pagestyle{empty}^^J%
+ }%
%
% And the document body to place the graphic on a page of its own:
- \unexpanded{%
- \begin{document}^^J%
- \centering\null\vfill^^J}%
- \if@pstool@pdfcrop@\else
- \noexpand\begin{preview}^^J%
- \fi
- \unexpanded{#3^^J}% this is the "psfrag" material
- \noexpand\includegraphics[#1]{\ip@lastelement}^^J%
- \if@pstool@pdfcrop@\else
- \noexpand\end{preview}^^J%
- \fi
- \unexpanded{%
- \vfill\end{document}}^^J%
- }%
- \immediate\closeout\pstool@out}
+ \unexpanded{%
+ \begin{document}^^J%
+ \centering\null\vfill^^J%
+ }%
+ \if@pstool@pdfcrop@\else
+ \noexpand\begin{preview}^^J%
+ \fi
+ \unexpanded{#3^^J}% this is the "psfrag" material
+ \noexpand\includegraphics
+ [\unexpanded\expandafter{\XKV@rm}]
+ {\pstool@filestub}^^J%
+ \if@pstool@pdfcrop@\else
+ \noexpand\end{preview}^^J%
+ \fi
+ \unexpanded{\vfill\end{document}}^^J%
+ }%
+ \immediate\closeout\pstool@out
+}
\def\pstool@cleanup{%
\@for\@ii:=\pstool@rm@files\do{%
- \pstool@rm{\ip@directpath}{\pstool@jobname\@ii}%
-}}
+ \pstool@rm{\pstool@path}{\pstool@jobname\@ii}%
+ }%
+}
\providecommand\EndPreamble{}
@@ -466,7 +522,7 @@ Copyright 2008
%&latex
\def\pstoolCompile{N}
\input pstool.tex
-\csname@@end\endcsname
+\csname @@end\endcsname
\end{filecontents*}
@@ -550,13 +606,24 @@ More flexible usage to provide a complete replacement for \pkg{pst-pdf} (e.g., s
\section{Getting started}
-Load the package as usual; no package options are required by default, but there are a few useful options described later in section~\ref{pkgopt}. Note that you do not need to load \pkg{psfrag} separately. You also do not need to load \pkg{graphicx} separately, but if you do so, ensure that you do \emph{not} include driver information (such as |[pdftex]|); this will play havoc with \pkg{pstool}'s automatic processing stage.
+Processing pdf\/\LaTeX\ documents with \pkg{pstool} requires the `shell escape' feature of pdf\/\TeX\ to be activated.
+This allows execution of auxiliary commands from within \LaTeX, a feature which is often disabled by default for security reasons.
+If shell escape is not enabled, a warning will be issued in console output when the package is loaded.
+Depending how you compile your \LaTeX\ document, shell escape is enabled in different ways.%
+\footnote{On the command line, use the \texttt{-shell-escape} switch. Otherwise, you're on your own.}
+
+Load the package as usual; no package options are required by default, but there are a few useful options described later in section~\ref{pkgopt}.
+Note that you do not need to load \pkg{psfrag} separately.
+You also do not need to load \pkg{graphicx} separately, but if you do so, ensure that you do \emph{not} include driver information (such as |[pdftex]|); this will play havoc with \pkg{pstool}'s automatic processing stage.
The generic command provided by this package is\par
{\centering
- \cmd\pstool\ \arg[graphicx options] \arg{filename} \arg{input definitions}
+ \cmd\pstool\ \arg[options] \arg{filename} \arg{input definitions}
\par}
-It converts the graphic \<filename>|.eps| to \<filename>|.pdf| through a unique \DVI$\to$\PS$\to$\PDF\ process for each graphic, using the preamble of the main document. The resulting graphic is then inserted into the document, with optional \<graphicx options>. Note that these optional arguments take effect in the \emph{processing stage}; if you change the \<options>, you must re-process the figure. The third argument to \cmd\pstool\ allows arbitrary \<input definitions> (such as \cmd\psfrag\ directives) to be inserted before the figure as it is processed.
+It converts the graphic \<filename>|.eps| to \<filename>|.pdf| through a unique \DVI$\to$\PS$\to$\PDF\ process for each graphic, using the preamble of the main document.
+The resulting graphic is then inserted into the document, with \<options> consisting of options for \pkg{graphicx} (e.g., \texttt{angle}, \texttt{scale}) or for \pkg{pstool} (as described later in Section~\ref{pkgopt}).
+Note that these optional arguments take effect in the \emph{processing stage}; if you change the \<options>, you must manually re-process the figure.
+The third argument to \cmd\pstool\ allows arbitrary \<input definitions> (such as \cmd\psfrag\ directives) to be inserted before the figure as it is processed.
The command \cmd\pstool\ can take an optional |*| or |!| suffix to change the behaviour of the command:
\begin{description}
@@ -580,12 +647,15 @@ As above, but inserts the arbitrary code \<input definitions>, which will usuall
\section{Package options}
\label{pkgopt}
+Package options can be set or overridden at any time with \cmd\pstoolsetup\marg{pstool settings}.
+As mentioned in the previous section, these options also may be set in the optional argument to \cmd\pstool\ and \cmd\psfragfig, in which case they apply to that figure alone.
+
\subsection{Forcing/disabling graphics processing}
\label{process}
-While the suffixes |*| and |!| can be used to force or disable (respectively) the processing of each individual graphic, sometimes we want to do this on a global level. The following package options override \emph{all} \pkg{pstool} macros:
+While the suffixes |*| and |!| can be used to force or disable (respectively) the processing of each individual graphic, sometimes we want to do this on a global level. The following package options override \emph{all} \pkg{pstool} macros:
\begin{description}
-\item[\pkgopt{process=auto}] This is the default mode as described in the previous section, in which graphics with suffixes are only (re-)processed if the \EPS\ file is newer or the \PDF\ file does not exist;
+\item[\pkgopt{process=auto}] This is the default mode as described in the previous section, in which graphics without suffixes are only (re-)processed if the \EPS\ file is newer or the \PDF\ file does not exist;
\item[\pkgopt{process=all}] Suffixes are ignored and all \cmd\pstool\ graphics are processed;
\item[\pkgopt{process=none}] Suffixes are ignored and no \cmd\pstool\ graphics are processed.\footnote{If \pkg{pstool} is loaded in a \LaTeX\ document in \DVI\ mode, this is the option that is used since no external processing is required for these graphics.}
\end{description}
@@ -615,22 +685,32 @@ These three package options correspond to the \LaTeX\ command line options \text
\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=...}].
+\item[\pkgopt{latex-options=...}]
+\item[\pkgopt{dvips-options=...}]
+\item[\pkgopt{ps2pdf-options=...}] and,
+\item[\pkgopt{pdfcrop-options=...}] (if applicable).
+\end{description}
+For the most part these will be unnecessary, although passing the correct options to |ps2pdf| can sometimes be a little obscure.\footnote{The manual is here: \url{http://pages.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htm}} For example, I use the following for generating figures in my thesis:%
+\footnote{Note that each \texttt{ps2pdf} option must be quoted in Windows, which is unnecessary but does no harm in Linux and Mac~OS~X.}%
+\par{\centering|ps2pdf-options={"-dPDFSETTINGS=/prepress"}|\par}
+This forces the `base fourteen' fonts to be embedded within the individual figure files, without which some printers and \textsc{pdf} viewers have trouble with the textual labels. In fact, from v1.3 of \pkg{pstool}, this option is now the default.
+Note that subsequent calls to \pkgopt{ps2pdf-options=...} will override the \pkg{pstool} default; use |ps2pdf-options={}| to chose |ps2pdf|'s defaults if necessary.
+
+\subsection{Compression of bitmap data}
+In the conversion using |ps2pdf|, bitmap images are stored using either lossy or lossless compression. The default behaviour for \pkg{pstool} is to force lossless compression, because we believe that to be the most commonly desired use case (you don't want scientific graphics rendered with possible compression artifacts). This behaviour can be adjusted using one of these options:
+\begin{description}
+\item[\pkgopt{bitmap=auto}] do whatever |ps2pdf| does by default, which seems to be to use lossy compression most, if not all, of the time;
+\item[\pkgopt{bitmap=lossy}] bitmap images are compressed like \textsc{jpg}; this is only really suitable for photographs;
+\item[\pkgopt{bitmap=lossless}] bitmap images are compressed like \textsc{png}; this is suitable for screenshots and generated data such as a surface plot within Matlab (\emph{default}).
\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.
+These are just special cases of the \pkgopt{ps2pdf-options=...} option, but using \pkgopt{bitmap=...} is much more convenient since the |ps2pdf| options to effect this behaviour are quite verbose.
+Note that the |auto| and |lossy| outputs differ in quality; |lossy| is lower quality than |auto| even when the latter uses a lossy compression scheme. Adjusting the quality for these options is only possible with relatively complex Ghostscript options.
\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 (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.
+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 \cmd\EndPreamble\ 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}
@@ -638,9 +718,9 @@ The initial release of this package does not support cross-references within the
\subsection{A note on file paths}
-\pkg{pstool} does its best to ensure that you can put image files where-ever you like and the auxiliary processing will still function correctly. In order to ensure this, the external |pdflatex| compilation uses the |-output-directory| feature of \pdfTeX. This command line option is definitely supported on all platforms in TeX~Live~2008 and MiKTeX~2.7, but earlier distributions may not be supported.
+\pkg{pstool} tries to ensure that you can put image files in subdirectories of the main document and the auxiliary processing will still function correctly. In order to ensure this, the external |pdflatex| compilation uses the |-output-directory| feature of \pdfTeX. This command line option is definitely supported on all platforms from TeX~Live~2008 and MiKTeX~2.7 onwards, but earlier distributions may not be supported.
-One problem that \pkg{pstool} does not (currently) solve on its own is the inclusion of images that do not exist in subdirectories of the main document. For example, |\pstool{../Figures/myfig}| will not process by default because \pdfTeX\ usually does not have permission to write into folders that are higher in the heirarchy than the main document. This can be worked around presently in two different ways: (although maybe only for Mac~OS~X and Linux)
+One problem that \pkg{pstool} does not solve on its own is the inclusion of images that do not exist in subdirectories of the main document. For example, |\pstool{../Figures/myfig}| can not process by default because \pdfTeX\ usually does not have permission to write into folders that are higher in the heirarchy than the main document. This can be worked around presently in two different ways: (although maybe only for Mac~OS~X and Linux)
\begin{enumerate}
\item Give |pdflatex| permission to write anywhere with the command:\\
|openout_any=a pdflatex ...|
@@ -648,10 +728,7 @@ One problem that \pkg{pstool} does not (currently) solve on its own is the inclu
\end{enumerate}
\section{Package information}
-The most recent publicly released version of \pkg{pstool} is available at \textsc{CTAN}:\\
-\centerline{\url{http://tug.ctan.org/pkg/pstool/}}\\
-Historical and developmental versions are available at GitHub:\\ \centerline{\url{http://github.com/wspr/pstool/}}\\
-While general feedback at \url{wspr81@gmail.com} is welcomed, specific bugs should be reported through the issue tracker at GitHub: \url{http://github.com/wspr/pstool/issues}.
+The most recent publicly released version of \pkg{pstool} is available at \textsc{ctan}: \url{http://tug.ctan.org/pkg/pstool/}. Historical and developmental versions are available at GitHub: \url{http://github.com/wspr/pstool/}. While general feedback via email is welcomed, specific bugs or feature requests should be reported through the issue tracker: \url{http://github.com/wspr/pstool/issues}.
\subsection{Licence}
@@ -665,4 +742,4 @@ This package is freely modifiable and distributable under the terms and conditio
\DocInput{pstool.sty}
{\addtocontents{toc}{\protect\end{varwidth}}}
-\end{document} \ No newline at end of file
+\end{document}