diff options
author | Karl Berry <karl@freefriends.org> | 2008-11-25 01:30:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-11-25 01:30:33 +0000 |
commit | 956d952d37799fbddfb2cd354c60dfeabbef3d7d (patch) | |
tree | 893ef12674f774e0969e62243a40b096cc8b23e8 /Master/texmf-dist/tex/latex/pdftricks | |
parent | be16e2585eec91d59215676a837121b9bea84f14 (diff) |
pdftricks 1.16 (24nov08)
git-svn-id: svn://tug.org/texlive/trunk@11415 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pdftricks')
-rw-r--r-- | Master/texmf-dist/tex/latex/pdftricks/pdftricks.sty | 328 |
1 files changed, 179 insertions, 149 deletions
diff --git a/Master/texmf-dist/tex/latex/pdftricks/pdftricks.sty b/Master/texmf-dist/tex/latex/pdftricks/pdftricks.sty index 61387eced2d..e01bb9e9da8 100644 --- a/Master/texmf-dist/tex/latex/pdftricks/pdftricks.sty +++ b/Master/texmf-dist/tex/latex/pdftricks/pdftricks.sty @@ -1,14 +1,14 @@ % % pdftricks.sty % -% Copyright (c) 2001, Radhakrishnan CV <cvr@river-valley.com> -% Rajagopal CV <cvr3@river-valley.com> -% http://www.river-valley.com +% Copyright (c) 2001-3, Radhakrishnan CV <cvr@river-valley.com> +% Rajagopal CV <cvr3@river-valley.com> +% http://www.river-valley.com % -% River Valley Technologies, Software Technology Park, -% Trivandrum, India 695034 +% River Valley Technologies, Floor III, SJP Buildings, Cotton Hills +% Trivandrum, India 695014 % -% Tel: +91 471 33 7501/7502 +% Tel: +91 471 233 7501 % % Antoine Chambert-Loir % <chambert@math.polytechnique.fr> @@ -32,15 +32,16 @@ % Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, % MA 02111-1307, USA. % -% $Id: pdftricks.sty,v 1.15 2001/09/30 11:21:23 cvr Exp $ +% $Id: pdftricks.sty,v 1.16 2003/08/10 04:29:20 cvr Exp cvr $ % + \NeedsTeXFormat{LaTeX2e} \def\Fileversion$#1: #2 ${\gdef\fileversion{#2}} \def\Filedate$#1: #2 #3 ${\gdef\filedate{#2}} -\Fileversion$Revision: 1.15 $ -\Filedate$Date: 2001/09/30 11:21:23 $ +\Fileversion$Revision: 1.16 $ +\Filedate$Date: 2003/08/10 04:29:20 $ \ProvidesPackage{pdftricks} - [\filedate\space\fileversion\space psTricks support in PDF (CVRACL)] + [\filedate\space\fileversion\space psTricks support in PDF (CVR/ACL)] \PackageWarningNoLine{pdftricks} {****************************************\MessageBreak Package pdftricks v,\fileversion\space loaded\MessageBreak @@ -48,20 +49,30 @@ ****************************************} \RequirePackage{graphicx,color} \newif\if@debug\@debugfalse -\DeclareOption{debug}{\@debugtrue} -\DeclareOption{noshell}{\PDFTshellfalse} -\DeclareOption{shell}{\PDFTshelltrue} \newif\ifPDFTshell \newif\ifPDFTnopdf \newif\ifnoprocess \noprocessfalse +\newif\ifmiktex \miktexfalse +\DeclareOption{debug}{\@debugtrue} +\DeclareOption{noshell}{\PDFTshellfalse} +\DeclareOption{shell}{\PDFTshelltrue} +\DeclareOption{miktex}{\global\miktextrue} \ExecuteOptions{shell} \ProcessOptions\relax \ifPDFTshell % we must set it to false if \write18 doesn't work. % Hack given by Thierry Bouche (Thanks !) \def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time} -\immediate\write18{touch \tmpfile} -\IfFileExists{\tmpfile}{\PDFTshelltrue}{\PDFTshellfalse} +\ifmiktex% + \immediate\write18{rem >"\tmpfile"}%%%%%% LDL-2 +\else + \immediate\write18{touch \tmpfile} %%%%%% LDL-1 +\fi +\ifmiktex + \IfFileExists{\tmpfile.}{\PDFTshelltrue}{\PDFTshellfalse} %%%%%% LDL-4 +\else + \IfFileExists{\tmpfile}{\PDFTshelltrue}{\PDFTshellfalse} %%%%%% LDL-3 +\fi \fi \ifPDFTshell \PackageWarningNoLine{pdftricks} @@ -77,112 +88,125 @@ ****************************************} \fi -% warning! the definition of FIGURES if psrun must be set accordingly !! +% warning! the definition of FIGURES if pst2pdf must be set accordingly !! \def\PDFTfigname{\jobname-fig\thepsfig} \def\PDFTWarning#1#2{\if@debug\PackageWarning{#1}{#2}\fi} \def\PDFTWarningNoLine#1#2{\if@debug\PackageWarningNoLine{#1}{#2}\fi} -\def\makeinnocent#1{\catcode`#1=12 } -\def\csarg#1#2{\expandafter#1\csname#2\endcsname} -\def\latexname{lplain}\def\latexename{LaTeX2e} -\newwrite\PDFStream -\long\def\ProcessStream#1% start it all of - {\begingroup% - \def\CurrentStream{#1}% - \let\do\makeinnocent \dospecials - \makeinnocent\^^L% and whatever other special cases - \endlinechar`\^^M \catcode`\^^M=12 \xStream} -{\catcode`\^^M=12 \endlinechar=-1 % - \gdef\xStream#1^^M{% - \expandafter\ProcessStreamLine} - \gdef\ProcessStreamLine#1^^M{\def\test{#1} - \csarg\ifx{End\CurrentStream Test}\test - \edef\next{\noexpand\EndOfStream{\CurrentStream}}% - \else \ThisStream{#1}\let\next\ProcessStreamLine - \fi \next} -} -\long\def\streaminfo{\string\end{document}} -\def\CSstringmeaning#1{\expandafter\CSgobblearrow\meaning#1} -\def\CSstringcsnoescape#1{\expandafter\CSgobbleescape\string#1} -{\escapechar-1 -\expandafter\expandafter\expandafter\gdef - \expandafter\expandafter\expandafter\CSgobblearrow - \expandafter\string\csname macro:->\endcsname{} -} -\def\CSgobbleescape#1{\ifnum`\\=`#1 \else #1\fi} -\def\WriteStreamLine#1{\def\CStmp{#1}% - \immediate\write\PDFStream{\CSstringmeaning\CStmp}} - -\def\AfterIncludedStream - {\immediate\closeout\PDFStream %changed on 2001/1/20 - \relax - }% -\def\BeforeIncludedStream - {\stepcounter{psfig}\xdef\PDFCutFile{\PDFTfigname.tex}% - \message{Opening PDFStream=\PDFCutFile}% - \immediate\openout\PDFStream=\PDFCutFile - \immediate\write\PDFStream{\string\documentclass{article}} - \immediate\write\PDFStream{\string\input\space tmp.inputs} - \immediate\write\PDFStream{\string\pagestyle{empty}} - \immediate\write\PDFStream{\string\usepackage{amssymb,amsbsy}} - \immediate\write\PDFStream{\string\begin{document}} - \let\ThisStream\WriteStreamLine} -\long\def\specialstream #1#2#3{% - \message{Special stream '#1'}% - \csarg\def{After#1Stream}{#2\AfterIncludedStream#3}% - \csarg\def{#1}{\BeforeIncludedStream\relax - \ProcessStream{#1}}% - \PDFEndDef{#1}} -\def\EndOfStream#1{\endgroup\end{#1}% - \csname After#1Stream\endcsname} -\def\PDFEndDef#1{{\escapechar=-1\relax - \csarg\xdef{End#1Test}{\string\\end\string\{#1\string\}}% - }} %% %% The real meat of psfile manipulation starts here. %% %% +\RequirePackage{moreverb} +\def\pdfverbatimwrite#1{% + \@bsphack + \immediate\openout \verbatim@out #1 + \BeforeStream% + \let\do\@makeother\dospecials + \catcode`\^^M\active \catcode`\^^I=12 + \def\verbatim@processline{% + \immediate\write\verbatim@out + {\the\verbatim@line}}% + \verbatim@start} +\def\endpdfverbatimwrite{% + \immediate\write\verbatim@out{\string\end{document}} + \immediate\closeout\verbatim@out + \@esphack} + +\def\BeforeStream + {\message{Opening PDFStream=\PDFTfigname.tex}% + \immediate\write\verbatim@out{\string\documentclass{article}} + \immediate\write\verbatim@out{\string\input\space tmp.inputs} + \immediate\write\verbatim@out{\string\pagestyle{empty}} + \immediate\write\verbatim@out{\string\begin{document}} + } +\newenvironment{pdfdisplay}{\stepcounter{psfig}% + \xdef\PDFCutFile{\PDFTfigname.tex} + \pdfverbatimwrite{\PDFCutFile}} + {\endpdfverbatimwrite% + \psgraphicsinclude% + \global\noprocessfalse\noindent} +\newenvironment{pdfpic}{\stepcounter{psfig}% + \xdef\PDFCutFile{\PDFTfigname.tex} + \pdfverbatimwrite{\PDFCutFile}} + {\endpdfverbatimwrite% + \psgraphicsinclude% + \global\noprocessfalse\noindent} +\newenvironment{pdfinline}{\stepcounter{psfig}% + \xdef\PDFCutFile{\PDFTfigname.tex} + \pdfverbatimwrite{\PDFCutFile}} + {\endpdfverbatimwrite% + \psinlinegraphicsinclude% + \global\noprocessfalse\noindent} \AtEndDocument{\endPShook% - \ifPDFTnopdf + \ifPDFTnopdf \PackageWarningNoLine{pdftricks} {******************************************\MessageBreak Some PDF files of images were not found.\MessageBreak Run the script `pst2pdf' before the next\MessageBreak run of pdfLaTeX\MessageBreak ******************************************} - \fi + \fi } \gdef\endPShook{} \def\noprocess{\global\noprocesstrue \PackageWarning{pdftricks} {******************************************\MessageBreak - Figure Number: \PDFTfigname\space is not processed \MessageBreak + Figure Number: \PDFTfigname\space is not processed \MessageBreak ******************************************\MessageBreak} } -\specialstream{pdfpic}{% - \immediate\write\PDFStream{\streaminfo}} - {\psgraphicsinclude\global\noprocessfalse} + \newcounter{psfig} \newif\if@pdfGINwidth \newif\if@pdfGINheight \newif\if@pdfGINscale -\long\gdef\psgraphicsinclude{% +\long\gdef\psgraphicsProcess{% \@ifundefined{Fig\thepsfig} - {\PDFTWarningNoLine{pdftricks}{************ PROCESSING FIG: \thepsfig\space **********}} + {\PDFTWarningNoLine{pdftricks} + {******************************************\MessageBreak + ************ Processing Fig: \thepsfig\space**********\MessageBreak + ******************************************} + } {\noprocess} \ifPDFTshell\ifnoprocess\relax\else \IfFileExists{\PDFTfigname.tex}{% \immediate\write18{latex -interaction=batchmode \PDFTfigname} - \PDFTWarning{pdftricks3}{\PDFTfigname.tex converted to \PDFTfigname.dvi}}{} + \PDFTWarningNoLine{pdftricks} + {******************************************\MessageBreak + \PDFTfigname.tex converted to \PDFTfigname.dvi\MessageBreak + ******************************************} + }{} \IfFileExists{\PDFTfigname.dvi}{% - \immediate\write18{dvips -E -o \PDFTfigname.eps \PDFTfigname} - \PDFTWarning{pdftricks}{EPS generated -- \PDFTfigname.eps}}{} + \immediate\write18{dvips -o \PDFTfigname.ps \PDFTfigname} + \PDFTWarningNoLine{pdftricks} + {******************************************\MessageBreak + \PDFTfigname.ps generated\MessageBreak + ******************************************} + }{} + \IfFileExists{\PDFTfigname.ps}{% + \immediate\write18{ps2eps -f \PDFTfigname.ps} + \PDFTWarningNoLine{pdftricks} + {******************************************\MessageBreak + \PDFTfigname.eps generated\MessageBreak + ******************************************} + }{} \IfFileExists{\PDFTfigname.eps}{% \immediate\write18{epstopdf \PDFTfigname.eps} - \PDFTWarning{pdftricks3}{\PDFTfigname.eps converted to \PDFTfigname.pdf}}{} - \immediate\write18{rm \PDFTfigname.aux \PDFTfigname.dvi \PDFTfigname.log \PDFTfigname.eps} + \PDFTWarningNoLine{pdftricks} + {******************************************\MessageBreak + \PDFTfigname.eps converted to \PDFTfigname.pdf\MessageBreak + ******************************************} + }{} + \ifmiktex% + \immediate\write18{del \PDFTfigname.aux \PDFTfigname.dvi + \PDFTfigname.log \PDFTfigname.eps} %%%%%% LDL-6 + \else + \immediate\write18{rm \PDFTfigname.aux \PDFTfigname.dvi + \PDFTfigname.log \PDFTfigname.eps} %%%%%% LDL-5 \fi\fi -% \fi + \fi +} +\long\gdef\psgraphicsinclude{\psgraphicsProcess% \IfFileExists{\PDFTfigname.pdf}% {\begin{center} \bgroup\fboxsep\@PDFboxsep\fboxrule\@PDFboxrule% @@ -205,15 +229,28 @@ \gdef\@PDFboxsep{0pt} \gdef\@PDFboxrule{0pt} } + +\long\gdef\psinlinegraphicsinclude{% + \psgraphicsProcess% + \IfFileExists{\PDFTfigname.pdf}% + {\bgroup\fboxrule0pt% + \normalcolor\fbox{\includegraphics{\PDFTfigname.pdf}}% + \egroup}% + {\PDFTnopdftrue}% +} + \definecolor{gray30}{gray}{.70} \definecolor{gray10}{gray}{.90} \RequirePackage{keyval} \def\configure[#1][#2]{\setkeys{#1}{#2} - \PDFTWarning{pdftricks}{Reconfigured #1 parameter(s)\MessageBreak #2\MessageBreak} - } -\define@key{pdfgraphic}{width} {\gdef\@PDFgraphicwidth{#1}\global\@pdfGINwidthtrue} -\define@key{pdfgraphic}{height} {\gdef\@PDFgraphicheight{#1}\global\@pdfGINheighttrue} -\define@key{pdfgraphic}{scale} {\gdef\@PDFgraphicscale{#1}\global\@pdfGINscaletrue} + \PDFTWarning{pdftricks}{Reconfigured #1 parameter(s)\MessageBreak + #2\MessageBreak}} +\define@key{pdfgraphic}{width} {\gdef\@PDFgraphicwidth{#1}% + \global\@pdfGINwidthtrue} +\define@key{pdfgraphic}{height} {\gdef\@PDFgraphicheight{#1}% + \global\@pdfGINheighttrue} +\define@key{pdfgraphic}{scale} {\gdef\@PDFgraphicscale{#1}% + \global\@pdfGINscaletrue} \define@key{pdfgraphic}{color} {\gdef\@PDFgraphiccolor{#1}} \define@key{pdfgraphic}{linecolor} {\gdef\@PDFgraphiclinecolor{#1}} \define@key{pdfgraphic}{background}{\gdef\@PDFgraphicbackground{#1}} @@ -224,55 +261,48 @@ \gdef\@PDFgraphicbackground{white} \gdef\@PDFboxrule{0pt} \gdef\@PDFboxsep{0pt} + %% -%% Tweak to grab all the packages used in the master doc. +%% Environment to grab all the packages used in the master doc. %% This forces you to load pdftricks as the first package. %% -\newenvironment{psinputs}{\begingroup - \newwrite\CVinputs - \immediate\openout\CVinputs=tmp.inputs - \def\usepackage{\@ifnextchar[\@CVUsepackage\@@CVUsepackage} - \def\@CVUsepackage[##1]##2{\immediate\write\CVinputs% - {\string\usepackage[##1]{##2}}} - \def\@@CVUsepackage##1{\immediate\write\CVinputs% - {\string\usepackage{##1}}} - } - {\endgroup\immediate\closeout\CVinputs} +\newenvironment{psinputs}{\verbatimwrite{tmp.inputs}} + {\endverbatimwrite} + %% %% Arrays to keep the fig numbers %% -\makeatletter -\newcounter{arraylength}% -\newcounter{ArrayIndex}% -\newcounter{zeroCtr}% -\newcounter{recordCtr} +\@ifundefined{c@arraylength}{\newcounter{arraylength}}{}% +\@ifundefined{c@ArrayIndex}{\newcounter{ArrayIndex}}{}% +\@ifundefined{c@zeroCtr}{\newcounter{zeroCtr}}{}% +\@ifundefined{c@recordCtr}{\newcounter{recordCtr}}{} \setcounter{recordCtr}{1} -\newcounter{Ctr} +\@ifundefined{c@Ctr}{\newcounter{Ctr}}{} \def\DeclareArray#1{\Array{#1}[0]{}}% % \def\Array#1[#2]#3{% - \expandafter\gdef\csname #1#2\endcsname{#3}% - \expandafter\gdef\csname #1\endcsname[##1]{\csname #1##1\endcsname}}% + \expandafter\gdef\csname #1#2\endcsname{#3}% + \expandafter\gdef\csname #1\endcsname[##1]{\csname #1##1\endcsname}}% % \def\getArraylength#1{\setcounter{arraylength}{0}% - \loop\expandafter\ifx\csname #1\thearraylength\endcsname\relax% - \else\stepcounter{arraylength}\repeat}% + \loop\expandafter\ifx\csname #1\thearraylength\endcsname\relax% + \else\stepcounter{arraylength}\repeat}% % \def\addToArray#1#2{\setcounter{arraylength}{0}% - \loop\expandafter\ifx\csname #1\thearraylength\endcsname\relax% - \else\stepcounter{arraylength}\repeat% - \Array{#1}[\thearraylength]{#2}}% + \loop\expandafter\ifx\csname #1\thearraylength\endcsname\relax% + \else\stepcounter{arraylength}\repeat% + \Array{#1}[\thearraylength]{#2}}% % \def\clearArray#1{\getArraylength{#1}% - \loop\ifnum\c@arraylength >0% - \global\expandafter\let\csname #1\thearraylength\endcsname\relax% - \addtocounter{arraylength}{-1}\repeat}% + \loop\ifnum\c@arraylength >0% + \global\expandafter\let\csname #1\thearraylength\endcsname\relax% + \addtocounter{arraylength}{-1}\repeat}% % \long\def\ArrayIterator#1#2{% - \setcounter{ArrayIndex}{1}\getArraylength{#1}% - \setcounter{zeroCtr}{\c@arraylength}% - \loop\ifnum\c@ArrayIndex<\c@zeroCtr{#2}% - \stepcounter{ArrayIndex}\repeat% + \setcounter{ArrayIndex}{1}\getArraylength{#1}% + \setcounter{zeroCtr}{\c@arraylength}% + \loop\ifnum\c@ArrayIndex<\c@zeroCtr{#2}% + \stepcounter{ArrayIndex}\repeat% }% \def\@nnil{\@nil} \def\@empty{} @@ -282,14 +312,14 @@ %% provided instead of LaTeX's default comma character %% \long\def\cvr@delimfor#1#2#3{\DeclareArray{#1}\clearArray{#1}% - \long\def\@icvrloop##1#2##2\@@##3{\def##3{##1}\ifx ##3\@nnil% - \expandafter\@cvrstop \else\addToArray{#1}{##1}% + \long\def\@icvrloop##1#2##2\@@##3{\def##3{##1}\ifx ##3\@nnil% + \expandafter\@cvrstop \else\addToArray{#1}{##1}% \relax\expandafter\@icvrloop\fi##2\@@##3}% - \long\def\@cvrloop##1#2##2#2##3\@@##4{\addToArray{#1}{##1}% - \def##4{##1}\ifx ##4\@nnil \else% + \long\def\@cvrloop##1#2##2#2##3\@@##4{\addToArray{#1}{##1}% + \def##4{##1}\ifx ##4\@nnil \else% \def##4{##2}\def\y@y{##2}\ifx\y@y\@nnil\else% - \addToArray{#1}{##2}\fi\ifx ##4\@nnil \else% - \@icvrloop ##3\@@##4\fi\fi}% + \addToArray{#1}{##2}\fi\ifx ##4\@nnil \else% + \@icvrloop ##3\@@##4\fi\fi}% \expandafter\def\expandafter\@fortmp\expandafter{#3}% \ifx\@fortmp\@empty \else% \expandafter\@cvrloop#3#2\@nil#2\@nil\@@\@ee@\fi}% @@ -300,33 +330,33 @@ \newcounter{f@irstCtr} \newcounter{s@econdCtr} \long\gdef\NoProcess[#1]{% - \long\def\@i@@noprocess##1,##2\@@##3{\def##3{##1}\ifx ##3\@nnil% - \expandafter\@cvrstop \else - \expandafter\hypencheck##1-@-*[*] + \long\def\@i@@noprocess##1,##2\@@##3{\def##3{##1}\ifx ##3\@nnil% + \expandafter\@cvrstop \else + \expandafter\hyphencheck##1-@-*[*] \relax\expandafter\@i@@noprocess\fi##2\@@##3}% - \long\def\@@@noprocess##1,##2,##3\@@##4{ - \expandafter\hypencheck##1-@-*[*] - \def##4{##1}\ifx ##4\@nnil \else% + \long\def\@@@noprocess##1,##2,##3\@@##4{ + \expandafter\hyphencheck##1-@-*[*] + \def##4{##1}\ifx ##4\@nnil \else% \def##4{##2}\def\y@y{##2}\ifx\y@y\@nnil\else% - \expandafter\hypencheck##2-@-*[*] - \fi\ifx ##4\@nnil \else% - \@i@@noprocess ##3\@@##4\fi\fi}% + \expandafter\hyphencheck##2-@-*[*] + \fi\ifx ##4\@nnil \else% + \@i@@noprocess ##3\@@##4\fi\fi}% \expandafter\def\expandafter\@fortmp\expandafter{#1}% \ifx\@fortmp\@empty \else% \expandafter\@@@noprocess#1,\@nil,\@nil\@@\@ee@\fi}% \def\d@d#1[*]{} -\def\hypencheck#1-#2-#3{\def\r@r{@}\def\s@s{*}\edef\c@c{#3} - \ifx\c@c\r@r - \setcounter{f@irstCtr}{#1} - \setcounter{s@econdCtr}{#2} - \stepcounter{s@econdCtr} - \loop\ifnum\thes@econdCtr > \thef@irstCtr% - \expandafter\edef\csname Fig\thef@irstCtr\endcsname{TRUE} - \stepcounter{f@irstCtr} - \repeat% - \else\ifx\c@c\s@s% - \expandafter\edef\csname Fig#1\endcsname{TRUE} - \fi\fi\d@d} +\def\hyphencheck#1-#2-#3{\def\r@r{@}\def\s@s{*}\edef\c@c{#3} + \ifx\c@c\r@r + \setcounter{f@irstCtr}{#1} + \setcounter{s@econdCtr}{#2} + \stepcounter{s@econdCtr} + \loop\ifnum\thes@econdCtr > \thef@irstCtr% + \expandafter\edef\csname Fig\thef@irstCtr\endcsname{TRUE} + \stepcounter{f@irstCtr} + \repeat% + \else\ifx\c@c\s@s% + \expandafter\edef\csname Fig#1\endcsname{TRUE} + \fi\fi\d@d} %% %% |