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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
|
% PBM macro for DVIOUT/DVIPRT version 0.5e
% based on eclepsf.sty by Kazuhiro Kazama and modified by Hideki ISOZAKI
% and psfig.tex by Trevor J. Darrell.
%
% All software, documentation, and related files in this distribution of
% psfig/tex are Copyright (c) 1987 Trevor J. Darrell
%
% Permission is granted for use and non-profit distribution of psfig/tex
% providing that this notice be clearly maintained, but the right to
% distribute any portion of psfig/tex for profit or as part of any commercial
% product is specifically reserved for the author.
%
%
%@scaleIvVwł̊TCY(scale=1ł̏o)
%@@ \realscaletrueAPBMf[^1dotv^o͂1dotƂďo
%@@ \realscalefalseAPBMf[^1dot 1pt x 1pt ̓_Ƃďo
%
%@\realscaletruepɁAv^̉𑜓x\pbmhdpi\pbmvdpiŐݒ肵܂B
%@@ Ex. \pbmhdpi=300\pbmvdpi=300
%
% \pbmfile
% usage : \pbmfile{file=foo.pbm,width=5cm,height=3.5cm}
% usage : \pbmfile{file=foo.pbm,width=100pt,height=70pt}
% usage : \pbmfile{file=foo.pbm,scale=2}
% usage : \pbmfile{file=foo.pbm,hscale=1.5,vscale=1.2}
% ^^ ^^
%@@@@@@@@@@@@@@@@IvVԂɁAȂʼnB
%
% \pbmfat
% usage : \pbmfile[\pbmfat(10mm,12mm){eXg}]{file=foo.pbm}
%
% \pbmfon
% usage : \pbmfile[\pbmfon(10mm,12mm){eXg}]{file=foo.pbm}
%
% \ovpbmfon
% usage : \pbmfile[\ovpbmfon(10mm,12mm){eXg}]{file=foo.pbm}
% ^^^^^^^^^
% Ww
%
%
% \giffile
%
% EorgsizeIvVgꍇ
% usage : \giffile{file=foo.gif,orgsize=640x400,scale=2}
% usage : \giffile{file=foo.gif,orgsize=200x200,hscale=3,vscale=2}
%
% EgȂꍇAscaleIvV͎gpsBwidth=height=͏ȗs
% usage : \giffile{file=foo.gif,width=5cm,height=3.5cm}
% usage : \giffile{file=foo.gif,width=100pt,height=70pt}
%
% Oct. 25, 1993 by Yakumo
%
\endlinechar=-1
\typeout{PBM macro ver. 0.5e - Released Oct. 25, 1993}
\newcount\pbmhdpi
\newcount\pbmvdpi
\pbmhdpi=360%<---- v^𑜓x̃ftHgl
\pbmvdpi=360%<---- v^𑜓x̃ftHgl
\newif\ifrealscale
\realscaletrue
\newif\ifset@vscale
\newif\ifset@hscale
\set@vscalefalse\set@hscalefalse
\newif\ifset@orgsize
\set@orgsizefalse
\newdimen\@pbmhsize
\newdimen\@pbmvsize
\newcount\@bmarga
\newcount\@bmargb
\newcount\@bmsum
\newcount\@bmrema
\newcount\@bmremb
\newcount\@bmctmpa
\newcount\@bmctmpb
\newcount\@bmctmpc
\newdimen\@bmdarg
\newif\ifcontinue
\def\@setpbmfile#1{
\def\@pbmfile{#1}
\pbmbb@search
}
\def\@setpbmheight#1{
\@bmdarg=#1\relax
\edef\@pbmheight{\number\@bmdarg}
}
\def\@setpbmwidth#1{
\@bmdarg=#1\relax
\edef\@pbmwidth{\number\@bmdarg}
}
\def\@setpbmscale#1{
\def\@pbmhscale{#1}
\def\@pbmvscale{#1}
\set@vscaletrue\set@hscaletrue
}
\def\@setpbmhscale#1{
\def\@pbmhscale{#1}
\set@hscaletrue
}
\def\@setpbmvscale#1{
\def\@pbmvscale{#1}
\set@vscaletrue
}
\def\parse@pbm@parms#1{
\def\@bbw{0}\def\@bbh{0}
\def\@pbmhscale{1}\def\@pbmvscale{1}
\def\@pbmheight{0}\def\@pbmwidth{0}
\@for\@pbmopt:=#1\do
{\expandafter\@bmsetparms\@pbmopt,}}
\def\@bmsetparms#1=#2,{\@nameuse{@setpbm#1}{#2}}
%
% \pbmin@compute performs #1 * (#2 / #3)
% then leaves the result in @result
%
\def\@divmod#1#2{
\@bmctmpa=#1\relax
\divide\@bmctmpa by#2\relax
\edef\@quotient{\number\@bmctmpa\relax}
\multiply\@bmctmpa by#2\relax
\@bmctmpb=#1\relax
\advance\@bmctmpb by -\@bmctmpa
\edef\@remaindar{\number\@bmctmpb}}
%
\def\pbmin@compute#1#2#3{
\ifnum#3>\z@
\@divmod{#1}{#3}
\@bmsum=\@quotient
\multiply\@bmsum by#2\relax
\@bmrema=\@remaindar\relax
\ifnum\@bmrema>\z@
\@divmod{#2}{#3}
\@bmctmpc=\@quotient
\multiply\@bmctmpc by\@bmrema
\advance\@bmsum by\@bmctmpc
\@bmremb=\@remaindar\relax
\ifnum\@bmremb>\z@
\ifnum#3<32769
\multiply\@bmrema by\@bmremb
\divide\@bmrema by#3\relax
\advance\@bmsum by\@bmrema
\else
\edef\bm@digit{1}
\@bmarga=0\relax
\loop
\edef\bm@digit{\bm@digit0}
\@divmod{\the\@bmremb0}{#3}
\@bmremb=\@remaindar\relax
\@bmargb=\@bmrema
\multiply\@bmargb by\@quotient
\advance\@bmargb by\@bmarga
\@divmod{\@bmargb}{\bm@digit}
\advance\@bmsum by\@quotient
\@bmarga=\@remaindar0\relax
\ifnum\bm@digit<\@bmrema
\repeat
\fi
\fi
\fi
\else
\errmessage{pbm: Illegal parameter}
\fi
\edef\@result{\number\@bmsum}
}
\def\bmcompute@handw{
\ifnum\@pbmheight=\z@
\ifnum\@pbmwidth=\z@
\@bmdarg=\@bbh sp \@bmdarg=\@pbmvscale\@bmdarg
\edef\@pbmheight{\number\@bmdarg}
\@bmdarg=\@bbw sp \@bmdarg=\@pbmhscale\@bmdarg
\edef\@pbmwidth{\number\@bmdarg}
\multiply\@pbmhsize by\@pbmhscale
\multiply\@pbmvsize by\@pbmvscale
\else
\pbmin@compute{\number\@pbmwidth}{\number\@pbmvsize}{\number\@pbmhsize}
\edef\@pbmheight{\@result}
\fi
\else
\ifnum\@pbmwidth=\z@
\pbmin@compute{\number\@pbmheight}{\number\@pbmhsize}{\number\@pbmvsize}
\edef\@pbmwidth{\@result}
\fi
\fi
\ifnum\@pbmheight<\z@
\errmessage{pbm: Illegal height}
\fi
\ifnum\@pbmwidth<\z@
\errmessage{pbm: Illegal width}
\fi
}
\def\pbmfile{\@ifnextchar[{\@pbmfile}{\@pbmfile[]}}
\def\@pbmfile[#1]#2{{
\parse@pbm@parms{#2}
\bmcompute@handw
{\@bmarga=\@pbmwidth \divide\@bmarga by 186468\relax
\@bmargb=\@pbmheight \divide\@bmargb by 186468\relax
\message{becomes \the\@bmarga mm x \the\@bmargb mm}}
\@bmarga=\@pbmheight \divide\@bmarga by 65536\relax
\edef\@bmvsize{\number\@bmarga}
\@bmarga=\@pbmwidth \divide\@bmarga by 65536\relax
\edef\@bmhsize{\number\@bmarga}
\leavevmode
\hbox to \@pbmwidth sp{
\vrule\@width\z@\@height\@pbmheight sp\@depth\z@
\raise\@pbmheight sp
\hbox to\z@{
\ifrealscale
\special{pbmfile=\@pbmfile\space
\ifset@hscale hsize=\number\@pbmhsize dot/\the\pbmhdpi dpi
\else hsize=\@bmhsize\fi\space
\ifset@vscale vsize=\number\@pbmvsize dot/\the\pbmvdpi dpi
\else vsize=\@bmvsize\fi\space
}
\else
\special{pbmfile=\@pbmfile\space
\ifset@hscale hscale=\@pbmhscale
\else hsize=\@bmhsize\fi\space
\ifset@vscale vscale=\@pbmvscale
\else vsize=\@bmvsize\fi\space
}
\fi
}
\vrule\@width\z@\@height\@pbmheight sp \@depth\z@
\hbox to\z@{#1}\hfil
}
}}
\newread\pbm@stream
\catcode`\#=11\relax
\def\pbmbb@search{\continuetrue
\typeout{analyzing \@pbmfile}
\openin\pbm@stream=\@pbmfile\relax
\ifeof\pbm@stream\errmessage{pbm: \@pbmfile\space not found}\fi
\read\pbm@stream to \pbm@line
\expandafter\id@pbmplus\pbm@line.
\ifnum4=\@magic \message{PBM(P4-type) }
\else \ifnum1=\@magic \errmessage{pbm: P1-type not supported}
\else \errmessage{pbm: \@pbmfile\space is not PBM file}\fi\fi
\loop
\read\pbm@stream to \pbm@line
\if\expandafter\next@char\pbm@line\end@getbb #\else\continuefalse\fi
\ifeof\pbm@stream\errmessage{pbm: \@pbmfile\space has no data}\fi
\ifcontinue \repeat
\expandafter\pbm@getbb\pbm@line.
\closein\pbm@stream
}
\catcode`\#=6\relax
\def\next@char#1#2\end@getbb{#1}
\def\id@pbmplus#1#2.{\edef\@magic{\if#1P\next@char#2\end@getbb\else0\fi}}
%
%
\def\pbm@getbb#1 #2.{
\@bmdarg=#1pt\ifrealscale\divide\@bmdarg by \pbmhdpi\@bmdarg=72.27\@bmdarg\fi
\edef\@bbw{\number\@bmdarg}\@pbmhsize=#1sp
\@bmdarg=#2pt\ifrealscale\divide\@bmdarg by \pbmvdpi\@bmdarg=72.27\@bmdarg\fi
\edef\@bbh{\number\@bmdarg}\@pbmvsize=#2sp
\message{original: #1 x #2}
}
%
% You can put anything on the picture using \pbmfat , \pbmfon , \ovpbmfon
%
\def\pbmfat(#1,#2)#3{\@killglue{
\smash{\raise#2\hbox to \z@{\kern#1 \relax#3\hss}}}\ignorespaces}
%
\newbox\@strbox
%
\def\pbmfon(#1,#2)#3{
\setbox\@strbox=\hbox{#3}
\@bmctmpa=\number\wd\@strbox
\@bmctmpb=\number\ht\@strbox
\@bmctmpc=\number\dp\@strbox
\advance\@bmctmpc by\@bmctmpb
\divide\@bmctmpc by 4736\relax
\divide\@bmctmpa by 4736\relax
\pbmfat(#1,#2){
\raise\@bmctmpb sp\hbox to\z@{
\special{pn 0}\special{sh 0}
\special{pa 0 0}\special{pa \the\@bmctmpa\space 0}
\special{pa \the\@bmctmpa\space \the\@bmctmpc}\special{pa 0 \the\@bmctmpc}
\special{pa 0 0}
\special{ip}}#3
}
}
%
\newdimen\ovrulewidth
\newdimen\ovradius
\ovrulewidth=0.4pt
\ovradius=2mm
\def\hornlength{5}
%
\def\ovpbmfon{\@ifnextchar({\@ovpbmfon{}}{\@ovpbmfon}}
\def\@ovpbmfon#1(#2,#3)#4{
\setbox\@strbox=\hbox{#4}
\@bmctmpa=\number\wd\@strbox
\@bmctmpb=\number\ht\@strbox
\@bmctmpc=\number\dp\@strbox
\@bmremb=\number\ovrulewidth
\@bmarga=\number\ovradius
\divide\@bmarga by 4736\relax
\edef\CoRadius{\the\@bmarga}
\divide\@bmarga by 2\relax
\edef\CoBase{\the\@bmarga}
\@bmdarg=\ovradius
\advance\@bmdarg by\@bmremb sp
\@bmarga=\number\@bmdarg
\advance\@bmctmpc by\@bmctmpb
\advance\@bmctmpb by\@bmarga
\divide\@bmctmpc by 4736\relax
\divide\@bmctmpa by 4736\relax
\divide\@bmarga by 4736\relax
\divide\@bmremb by 4736\relax
\advance\@bmctmpa by\@bmarga
\@bmargb=\@bmctmpa
\advance\@bmargb by\@bmarga
\advance\@bmctmpc by\@bmarga
\@bmrema=\@bmctmpc
\advance\@bmrema by\@bmarga
\advance\@bmargb by-\@bmremb
\advance\@bmrema by-\@bmremb
\if#1\@empty\else
\@bmsum=\@bmarga
\divide\@bmsum by 10\relax
\multiply\@bmsum by\hornlength
\edef\@hornlg{\the\@bmsum}
\if#1a\@bmsum=\@bmremb
\advance\@bmsum by -\@hornlg\relax
\edef\@hornx{\the\@bmsum}
\else\if#1b\@bmsum=\@bmargb
\advance\@bmsum by \@hornlg\relax
\edef\@hornx{\the\@bmsum}
\@bmsum=\@bmremb
\advance\@bmsum by -\@hornlg\relax
\edef\@horny{\the\@bmsum}
\else\if#1c\@bmsum=\@bmargb
\advance\@bmsum by \@hornlg\relax
\edef\@hornx{\the\@bmsum}
\@bmsum=\@bmrema
\advance\@bmsum by \@hornlg\relax
\edef\@horny{\the\@bmsum}
\else\if#1d\@bmsum=\@bmremb
\advance\@bmsum by -\@hornlg\relax
\edef\@hornx{\the\@bmsum}
\@bmsum=\@bmrema
\advance\@bmsum by \@hornlg\relax
\edef\@horny{\the\@bmsum}
\else\multiply\@bmsum by 3\relax
\edef\@hornlg{\the\@bmsum}
\if#1A\pbm@horn\@bmctmpa\@bmremb{-\@hornlg}
\else\if#1B\pbm@horn\@bmctmpc\@bmargb{\@hornlg}
\else\if#1C\pbm@horn\@bmctmpa\@bmrema{\@hornlg}
\else\if#1D\pbm@horn\@bmctmpc\@bmremb{-\@hornlg}
\fi\fi\fi\fi\fi\fi\fi\fi\fi
\pbmfat(#2,#3){
\raise\@bmctmpb sp\hbox to\z@{
\special{pn \the\@bmremb}\special{sh 0}
\special{pa \the\@bmarga\space \the\@bmremb}
\if#1A\special{pa \@horni\space \the\@bmremb}
\special{pa \@hornx\space \@horny}
\special{pa \@hornii\space \the\@bmremb}\fi
\special{pa \the\@bmctmpa\space \the\@bmremb}
\if#1b\special{pa \@hornx\space \@horny}\fi
\special{pa \the\@bmargb\space \the\@bmarga}
\if#1B\special{pa \the\@bmargb\space \@horni}
\special{pa \@horny\space \@hornx}
\special{pa \the\@bmargb\space \@hornii}\fi
\special{pa \the\@bmargb\space \the\@bmctmpc}
\if#1c\special{pa \@hornx\space \@horny}\fi
\special{pa \the\@bmctmpa\space \the\@bmrema}
\if#1C\special{pa \@hornii\space \the\@bmrema}
\special{pa \@hornx\space \@horny}
\special{pa \@horni\space \the\@bmrema}\fi
\special{pa \the\@bmarga\space \the\@bmrema}
\if#1d\special{pa \@hornx\space \@horny}\fi
\special{pa \the\@bmremb\space \the\@bmctmpc}
\if#1D\special{pa \the\@bmremb\space \@hornii}
\special{pa \@horny\space \@hornx}
\special{pa \the\@bmremb\space \@horni}\fi
\special{pa \the\@bmremb\space \the\@bmarga}
\if#1a\special{pa \@hornx\space \@hornx}\fi
\special{pa \the\@bmarga\space \the\@bmremb}
\ifnum\@bmremb>0\special{fp}\else\special{ip}\fi
\if#1a\else\special{sh 0}
\special{ia \the\@bmarga\space \the\@bmarga\space
\CoRadius\space \CoRadius\space 0.0 6.28319}
\ifnum\@bmremb>0\special{ar \the\@bmarga\space \the\@bmarga\space
\CoRadius\space \CoRadius\space 3.14159 4.71239}\fi\fi
\if#1b\else\special{sh 0}
\special{ia \the\@bmctmpa\space \the\@bmarga\space
\CoRadius\space \CoRadius\space 0.0 6.28319}
\ifnum\@bmremb>0\special{ar \the\@bmctmpa\space \the\@bmarga\space
\CoRadius\space \CoRadius\space 4.71239 6.28319}\fi\fi
\if#1c\else\special{sh 0}
\special{ia \the\@bmctmpa\space \the\@bmctmpc\space
\CoRadius\space \CoRadius\space 0.0 6.28319}
\ifnum\@bmremb>0\special{ar \the\@bmctmpa\space \the\@bmctmpc\space
\CoRadius\space \CoRadius\space 0.0 1.5708}\fi\fi
\if#1d\else\special{sh 0}
\special{ia \the\@bmarga\space \the\@bmctmpc\space
\CoRadius\space \CoRadius\space 0.0 6.28319}
\ifnum\@bmremb>0\special{ar \the\@bmarga\space \the\@bmctmpc\space
\CoRadius\space \CoRadius\space 1.5708 3.14159}\fi\fi
}\hbox to\z@{\kern\the\@bmdarg\relax #4\hss}
}
}
\def\pbm@horn#1#2#3{
\@bmsum=#1\relax
\advance\@bmsum by \@bmarga
\divide\@bmsum by 2\relax
\advance\@bmsum by -\CoBase\relax
\edef\@horni{\the\@bmsum}
\advance\@bmsum by \CoBase\relax
\edef\@hornx{\the\@bmsum}
\advance\@bmsum by \CoBase\relax
\edef\@hornii{\the\@bmsum}
\@bmsum=#2\relax
\advance\@bmsum by #3\relax
\edef\@horny{\the\@bmsum}
}
%
% GIF macros
%
\def\@setpbmorgsize#1{
\gif@search#1.
\set@orgsizetrue
}
\def\gif@search#1x#2.{\pbm@getbb#1 #2.}
\def\giffile{\@ifnextchar[{\@giffile}{\@giffile[]}}
\def\@giffile[#1]#2{{
\def\@setpbmfile##1{\def\@pbmfile{##1}}
\typeout{input GIF file}
\parse@pbm@parms{#2}
\ifset@orgsize
\bmcompute@handw
{\@bmarga=\@pbmwidth \divide\@bmarga by 186468\relax
\@bmargb=\@pbmheight \divide\@bmargb by 186468\relax
\message{becomes \the\@bmarga mm x \the\@bmargb mm}}
\else
\ifset@hscale\errmessage{gif(\@pbmfile): You must set orgsize option}\fi
\ifset@vscale\errmessage{gif(\@pbmfile): You must set orgsize option}\fi
\ifnum\@pbmheight<1\errmessage{gif(\@pbmfile): You should set the height}\fi
\ifnum\@pbmwidth<1\errmessage{gif(\@pbmfile): You should set the width}\fi
\fi
\@bmarga=\@pbmheight \divide\@bmarga by 65536\relax
\edef\@bmvsize{\number\@bmarga}
\@bmarga=\@pbmwidth \divide\@bmarga by 65536\relax
\edef\@bmhsize{\number\@bmarga}
\leavevmode
\hbox to \@pbmwidth sp{
\vrule\@width\z@\@height\@pbmheight sp\@depth\z@
\raise\@pbmheight sp
\hbox to\z@{
\ifrealscale
\special{giffile=\@pbmfile\space
\ifset@hscale hsize=\number\@pbmhsize dot/\the\pbmhdpi dpi
\else hsize=\@bmhsize\fi\space
\ifset@vscale vsize=\number\@pbmvsize dot/\the\pbmvdpi dpi
\else vsize=\@bmvsize\fi\space
}
\else
\special{pbmfile=\@pbmfile\space
\ifset@hscale hscale=\@pbmhscale
\else hsize=\@bmhsize\fi\space
\ifset@vscale vscale=\@pbmvscale
\else vsize=\@bmvsize\fi\space
}
\fi
}
\vrule\@width\z@\@height\@pbmheight sp \@depth\z@
\hbox to\z@{#1}\hfil
}
}}
\def\giffat{\pbmfat}
\def\giffon{\pbmfon}
\def\ovgiffon{\ovpbmfon}
%
\endlinechar=13\relax
\endinput
|