| 1 |
%% |
| 2 |
%% This is file `psfrag.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% psfrag.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% Copyright (c) 1996 Craig Barratt, Michael C. Grant, and David Carlisle. |
| 10 |
%% All rights reserved. |
| 11 |
%% |
| 12 |
%% This file is part of the PSfrag package. |
| 13 |
%% |
| 14 |
\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 15 |
\ProvidesPackage{psfrag}[1998/04/11 v3.04 PSfrag (MCG)] |
| 16 |
\newif\ifpfg@compat |
| 17 |
\newif\ifpfg@prepass |
| 18 |
\newif\ifpfg@debug \pfg@debugfalse |
| 19 |
\if@compatibility |
| 20 |
\pfg@compattrue\pfg@prepasstrue |
| 21 |
\else |
| 22 |
\pfg@compatfalse\pfg@prepassfalse |
| 23 |
\fi |
| 24 |
\def\psfragscanon{\pfg@prepasstrue} |
| 25 |
\def\psfragscanoff{\pfg@prepassfalse} |
| 26 |
\def\psfragdebugon{\pfg@debugtrue} |
| 27 |
\def\psfragdebugoff{\pfg@debugfalse} |
| 28 |
\DeclareOption{scanall}{\pfg@prepasstrue} |
| 29 |
\DeclareOption{2emode}{\pfg@compatfalse\pfg@prepassfalse} |
| 30 |
\DeclareOption{209mode}{\pfg@compattrue\pfg@prepasstrue} |
| 31 |
\DeclareOption{debugshow}{\pfg@debugtrue |
| 32 |
\PassOptionsToPackage\CurrentOption{graphics}} |
| 33 |
\DeclareOption*{\PassOptionsToPackage\CurrentOption{graphics}} |
| 34 |
\ProcessOptions |
| 35 |
\RequirePackage{graphics} |
| 36 |
\providecommand\Gin@PS@file@header[1]{\AtBeginDvi{\special{header=#1}}} |
| 37 |
\Gin@PS@file@header{psfrag.pro} |
| 38 |
\def\pfg@orient{1} |
| 39 |
\def\@tempa{dvipsone.def}\ifx\Gin@driver\@tempa\def\pfg@orient{-1}\fi% |
| 40 |
\def\@tempa{dvips.def}\ifx\Gin@driver\@tempa\def\pfg@orient{-1}\fi% |
| 41 |
\def\@tempa{textures.def}\ifx\Gin@driver\@tempa\def\pfg@orient{-1}\fi% |
| 42 |
\let\pfg@epsfbox\epsfbox |
| 43 |
\let\pfg@Ginclude@eps\Ginclude@eps |
| 44 |
\newcount\pfg@pcount \pfg@pcount=\z@ |
| 45 |
\newcount\pfg@scount \pfg@scount=\z@ |
| 46 |
\def\epsfbox#1{% |
| 47 |
\begingroup |
| 48 |
\let\Ginclude@eps\pfg@Ginclude@eps |
| 49 |
\let\epsfbox\pfg@epsfbox |
| 50 |
\ifpfg@prepass\pfg@scan{#1}\fi |
| 51 |
\ifnum\pfg@scount>\z@\pfg@hidestart\fi |
| 52 |
\pfg@epsfbox{#1}% |
| 53 |
\ifnum\pfg@scount>\z@\pfg@hideend\fi |
| 54 |
\endgroup} |
| 55 |
\def\Ginclude@eps#1{% |
| 56 |
\begingroup |
| 57 |
\let\Ginclude@eps\pfg@Ginclude@eps |
| 58 |
\let\epsfbox\pfg@epsfbox |
| 59 |
\ifpfg@prepass\pfg@scan{#1}\fi |
| 60 |
\ifnum\pfg@scount>\z@\pfg@hidestart\fi |
| 61 |
\pfg@Ginclude@eps{#1}% |
| 62 |
\ifnum\pfg@scount>\z@\pfg@hideend\fi |
| 63 |
\endgroup} |
| 64 |
\newenvironment{psfrags}{\ignorespaces}{\global\@ignoretrue} |
| 65 |
\ifpfg@compat |
| 66 |
\def\psfragspecial#1#2#3#4#5#6{% |
| 67 |
\PackageError{PSfrag}% |
| 68 |
{\string\psfragspecial no longer implemented.}{}} |
| 69 |
\fi |
| 70 |
\newif\ifpfg@star |
| 71 |
\def\psfrag{\@ifstar{\pfg@startrue\@psfraga}{\pfg@starfalse\@psfraga}} |
| 72 |
\def\@psfraga{\begingroup |
| 73 |
\@makeother\"\@makeother\*\@makeother\!\@makeother\~% |
| 74 |
\@makeother\:\@makeother\\\@makeother\%\@makeother\#% |
| 75 |
\@makeother\ \@psfragb} |
| 76 |
\ifpfg@compat |
| 77 |
\def\@psfragb#1{\xdef\@gtempa{#1}\endgroup |
| 78 |
\@ifnextchar[{\@psfragc{\@gtempa}}% |
| 79 |
{\@psfrag{\@gtempa}[bl][bl][1][0]}} |
| 80 |
\def\@psfragc#1[#2]{\@ifnextchar [{\@psfragd{#1}[#2]}% |
| 81 |
{\@psfrag{#1}[#2][bl][1][0]}} |
| 82 |
\else |
| 83 |
\def\@psfragb#1{\xdef\@gtempa{#1}\endgroup |
| 84 |
\@ifnextchar [{\@psfragc{\@gtempa}}% |
| 85 |
{\@psfrag{\@gtempa}[Bl][Bl][1][0]}} |
| 86 |
\def\@psfragc#1[#2]{\@ifnextchar [{\@psfragd{#1}[#2]}% |
| 87 |
{\@psfrag{#1}[#2][Bl][1][0]}} |
| 88 |
\fi |
| 89 |
\def\@psfragd#1[#2][#3]{\@ifnextchar [{\@psfrage{#1}[#2][#3]}% |
| 90 |
{\@psfrag{#1}[#2][#3][1][0]}} |
| 91 |
\def\@psfrage#1[#2][#3][#4]{\@ifnextchar [{\@psfrag{#1}[#2][#3][#4]}% |
| 92 |
{\@psfrag{#1}[#2][#3][#4][0]}} |
| 93 |
\def\pfg@newstring#1.#2{% |
| 94 |
\@nameedef{pfg@using@#2}{#1}% |
| 95 |
\pfg@starfalse\advance\pfg@scount\@ne} |
| 96 |
\def\@psfrag#1{% |
| 97 |
\@ifundefined{pfg@using@#1}% |
| 98 |
{\expandafter\pfg@newstring\the\pfg@scount.{#1}}% |
| 99 |
{}% |
| 100 |
\edef\@tempa{\@nameuse{pfg@using@#1}}% |
| 101 |
\expandafter\@@psfrag\@tempa.{#1}} |
| 102 |
\def\@@psfrag{\expandafter\@@@psfrag\the\pfg@pcount.} |
| 103 |
\def\@nameedef#1#2{\expandafter\edef\csname #1\endcsname{#2}} |
| 104 |
\def\@@@psfrag#1.#2.#3[#4][#5][#6][#7]#8{% |
| 105 |
\advance\pfg@pcount\@ne |
| 106 |
\ifpfg@star\else\@nameedef{pfg@align@#2}{(#3)[}\fi |
| 107 |
\@nameedef{pfg@align@#2}{\@nameuse{pfg@align@#2}[#1(#5)#6 #7]}% |
| 108 |
\@namedef{pfg@place@#1}{\pfg@@place{#1}{#4}{#8}}\ignorespaces} |
| 109 |
\def\pfg@align#1.{\@nameuse{pfg@align@#1}} |
| 110 |
\def\pfg@place#1.{\@nameuse{pfg@place@#1}} |
| 111 |
\def\pfg@hidestart{% |
| 112 |
\def\pfg@{}\count@=\z@\loop\ifnum\count@<\pfg@scount |
| 113 |
\toks@=\expandafter{\expandafter\pfg@align\the\count@.}% |
| 114 |
\edef\pfg@{\pfg@\the\toks@]}% |
| 115 |
\advance\count@ by\@ne\repeat |
| 116 |
\Gin@PS@raw{/PSfrag where{pop\pfg@\the\pfg@scount\space |
| 117 |
\ifpfg@debug1\else0\fi\space\pfg@orient/Begin |
| 118 |
PSfrag}{userdict /PSfrag{pop}put}ifelse}} |
| 119 |
\def\pfg@hideend{% |
| 120 |
\Gin@PS@raw{/End PSfrag}% |
| 121 |
\vbox to\z@{\vss |
| 122 |
\Gin@PS@raw{/Hide PSfrag}% |
| 123 |
\hbox to\z@{\hss \raisebox{\depth}{% |
| 124 |
\underline{PSfrag replacements}}}% |
| 125 |
\Gin@PS@raw{/Unhide PSfrag}% |
| 126 |
\count@=\z@\loop\ifnum\count@<\pfg@pcount |
| 127 |
\expandafter\pfg@place\the\count@.% |
| 128 |
\advance\count@ by\@ne\repeat}} |
| 129 |
\let\pfg@dp\leftmargini\let\pfg@wd\leftmarginii |
| 130 |
\let\pfg@dx\leftmarginiii\let\pfg@dy\leftmarginiv |
| 131 |
\edef\pfg@bchar{ \string{ } |
| 132 |
\edef\pfg@echar{ \string} } |
| 133 |
\def\pfg@@place#1#2#3{\begingroup |
| 134 |
\sbox\z@{#3}% |
| 135 |
\dimen@=\ht\z@ \advance\dimen@ by\dp\z@% |
| 136 |
\pfg@wd=0.5\wd\z@\pfg@dp=0.5\dimen@ |
| 137 |
\pfg@dx=\pfg@wd\pfg@dy=\pfg@dp |
| 138 |
\@tfor\@tempa:=#2\do{% |
| 139 |
\if l\@tempa \pfg@dx=\z@ \pfg@wd=\wd\z@ \else |
| 140 |
\if r\@tempa \pfg@dx=\wd\z@ \pfg@wd=\z@ \else |
| 141 |
\if b\@tempa \pfg@dy=\z@ \pfg@dp=\z@ \else |
| 142 |
\if t\@tempa \pfg@dy=\dimen@\pfg@dp=\dimen@\else |
| 143 |
\if B\@tempa \pfg@dy=\dp\z@ \pfg@dp=\dp\z@ \fi\fi\fi\fi\fi}% |
| 144 |
\setbox\z@\hbox to\z@{\hskip-\pfg@dx\box\z@\hss}% |
| 145 |
\setbox\z@\vbox to\z@{\vss\box\z@\vskip-\pfg@dy}% |
| 146 |
\vbox to\dimen@{\vss\hbox to\z@{\hss |
| 147 |
\Gin@PS@raw{\pfg@bchar}\box\z@ |
| 148 |
\Gin@PS@raw{\pfg@echar#1/Place PSfrag}% |
| 149 |
\hskip\pfg@wd}\vskip\pfg@dp}% |
| 150 |
\endgroup} |
| 151 |
\newwrite\pfg@temp |
| 152 |
\def\pfg@scan#1{\begingroup |
| 153 |
\@tempcnta\z@ |
| 154 |
\loop |
| 155 |
\ifnum\@tempcnta<\@xxxii |
| 156 |
\catcode\@tempcnta12 \advance\@tempcnta\@ne |
| 157 |
\repeat |
| 158 |
\let\do\@makeother\dospecials\catcode`\ 10 % |
| 159 |
\catcode`\{=1\catcode`\}=2\catcode127=12 % |
| 160 |
\catcode`\\=\active\catcode\endlinechar5 % |
| 161 |
\immediate\openout\pfg@temp=\jobname.pfg % |
| 162 |
\immediate\openin\@inputcheck=#1 % |
| 163 |
\ifeof\@inputcheck |
| 164 |
\PackageWarning{psfrag}{Could not scan #1...}\endgroup |
| 165 |
\else |
| 166 |
\message{<psfrag:#1>}% |
| 167 |
\@tempswatrue |
| 168 |
\loop |
| 169 |
\ifeof\@inputcheck |
| 170 |
\@tempswafalse |
| 171 |
\else |
| 172 |
\read\@inputcheck to\@tempa |
| 173 |
\expandafter\pfg@find\@tempa{\@nil}% |
| 174 |
\fi |
| 175 |
\if@tempswa |
| 176 |
\repeat |
| 177 |
\closein\@inputcheck |
| 178 |
\fi |
| 179 |
\immediate\closeout\pfg@temp |
| 180 |
\endgroup |
| 181 |
\@input{\jobname.pfg}} |
| 182 |
\long\def\pfg@find#1#{\pfg@finda{#1}} |
| 183 |
\begingroup |
| 184 |
\lccode`\~=`\\ |
| 185 |
\lowercase{\endgroup |
| 186 |
\long\def\pfg@finda#1#2{% |
| 187 |
\def\@tempa{#2}% |
| 188 |
\ifx\@tempa\@nnil |
| 189 |
\else |
| 190 |
\pfg@findb#1(~~tex(~~tex% |
| 191 |
\fi} |
| 192 |
\long\def\pfg@findb#1(~~tex#2(~~tex#3\fi{% |
| 193 |
\fi |
| 194 |
\ifx\box#3\box |
| 195 |
\else |
| 196 |
{\let~\string |
| 197 |
\edef\@tempb{\@tempa}% |
| 198 |
\let~\relax |
| 199 |
\immediate\write\pfg@temp{% |
| 200 |
\string\psfrag\space |
| 201 |
{\string\\tex#2{\@tempa}}#2\@percentchar |
| 202 |
^^J\@spaces\@spaces{\@tempb}\@percentchar}}% |
| 203 |
\let\@tempa\@empty |
| 204 |
\fi |
| 205 |
\expandafter\pfg@find\@tempa} |
| 206 |
} |
| 207 |
\endinput |
| 208 |
%% |
| 209 |
%% End of file `psfrag.sty'. |