summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/pstool/README30
-rw-r--r--Master/texmf-dist/doc/latex/pstool/pstool.pdfbin339364 -> 364012 bytes
-rw-r--r--Master/texmf-dist/source/latex/pstool/pstool.tex320
-rw-r--r--Master/texmf-dist/tex/latex/pstool/pstool.sty61
4 files changed, 201 insertions, 210 deletions
diff --git a/Master/texmf-dist/doc/latex/pstool/README b/Master/texmf-dist/doc/latex/pstool/README
index a13e98b9bda..d6413cbe97c 100644
--- a/Master/texmf-dist/doc/latex/pstool/README
+++ b/Master/texmf-dist/doc/latex/pstool/README
@@ -1,7 +1,7 @@
-__________________
The pstool package
+==================
-A package like "pst-pdf" for processing PostScript graphics
+A package like `pst-pdf` for processing PostScript graphics
with psfrag labels within pdfLaTeX documents. The difference
with this package is that every graphic is compiled individually,
drastically speeding up compilation time when only a single
@@ -16,24 +16,28 @@ except pstool.ins (and the PDF file, obviously).
Please see the PDF documentation for further information.
-Will Robertson & Zebb Prime
-Copyright 2008-2014
-Distributed under the LaTeX Project Public License, "maintained" by Will Robertson.
+* Copyright 2008–2014 Zebb Prime
+* Copyright 2008–2017 Will Robertson
+* Distributed under the LaTeX Project Public License, "maintained" by Will Robertson
-____________________
-Brief change history
-v1.5c
+Change history
+--------------------
+
+* v1.5d, Oct 2017:
+ - Use `shellesc` package for write18 in LuaTeX.
+
+* v1.5c:
- Documentation update; some minor cosmetic code changes.
-v1.5b
+* v1.5b:
- Fix conflict with beamer, which resets the catcode of @ with \begin{document}.
-v1.5a, March 2013:
+* v1.5a, March 2013:
- Fix bug introduced in last version in which plain LaTeX compilation
(producing DVI) produced erroneous output above each figure.
-v1.5, February 2013:
+* v1.5, February 2013:
- Fix =/# mixup in Windows ps2pdf options.
- Check the .tex file for newness when regenerating figures.
- Add [macro-file=...] for a global file to retrieve psfrag macros
@@ -41,12 +45,12 @@ v1.5, February 2013:
Thanks to Heinrich Kruger for suggestions for the above.
- Cross-references and citations within external graphics are now supported.
-v1.4, November 2010:
+* v1.4, November 2010:
- More robust parsing of the main input file to read in the preamble.
Therefore, \EndPreamble is now required much less often.
- Apparently unreleased to CTAN, oops :)
-v1.3, July 2009:
+* 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.
diff --git a/Master/texmf-dist/doc/latex/pstool/pstool.pdf b/Master/texmf-dist/doc/latex/pstool/pstool.pdf
index eabd09e4cd0..c06baf837d9 100644
--- a/Master/texmf-dist/doc/latex/pstool/pstool.pdf
+++ b/Master/texmf-dist/doc/latex/pstool/pstool.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/pstool/pstool.tex b/Master/texmf-dist/source/latex/pstool/pstool.tex
index 3799d3a8893..aeac4a814b3 100644
--- a/Master/texmf-dist/source/latex/pstool/pstool.tex
+++ b/Master/texmf-dist/source/latex/pstool/pstool.tex
@@ -1,73 +1,15 @@
\RequirePackage{filecontents}
-\begin{filecontents*}{README.txt}
-__________________
-The pstool package
-
-A package like "pst-pdf" for processing PostScript graphics
-with psfrag labels within pdfLaTeX documents. 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.
-
-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-2014
-Distributed under the LaTeX Project Public License, "maintained" by Will Robertson.
-
-____________________
-Brief change history
-
-v1.5c
- - Documentation update; some minor cosmetic code changes.
-
-v1.5b
- - Fix conflict with beamer, which resets the catcode of @ with \begin{document}.
-
-v1.5a, March 2013:
- - Fix bug introduced in last version in which plain LaTeX compilation
- (producing DVI) produced erroneous output above each figure.
-
-v1.5, February 2013:
- - Fix =/# mixup in Windows ps2pdf options.
- - Check the .tex file for newness when regenerating figures.
- - Add [macro-file=...] for a global file to retrieve psfrag macros
- (default is "\jobname-pstool.tex").
- Thanks to Heinrich Kruger for suggestions for the above.
- - Cross-references and citations within external graphics are now supported.
-
-v1.4, November 2010:
- - More robust parsing of the main input file to read in the preamble.
- Therefore, \EndPreamble is now required much less often.
- - Apparently unreleased to CTAN, oops :)
-
-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}
% 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:
@@ -217,7 +159,7 @@ v1.3, July 2009:
}
\def\pstool@echo@verbose#1{%
- \immediate\write18{echo "#1"}%
+ \ShellEscape{echo "#1"}%
}
\let\pstool@includegraphics\includegraphics
@@ -227,33 +169,33 @@ v1.3, July 2009:
\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}%
@@ -292,7 +234,7 @@ v1.3, July 2009:
% 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
@@ -304,14 +246,14 @@ v1.3, July 2009:
> \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}{}%
@@ -363,9 +305,9 @@ v1.3, July 2009:
}
\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][]
@@ -485,7 +427,7 @@ v1.3, July 2009:
}
\newcommand\pstool@write@aux{%
- \endlinechar=-1
+ \endlinechar=-1\relax
\@tempswatrue
\@pstool@write@auxfalse
\in@false
@@ -508,7 +450,7 @@ v1.3, July 2009:
\fi
\fi
\fi
- }
+ }%
\closein \pstool@auxfile@ior
}
@@ -548,7 +490,7 @@ v1.3, July 2009:
\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
@@ -646,12 +588,11 @@ v1.3, July 2009:
}%
}
-% 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}{%
@@ -738,11 +679,7 @@ v1.3, July 2009:
\usepackage{xcolor}
\usepackage[colorlinks,linktocpage]{hyperref}
-%\usepackage{gmdoc}
-%\usepackage{gmverb}
-%\dekclubs
-%\stanzaskip=\bigskipamount
-%\CodeSpacesGrey
+\usepackage{expl3,l3regex}
\usepackage{enumitem}
\setlist{noitemsep}
@@ -1041,122 +978,173 @@ Note that the following code is typeset in a non-verbatim manner; indentation is
\parindent=0pt
+
\ExplSyntaxOn
-\ior_new:N \pstool_doc_ior
-\seq_new:N \l_pstool_line_seq
-\tl_new:N \l_pstool_tl
+\ior_new:N \pprint_doc_ior
+\seq_new:N \l_pprint_line_seq
+\tl_new:N \l_pprint_tl
+
+\int_new:N \g_pprint_indent_int
+\int_new:N \l_pprint_line_indent_int
+\dim_new:N \l_pprint_dim
+
+\errorcontextlines=999
-\tl_const:Nx \c_pstool_percent_str { \cs_to_str:N \% }
-\tl_const:Nx \c_pstool_lbrace_str { \cs_to_str:N \{ }
-\tl_const:Nx \c_pstool_rbrace_str { \cs_to_str:N \} }
+\tl_set:Nx \g_pprint_comment_tl { \cs_to_str:N \% }
+\definecolor{commentstrcolor}{rgb}{0,0.7,0}
+\definecolor{numberscolor}{gray}{0.6}
-\cs_new:Nn \pstool_typeset_percent:
+\def\linecommentstyle{%
+ \sffamily
+ \color{commentstrcolor}%
+}
+
+\cs_new:Nn \pprint_scan_setup:
{
- \group_begin:
- \color{blue}
- \scriptsize\bfseries
- \c_pstool_percent_str
- \group_end:
+ \char_set_catcode_space:N \
+% \char_set_catcode_other:N \\
+% \char_set_catcode_space:N \ % space
+% \char_set_catcode_letter:N \#
+% \char_set_catcode_letter:N \$
+% \char_set_catcode_letter:N \^
+% \char_set_catcode_letter:N \_
+% \char_set_catcode_letter:N \&
}
-\cs_new:Nn \pstool_doc_rescan_line:
+%%%%
+
+\cs_new:Npn \PrettyPrint #1
{
- \exp_args:Nno \tl_rescan:nn
+\int_new:N \g_pprint_docline_int
+\ior_open:Nn \pprint_doc_ior {#1}
+
+\cs_generate_variant:Nn \tl_if_eq:nnTF {x}
+
+\cs_set_eq:NN \___tl_trim_spaces:n \tl_trim_spaces:n
+\ior_str_map_inline:Nn \pprint_doc_ior
+ {
+ \int_gincr:N \g_pprint_docline_int
+
+ % avoid space trimming inside \seq_set_split:n following:
+ % (MAJOR SIDE-EFFECTS OF COURSE)
+ \cs_set_eq:NN \tl_trim_spaces:n \use:n
+ \exp_args:NNo \seq_set_split:Nnn \l_pprint_line_seq \g_pprint_comment_tl {##1}
+ \cs_set_eq:NN \tl_trim_spaces:n \___tl_trim_spaces:n
+
+ \seq_pop_left:NNT \l_pprint_line_seq \l_pprint_tl
{
- \char_set_catcode_space:N \ % space
- \char_set_catcode_letter:N \#
+ \tl_if_empty:NTF \l_pprint_tl
+ {
+ \pprint_doc_line_comment:
+ }
+ {
+ \pprint_doc_line_code:
+ }
}
- { \l_pstool_tl }
+ }
}
-\cs_new:Nn \pstool_doc_line_comment:
+\cs_generate_variant:Nn \tl_if_eq:nnTF {o}
+\cs_new:Nn \pprint_doc_line_comment:
{
- \seq_pop_left:NNTF \l_pstool_line_seq \l_pstool_tl
+ \seq_pop_left:NNTF \l_pprint_line_seq \l_pprint_tl
% Comment on a line of its own:
{
- \group_begin:
- \int_compare:nT { \g_pstool_indent_int > 0 } { \color{blue}\small }
- \pstool_doc_rescan_line:
- \group_end:
- \par
+ \seq_put_right:No \l_pprint_codelines_seq \l_pprint_tl
}
% A completely empty line:
{
+ \pprint_flush_codelines:
\vspace{\baselineskip}
}
}
-\int_new:N \g_pstool_indent_int
-\int_new:N \l_pstool_line_indent_int
-\dim_new:N \l_pstool_dim
+\cs_new:Nn \pprint_rescan_comment:n
+ {
+ \exp_args:Nno \tl_rescan:nn
+ {
+ \pprint_scan_setup:
+ }
+ { #1 }
+ }
+
+\cs_new:Nn \pprint_typeset_startcomment:
+ {
+ \group_begin:
+ \bfseries
+ \g_pprint_comment_tl
+ \group_end:
+ }
+
+\cs_generate_variant:Nn \regex_extract_once:nnNTF {no}
+\cs_generate_variant:Nn \tl_if_in:nnT {xx}
+\seq_new:N \l_tmp_seq
-\cs_new:Nn \pstool_doc_line_code:
+\seq_new:N \l_pprint_codelines_seq
+
+\int_new:N \g_pprint_brace_int
+\cs_new:Nn \pprint_lbrace:
{
- \makebox[0pt][r]{\scriptsize\color{blue}\int_use:N \g_pstool_docline_int\quad}
-
- \int_zero:N \l_pstool_line_indent_int
- \tl_map_inline:Nn \l_pstool_tl
+ \peek_meaning_remove:NTF \pprint_rbrace:
+ { \char`\{\char`\} }
{
- \str_if_eq_x:nnT {##1} {\c_pstool_lbrace_str} { \int_gincr:N \l_pstool_line_indent_int }
- \str_if_eq_x:nnT {##1} {\c_pstool_rbrace_str} { \int_gdecr:N \l_pstool_line_indent_int }
+ \int_gincr:N \g_pprint_brace_int
+ \char`\{\pprint_brace_sub:
}
- \exp_args:NNx \tl_if_in:NnT \l_pstool_tl { \token_to_str:N \if } { \int_gincr:N \l_pstool_line_indent_int }
- \exp_args:NNx \tl_if_in:NnT \l_pstool_tl { \token_to_str:N \fi } { \int_gdecr:N \l_pstool_line_indent_int }
-
- \int_compare:nT { \l_pstool_line_indent_int < 0 }
- { \int_set:Nn \g_pstool_indent_int { \g_pstool_indent_int + \l_pstool_line_indent_int } }
- \int_compare:nT { \g_pstool_indent_int > 0 }
- { \prg_replicate:nn {\g_pstool_indent_int} {\quad} }
- \int_compare:nT { \l_pstool_line_indent_int > 0 }
- { \int_set:Nn \g_pstool_indent_int { \g_pstool_indent_int + \l_pstool_line_indent_int } }
- \int_compare:nT { \g_pstool_indent_int < 0 }
- { \int_zero:N \g_pstool_indent_int }
-
- \texttt{\l_pstool_tl}
+ }
+\cs_new:Nn \pprint_rbrace:
+ {
+ \pprint_brace_sub:\char`\}
+ \int_gdecr:N \g_pprint_brace_int
+ }
+\cs_new:Nn \pprint_brace_sub:
+ {
+ {${}\sb{\sb{ \color{red}\mathbf{\int_use:N \g_pprint_brace_int} }}$}
+ }
+
+
+\cs_new:Nn \pprint_doc_line_code:
+ {
+ \pprint_flush_codelines:
+
+ \makebox[2em][l]{\tiny\color{numberscolor}\int_use:N \g_pprint_docline_int}
+ \exp_args:NNx \tl_replace_all:Nnn \l_pprint_tl { \cs_to_str:N \{ } { \pprint_lbrace: }
+ \exp_args:NNx \tl_replace_all:Nnn \l_pprint_tl { \cs_to_str:N \} } { \pprint_rbrace: }
+ \makebox{\texttt{\l_pprint_tl}}
- \seq_pop_left:NNT \l_pstool_line_seq \l_pstool_tl
+ \seq_pop_left:NNT \l_pprint_line_seq \l_pprint_tl
{
\makebox
{%
- \pstool_typeset_percent:
- \space
- \small
- \color{blue}%
- \pstool_doc_rescan_line:
+ \linecommentstyle
+ \pprint_typeset_startcomment:\space
+ \pprint_rescan_comment:n { \l_pprint_tl }
}
}
\par
}
-\errorcontextlines=999
-
-\int_new:N \g_pstool_docline_int
-\ior_open:Nn \pstool_doc_ior {pstool.sty}
-
-\cs_set_eq:NN \___tl_trim_spaces:n \tl_trim_spaces:n
-\cs_set_eq:NN \tl_trim_spaces:n \use:n % avoid space trimming inside \seq_set_split:n following (MAJOR SIDE-EFFECTS OF COURSE)
-\ior_str_map_inline:Nn \pstool_doc_ior
+\cs_new:Nn \pprint_flush_codelines:
{
- \int_gincr:N \g_pstool_docline_int
- \exp_args:NNo \seq_set_split:Nnn \l_pstool_line_seq {\c_pstool_percent_str} {#1}
- %\seq_show:N \l_pstool_line_seq
- \seq_pop_left:NNT \l_pstool_line_seq \l_pstool_tl
+ \seq_if_empty:NF \l_pprint_codelines_seq
{
- \tl_if_empty:NTF \l_pstool_tl
+ \medskip
+ \seq_map_inline:Nn \l_pprint_codelines_seq
{
- \pstool_doc_line_comment:
- }
- {
- \pstool_doc_line_code:
+ \pprint_rescan_comment:n {##1}
+ \space
}
+ \seq_clear:N \l_pprint_codelines_seq
+ \smallskip
+ \par
}
}
-\cs_set_eq:NN \tl_trim_spaces:n \___tl_trim_spaces:n
\ExplSyntaxOff
-%\DocInput{pstool.sty}
+\PrettyPrint {pstool.sty}
+
{\addtocontents{toc}{\protect\end{varwidth}}}
\end{document}
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}{%