1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
\begin{filecontents}{example.tex}
\documentclass[a4paper,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage[sub,ovp]{psfragx}
\usepackage{overpic,color}
\usepackage{verbatim}
\usepackage[francais,english]{babel}
\pagestyle{empty}
\begin{document}
\section*{Test of psfragx}
\includegraphicx[width=0.4\linewidth,overwritepfx,overwriteovp]{example.eps}
\hfill
\includegraphicx[width=0.4\linewidth,pfx=false,ovp=false]{example.eps}
\section*{We switch to french...}
\selectlanguage{french}
\vspace{\stretch{1}}\par
\begin{overpic}[height=0.35\textheight]{example.eps}
\put(10,10){(10,10)}
\put(25,25){(25,25)}
\end{overpic}
\vspace{\stretch{1}}\par
Entre les deux graphiques qui suivent, nous revenons à
l'anglais.\\ [2cm]
\noindent
\includegraphics[width=0.4\linewidth]%
(\psfrag{W}[][][1][60]{\textcolor{red}{W}})
<\put(40,40){\fcolorbox{red}{red}{\textcolor{white}{Avant}}}
\put(50,50){\fcolorbox{red}{red}{\textcolor{white}{Avant}}}
\put(25,20){\fcolorbox{red}{red}{\textcolor{white}{Avant}}}>
[\put(40,45){\fcolorbox{blue}{blue}{\textcolor{yellow}{Fond}}}
\put(25,30){\fcolorbox{blue}{blue}{\textcolor{yellow}{Fond}}}
\put(60,50){\fcolorbox{blue}{blue}{\textcolor{yellow}{Fond}}}
\put(50,10){\resizebox{3cm}{3cm}{\includegraphicx[ovp=false]{example.eps}}}
\put(65,45){\resizebox{2cm}{2cm}{\includegraphicx[ovp=true]{example.eps}}}]
{example.eps}%
\hfill \selectlanguage{english}%
\mbox{%
\begin{overpix}[width=0.4\linewidth]%
<\put(40,40){\fcolorbox{red}{red}{\textcolor{white}{Avant}}}
\put(50,50){\fcolorbox{red}{red}{\textcolor{white}{Avant}}}
\put(25,20){\fcolorbox{red}{red}{\textcolor{white}{Avant}}}>
[\put(40,45){\fcolorbox{blue}{blue}{\textcolor{yellow}{Fond}}}
\put(25,30){\fcolorbox{blue}{blue}{\textcolor{yellow}{Fond}}}
\put(60,50){\fcolorbox{blue}{blue}{\textcolor{yellow}{Fond}}}]
{example.eps}
\put(50,55){\fcolorbox{green}{green}{\textcolor{white}{Milieu}}}
\end{overpix}
}
You can notice that automatic inclusion of picture elements is
possible even when the graphic is itself embedded into another
overpic environment.
\section*{Source code}
\footnotesize
\verbatiminput{example.tex}
\end{document}
\end{filecontents}
\begin{filecontents*}{example.eps}
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: MATLAB, The Mathworks, Inc.
%%Title: example.eps
%%CreationDate: 08/02/2003 20:21:32
%%DocumentNeededFonts: Helvetica
%%DocumentProcessColors: Cyan Magenta Yellow Black
%%LanguageLevel: 2
%%Pages: 1
%%BoundingBox: 35 453 340 684
%<pfx>%% This is just a comment line
%<*pfx>
%%% Default legends
%\psfrag{A}{$A_{\mbox{en}}$}
%\psfrag{B}[][][1][180]{B}
%%% French variations of the legends
%\onlylanguage{french}
%\psfrag{A}{$A_{\mbox{fr}}$}
%\psfrag{B}[][][1][180]{\textcolor{red}{B}}
%\endonlylanguage
%%% Alternative syntax.
%\iflanguage{french}
% {\psfrag{W}{Titre}}
% {\psfrag{W}{Title}}
%</pfx>
%<*ovp>
%\onlylanguage{english}
%\put(0,0){(0,0)}
%\put(20,20){(20,20)}
%\put(30,30){(30,30)}
%\put(100,0){(100,0)}
%\endonlylanguage
%\iflanguage{french}{\put(0,70){(0;70)}}{\put(0,70){(0,70)}}
%%% French variations of the legends
%\onlylanguage{french}
%\put(0,0){(0;0)}
%\put(20,20){(20;20)}
%\put(30,30){(30;30)}
%\put(100,0){(100;0)}
%\endonlylanguage
%</ovp>
%\endinput
%%EndComments
%%BeginProlog
% MathWorks dictionary
/MathWorks 160 dict begin
% definition operators
/bdef {bind def} bind def /ldef {load def} bind def /xdef {exch
def} bdef /xstore {exch store} bdef
% operator abbreviations
/c /clip ldef /cc /concat ldef /cp /closepath ldef /gr /grestore
ldef /gs /gsave ldef /mt /moveto ldef /np /newpath ldef /cm
/currentmatrix ldef /sm /setmatrix ldef /rm /rmoveto ldef /rl
/rlineto ldef /s /show ldef /sc {setcmykcolor} bdef /sr
/setrgbcolor ldef /sg /setgray ldef /w /setlinewidth ldef /j
/setlinejoin ldef /cap /setlinecap ldef /rc {rectclip} bdef /rf
{rectfill} bdef
% page state control
/pgsv () def /bpage {/pgsv save def} bdef /epage {pgsv restore}
bdef /bplot /gsave ldef /eplot {stroke grestore} bdef
% orientation switch
/portraitMode 0 def /landscapeMode 1 def /rotateMode 2 def
% coordinate system mappings
/dpi2point 0 def
% font control
/FontSize 0 def /FMS {/FontSize xstore findfont [FontSize 0 0
FontSize neg 0 0]
makefont setfont} bdef
/ISOLatin1Encoding where {pop /WindowsLatin1Encoding 256 array
bdef ISOLatin1Encoding WindowsLatin1Encoding copy pop
/.notdef/.notdef/quotesinglbase/florin/quotedblbase/ellipsis/dagger
/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE/.notdef/.notdef
/.notdef/.notdef/quoteleft/quoteright/quotedblleft/quotedblright/bullet
/endash/emdash/tilde/trademark/scaron/guilsinglright/oe/.notdef/.notdef
/Ydieresis WindowsLatin1Encoding 128 32 getinterval astore pop}
{/WindowsLatin1Encoding StandardEncoding bdef} ifelse /reencode
{exch dup where {pop load} {pop StandardEncoding} ifelse
exch dup 3 1 roll findfont dup length dict begin
{ 1 index /FID ne {def}{pop pop} ifelse } forall
/Encoding exch def currentdict end definefont pop} bdef
/isroman {findfont /CharStrings get /Agrave known} bdef /FMSR {3 1
roll 1 index dup isroman {reencode} {pop pop} ifelse
exch FMS} bdef
/csm {1 dpi2point div -1 dpi2point div scale neg translate
dup landscapeMode eq {pop -90 rotate}
{rotateMode eq {90 rotate} if} ifelse} bdef
% line types: solid, dotted, dashed, dotdash
/SO { [] 0 setdash } bdef /DO { [.5 dpi2point mul 4 dpi2point mul]
0 setdash } bdef /DA { [6 dpi2point mul] 0 setdash } bdef /DD {
[.5 dpi2point mul 4 dpi2point mul 6 dpi2point mul 4
dpi2point mul] 0 setdash } bdef
% macros for lines and objects
/L {lineto stroke} bdef /MP {3 1 roll moveto 1 sub {rlineto}
repeat} bdef /AP {{rlineto} repeat} bdef /PDlw -1 def /W {/PDlw
currentlinewidth def setlinewidth} def /PP {closepath eofill} bdef
/DP {closepath stroke} bdef /MR {4 -2 roll moveto dup 0 exch
rlineto exch 0 rlineto
neg 0 exch rlineto closepath} bdef
/FR {MR stroke} bdef /PR {MR fill} bdef /L1i {{currentfile picstr
readhexstring pop} image} bdef /tMatrix matrix def /MakeOval
{newpath tMatrix currentmatrix pop translate scale 0 0 1 0 360 arc
tMatrix setmatrix} bdef /FO {MakeOval stroke} bdef /PO {MakeOval
fill} bdef /PD {currentlinecap 1 cap 3 1 roll 2 copy mt lineto
stroke
cap PDlw -1 eq not {PDlw w /PDlw -1 def} if} def
/FA {newpath tMatrix currentmatrix pop translate scale
0 0 1 5 -2 roll arc tMatrix setmatrix stroke} bdef
/PA {newpath tMatrix currentmatrix pop translate 0 0 moveto
scale
0 0 1 5 -2 roll arc closepath tMatrix setmatrix fill} bdef
/FAn {newpath tMatrix currentmatrix pop translate scale
0 0 1 5 -2 roll arcn tMatrix setmatrix stroke} bdef
/PAn {newpath tMatrix currentmatrix pop translate 0 0 moveto scale
0 0 1 5 -2 roll arcn closepath tMatrix setmatrix fill} bdef
/vradius 0 def /hradius 0 def /lry 0 def /lrx 0 def /uly 0 def
/ulx 0 def /rad 0 def /MRR {/vradius xdef /hradius xdef /lry xdef
/lrx xdef /uly xdef
/ulx xdef newpath tMatrix currentmatrix pop ulx hradius add uly
vradius add translate hradius vradius scale 0 0 1 180 270 arc
tMatrix setmatrix lrx hradius sub uly vradius add translate
hradius vradius scale 0 0 1 270 360 arc tMatrix setmatrix
lrx hradius sub lry vradius sub translate hradius vradius scale
0 0 1 0 90 arc tMatrix setmatrix ulx hradius add lry vradius sub
translate hradius vradius scale 0 0 1 90 180 arc tMatrix setmatrix
closepath} bdef
/FRR {MRR stroke } bdef /PRR {MRR fill } bdef /MlrRR {/lry xdef
/lrx xdef /uly xdef /ulx xdef /rad lry uly sub 2 div def
newpath tMatrix currentmatrix pop ulx rad add uly rad add translate
rad rad scale 0 0 1 90 270 arc tMatrix setmatrix lrx rad sub lry rad
sub translate rad rad scale 0 0 1 270 90 arc tMatrix setmatrix
closepath} bdef
/FlrRR {MlrRR stroke } bdef /PlrRR {MlrRR fill } bdef /MtbRR {/lry
xdef /lrx xdef /uly xdef /ulx xdef /rad lrx ulx sub 2 div def
newpath tMatrix currentmatrix pop ulx rad add uly rad add translate
rad rad scale 0 0 1 180 360 arc tMatrix setmatrix lrx rad sub lry rad
sub translate rad rad scale 0 0 1 0 180 arc tMatrix setmatrix
closepath} bdef
/FtbRR {MtbRR stroke } bdef /PtbRR {MtbRR fill } bdef /stri 6
array def /dtri 6 array def /smat 6 array def /dmat 6 array def
/tmat1 6 array def /tmat2 6 array def /dif 3 array def /asub
{/ind2 exch def /ind1 exch def dup dup
ind1 get exch ind2 get sub exch } bdef
/tri_to_matrix {
2 0 asub 3 1 asub 4 0 asub 5 1 asub
dup 0 get exch 1 get 7 -1 roll astore } bdef
/compute_transform {
dmat dtri tri_to_matrix tmat1 invertmatrix
smat stri tri_to_matrix tmat2 concatmatrix } bdef
/ds {stri astore pop} bdef /dt {dtri astore pop} bdef /db {2 copy
/cols xdef /rows xdef mul dup 3 mul string
currentfile
3 index 0 eq {/ASCIIHexDecode filter}
{/ASCII85Decode filter 3 index 2 eq {/RunLengthDecode filter} if }
ifelse exch readstring pop
dup 0 3 index getinterval /rbmap xdef
dup 2 index dup getinterval /gbmap xdef
1 index dup 2 mul exch getinterval /bbmap xdef pop pop}bdef
/it {gs np dtri aload pop moveto lineto lineto cp c
cols rows 8 compute_transform
rbmap gbmap bbmap true 3 colorimage gr}bdef
/il {newpath moveto lineto stroke}bdef currentdict end def
%%EndProlog
%%BeginSetup
MathWorks begin
0 cap
end
%%EndSetup
%%Page: 1 1
%%BeginPageSetup
%%PageBoundingBox: 35 453 340 684
MathWorks begin bpage
%%EndPageSetup
%%BeginObject: obj1
bplot
/dpi2point 12 def portraitMode 0336 8160 csm
89 -48 3658 2771 rc
85 dict begin %Colortable dictionary
/c0 { 0 0 0 sr} bdef /c1 { 1 1 1 sr} bdef /c2 { 1 0 0 sr} bdef /c3
{ 0 1 0 sr} bdef /c4 { 0 0 1 sr} bdef /c5 { 1 1 0 sr} bdef /c6 { 1
0 1 sr} bdef /c7 { 0 1 1 sr} bdef c0 1 j 1 sg
0 0 4086 2724 rf
6 w 0 2219 3166 0 0 -2219 531 2423 4 MP PP -3166 0 0 2219 3166 0 0
-2219 531 2423 5 MP stroke 4 w DO SO 6 w 0 sg
531 204 mt 3697 204 L
531 2423 mt 3697 2423 L
3697 2423 mt 3697 204 L
531 2423 mt 531 204 L
531 2423 mt 3697 2423 L
531 2423 mt 531 204 L
531 2423 mt 531 2391 L
531 204 mt 531 235 L
%%IncludeResource: font Helvetica
/Helvetica /WindowsLatin1Encoding 120 FMSR
498 2568 mt
(0) s 1034 2423 mt 1034 2391 L 1034 204 mt 1034 235 L 1001 2568
mt (1) s 1538 2423 mt 1538 2391 L 1538 204 mt 1538 235 L 1505
2568 mt (2) s 2042 2423 mt 2042 2391 L 2042 204 mt 2042 235 L
2009 2568 mt (3) s 2546 2423 mt 2546 2391 L 2546 204 mt 2546 235
L 2513 2568 mt (4) s 3050 2423 mt 3050 2391 L 3050 204 mt 3050
235 L 3017 2568 mt (5) s 3554 2423 mt 3554 2391 L 3554 204 mt
3554 235 L 3521 2568 mt (6) s
531 2423 mt 562 2423 L
3697 2423 mt 3665 2423 L
360 2467 mt
(-1) s
531 1868 mt 562 1868 L
3697 1868 mt 3665 1868 L
260 1912 mt
(-0.5) s
531 1313 mt 562 1313 L
3697 1313 mt 3665 1313 L
430 1357 mt
(0) s
531 758 mt 562 758 L
3697 758 mt 3665 758 L
330 802 mt
(0.5) s
531 204 mt 562 204 L
3697 204 mt 3665 204 L
430 248 mt
(1) s
531 204 mt 3697 204 L
531 2423 mt 3697 2423 L
3697 2423 mt 3697 204 L
531 2423 mt 531 204 L
gs 531 204 3167 2220 rc /c8 { 0.000000 0.000000 1.000000 sr} bdef
c8 57 -125 51 -110 51 -108 50 -104 26 -50 50 -97 26 -47 25 -45 25
-42 26 -42 25 -39 25 -37 26 -35 25 -33 25 -30 26 -28 25 -26 25 -23
26 -21 25 -17 25 -16 26 -12 25 -10 25 -7 26 -4 25 -2 25 2 26 4 25
7 25 10 26 12 25 16 25 17 26 21 25 23 25 26 26 28 25 30 25 33 26
35 25 37 25 39 26 42 25 42 25 45 26 47 25 47 25 50 26 50 50 104 26
54 50 109 101 222 51 111 51 109 25 54 25 53 26 52 25 51 25 50 26
49 25 47 25 45 26 44 25 42 25 40 26 39 25 36 25 34 13 16 25 30 13
15 25 26 13 13 25 23 13 11 25 19 13 8 25 16 13 6 25 11 13 5 25 7
13 2 25 3 13 0 25 -1 13 -2 25 -5 13 -4 25 -10 13 -6 25 -14 13 -8
25 -17 13 -10 25 -22 13 -12 25 -26 13 -13 25 -30 13 -15 25 -33 13
-17 25 -36 13 -19 25 -39 13 -21 25 -42 13 -21 25 -45 13 -23 25 -47
13 -24 25 -50 13 -25 25 -51 13 -26 25 -52 13 -27 25 -54 13 -27 25
-55 13 -27 13 -28 12 -28 13 -27 13 -28 12 -28 6 -14 531 1313 131
MP stroke gr
c8 0 sg 2073 2711 mt (A) s
205 1354 mt -90 rotate
(B) s 90 rotate 2056 109 mt (W) s
end
eplot
%%EndObject
epage end
showpage
%%Trailer
%%EOF
\end{filecontents*}
\input{example.tex}
|