P A D manual ( pad2ps 3.1j ) (seiichi@muraoka.info.waseda.ac.jp) 1996 11 2
TEX American Mathematical Society PostScript Adobe Systems Incorporated
pad2ps PAD PAD (Problem Analysis Diagram) C 1 2 PAD PAD GOTO BASIC C PAD PAD pad2ps PAD PADEL(PAD Expression Language) C C, C++, Bourne shell, C shell, Java, AWK PAD PostScript PDF L A TEX Encapsulated PostScript (EPS) 4 pad2ps L A TEX pad.sty pad2tex pad2ps 1996 11 2
2 1 PAD 4 1.1................................ 4 1.2 PostScript.................................... 4 1.3 PDF....................................... 5 1.4 L A TEX...................................... 5 1.5 Encapsulated PostScript(EPS)........................ 6 2 PADEL 7 2.1 PAD............................ 7 2.2......................................... 8 2.3.................................. 9 2.4......................................... 9 2.5..................................... 10 2.6..................................... 12 2.6.1................................ 12 2.6.2.................................. 13 2.7......................................... 17 2.8...................................... 18 2.9......................................... 19 3 PAD 21 3.1 C............................................. 21 3.2 C++........................................... 22 3.3 Bourne shell....................................... 23 3.4 C shell.......................................... 23 3.5 Java........................................... 24 3.6 AWK.......................................... 24 3.7...................................... 24 4 25 4.1................................ 25 4.2.................................... 25 4.3..................................... 26 4.4 PADEL L A TEX............................ 27 4.5............................... 28 4.6 PAD............................. 28 4.7................................. 28 4.8.................................... 28 4.9............................... 28 4.10 PAD..................... 28 4.11................................. 29 4.12 PAD............................... 29
3 4.13 PAD..................... 29 4.14................................ 29 4.15 PAD................... 29 4.16 PAD........................... 30 4.17..................................... 30 4.18 PAD...................... 31 4.19............................... 31 4.20............................... 31 4.20.1.................... 31 4.20.2...................... 31 4.21.............................. 32 4.22..................................... 32 A pad2ps 33
4 1. PAD input N sum = 0 N > 1 i = 1, N print sum sum = sum + i 1: 1 N 1 PAD pad2ps PAD 1.1 pad2ps PAD PAD PAD PADEL(PAD Expression Language) PADEL 2 1 1 PAD C pad2ps PAD C 1 N input N if(n > 1) sum = 0 for(i = 1, N) sum = sum + i print sum foo.pad 1.2 PostScript PostScript pad2ps % pad2ps foo.pad > foo.ps
1.3. PDF 5 PostScript 1 4 1.3 PDF PostScript PDF PDF pad2pdf % pad2pdf foo.pad > foo.pdf 1.4 L A TEX L A TEX pad2tex % pad2tex foo.pad > foo.tex L A TEX dvi % jlatex foo.tex % xdvi foo.dvi C PAD L A TEX PostScript L A TEX pad2tex L A TEX \\ L A TEX 1 PAD L A TEX foo.tex \beginfigure[h] \endfigure \padseq% \fbox% PAD \documentstyle pad.sty 1 \fboxsep=10pt PAD pad2tex L A TEX /* pad2ps: texmode = latex */ \LaTeX /* pad2ps: message = $\sqrt2$ */ $ x = 1 $ while ( $ x^2-2 > 0.0001 $) $ \displaystyle x = x - \fracx^2-22 x $
6 1. PAD 2 x = 1 x 2 2 > 0.0001 x = x x2 2 2x 2: L A TEX texmode latex L A TEX 2 PAD pad2tex L A TEX 4 -tab -tab 0 1.5 Encapsulated PostScript(EPS) EPS PAD L A TEX EPS pad2eps % pad2eps foo.pad foo pad2ps pad2tex pad2ps PostScript EPS foo.1.eps foo.2.eps.eps.1.eps ls -stdin % cat foo.pad pad2eps -stdin foo EPS PAD L A TEX \documentstyle epsf.sty EPS \epsfilefile=foo.1.eps,width=5cm,height=7cm EPS 4.15 3 1 pad.sty 1.1j
7 2 PADEL PADEL(PAD Expression Language) PAD PAD 1 pad2ps PAD PADEL C C PADEL PAD 1 \ PADEL pad2ps if( (^_^;;; ) m( )m <== "^\(-o-) PADEL (ˆ ˆ;;; m( )m <== ˆ\( o ) PAD 1.4 pad2tex texmode latex L A TEX L A TEX \ \\ L A TEX PADEL 2.1 PAD PADEL PAD n factorial(n) f = 1 for(i = 1, n) f = f * i return f
8 2. PADEL PADEL 1 PAD C 1 C 1 PADEL PAD PAD 1 C factorial(n) f = 1 for(i = 1, n) f = f * i return f PADEL ( ) 1 PAD ( ) 1 PAD PADEL 1 /* // PAD 2.2 input x print x*x input x print x x 1 1 1 1 1 2 1
2.3. 9 for while 1 else while catch L1: /* // 1 for ( i = 0, 10 ) /* comment */ for ( i = 0, 10 ) / comment / 2.3 PADEL PAD PAD PAD PAD PAD vsp 4.18 2.4 PAD 1 1 1 1
10 2. PADEL ( ) ( ) input a.x input a.y input b.x input b.y c.x = a.x + b.x c.y = a.y + b.y print c.x print c.y input a.x input a.y input b.x input b.y c.x = a.x + b.x c.y = a.y + b.y print c.x print c.y PAD 1 /* // 1 2.5 2 PADEL while do while for do input N while(n < 1)
2.5. 11 for(i = 1, N) input A[i] for(i = 2, N) j = i while(j >= 2 && A[j-1] > A[j]) A[j-1] <-> A[j] j = j - 1 for(i = 1, N) print A[i] N < 1 i = 1, N i = 2, N i = 1, N input N input A[i] j = i j >= 2 && A[j 1] > A[j] print A[i] A[j 1] < > A[j] j = j 1 N N 1 N for 1 while for while PAD for while 1 for(i = 1, N) input A[i] for(i = 1, N) C for(i = 1, N) input A[i]
12 2. PADEL for(i = 1, N) input A[i] 2 1 1 1 for(i = 1, N) input A[i] do while do input N while(n < 1) for(i = 1, N) input A[i] for ( i = 1, N ) input A[i] 2.6 if else switch if else switch 2.6.1 if else 1 if else if else 2.6.2 if if(x < 0) x = -x x < 0 x = x
2.6. 13 else i if(x >= 0) print sqrt(x) else print sqrt(-x) print i x >= 0 print sqrt(x) print sqrt( x) print i if else 1 if(x < 0) x = -x if(x < 0) x = -x if(x >= 0) else x = -x if(x < 0) else if ( x >= 0 ) print sqrt(x) else print sqrt(-x) print i 2.6.2 switch
14 2. PADEL switch case x>0: return 1 case x=0: return 0 case x<0: return -1 x>0 x=0 x<0 return 1 return 0 return 1 3 case C switch(n%3) case 0: print case 1: print case 2: print switch case n%3=0: print case n%3=1: print case n%e=2: print default default PAD 1 1 one = 0 prime = 0 others = 0 for(i = 1, N) switch(a[i]) case 1: one = one + 1 case 2:
2.6. 15 case 3: case 5: case 7: prime = prime + 1 default: others = others + 1 one = 0 prime = 0 others = 0 i = 1, N A[i]=1 A[i]=2 A[i]=3 A[i]=5 A[i]=7 one = one + 1 prime = prime + 1 others = others + 1 case default switch case x%3=0: case x%3=1: move(+1) case x%3=2: move(-1) x%3=0 x%3=1 x%3=2 move(+1) move( 1)
16 2. PADEL PAD 2 switch case default 1 switch case n > 0 && m > 0: print n*m > 0 case n < 0: print n < 0 if else if else if(x>0) return 1 else if(x=0) return 0 else error switch switch case x>0: return 1 case x=0: return 0 default: error x>0 x=0 return 1 return 0 error else if if else if else if(x>0) return 1 else if(x=0) return 0 else error 2 pad2tex LATEX
2.7. 17 if else x>0 return 1 return 0 x=0 error if PAD 2.7 try catch try for(x = 0, 1, 0.01) y = f(x) / g(x) print y catch(g(x) = 0) print Divided by 0! x = 0, 1, 0.01 y = f(x) / g(x) print y g(x) = 0 print Divided by 0! if PAD try catch try catch 1 try print sty catch(str = NULL) print NULL! try print sty
18 2. PADEL catch (str = NULL) print NULL! try print sty catch(str = NULL) print NULL! 2.8 PADEL PAD PAD label refer PAD refer label Let s start! input x label Repeat 10 times. for (i = 1, 10) print x*i refer (Let s start!) goto Let s start! input x Repeat 10 times. i = 1, 10 goto Let s start! print x i label 1 refer refer ( ) goto 3
2.9. 19 refer (LABEL) goto refer refer (EXIT) if (x = 0) print \n print The End if (x = 0) print \n EXIT print The End C ( ) : ( ) PADEL LABEL1: label LABEL1 1 1 : ( ) PADEL : : for 2.9 PADEL PAD C C++ /* */ // 2 PADEL 1 PADEL /* // */
20 2. PADEL for ( i = 0, N ) /* N */ sum = sum + i C PAD 4
21 3 PAD pad2ps C PA D pad2ps PAD pad2ps PADEL PAD PAD PADEL PADEL mkpad C % mkpad -c foo.c > foo.pad foo.pad pad2ps pad2ps PAD PADEL mkpad PADEL PADEL 3.1 C C PAD % pad2ps -c foo.c > foo.ps.c -c C c2pad PADEL % mkpad -c foo.c > foo.pad -c C PAD PAD -O ; ( ) PAD -semicolon C #ifdef foo.c PAD foo.c % gcc foo.c -DJAPANESE -DJAPANESE pad2ps PA D % pad2ps foo.c -D JAPANESE > foo.ps
22 3. PAD -D C C pad2ps #include <stdio.h> -D -ifdef % pad2ps foo.c -ifdef C PAD C #define NUMBER(X). puts("print Numbers"); NUMBER( 9 ) putchar( \n ); int a; for( a= 0 ; a<=x ; a++) putchar(a); ; ( ) PAD 3.2 C++ C++ PAD % pad2ps -c++ foo.c > foo.ps.c,.cc,.cpp -c++ C++ c2pad PADEL % mkpad -c++ foo.c > foo.pad -c++ C++ C 3.1 C++ PAD -inline
3.3. Bourne shell 23 3.3 Bourne shell Bourne shell PAD % pad2ps -sh foo.sh > foo.ps.sh -sh Bourne shell sh2pad PADEL % mkpad -sh foo.sh > foo.pad -sh Bourne shell 1 PAD PAD function PAD PAD PAD Bourne shell cat << EOF EOF. cat << EOF EOF 1 PAD Bourne shell PAD 3.4 C shell C shell PAD % pad2ps -csh foo.csh > foo.ps.csh -csh C shell csh2pad PADEL % mkpad -csh foo.csh > foo.pad -csh C shell 1 PAD PAD C shell cat << EOF EOF. cat << EOF EOF 1 PAD C shell PAD
24 3. PAD 3.5 Java Java PAD % pad2ps -java foo.java > foo.ps.java -java Java java2pad PADEL % mkpad -java foo.java > foo.pad -java Java PAD PAD -O ; ( ) PAD -semicolon Java PAD 3.6 AWK AWK PAD % pad2ps -awk foo.awk > foo.ps.awk -awk AWK awk2pad PADEL % mkpad -awk foo.awk > foo.pad -awk AWK BEGIN END PAD BEGIN END PAD AWK PAD 3.7 3.1j Tcl/Tk, Pascal, Fortran, Perl C sed awk pad2ps C
25 4 PAD PADEL /* pad2ps: centering = on */ -P % pad2ps foo.pad -P centering=on > foo.ps message comment newpage vsp 4 L A TEX 4.1 title /* pad2ps: title = This is a pad title. */ 4.2 message PAD message input N /* pad2ps: message = */ for(i = 1, N) input A[i] input N i = 1, N input A[i]
26 4. PAD 1 /* pad2ps: message = */ for(i = 1, N) if( A[i] > 0 ) /* pad2ps: message = */ m = m + 1 else /* pad2ps: message = */ m = m - 1 /* pad2ps: message = */ for(i = 1, N) if( A[i] > 0 ) /* pad2ps: message = */ m = m + 1 else /* pad2ps: message = */ m = m - 1 4.3 PADEL comment 2.9 PADEL PAD PAD sum = 0 N = 100 // pad2ps: comment = /* */ for(i = 1, N) sum = sum + i * i // pad2ps: comment = /* */
4.4. PADEL L A TEX 27 sum = 0 N = 100 / / i = 1, N sum = sum + i i / / PAD 1 ( ) for(i = 1, N) /* pad2ps: comment = */ sum = sum + i * i 4.4 PADEL L A TEX pad2tex L A TEX texmode latex verbatim PADEL L A TEX L A TEX PADEL verbatim PADEL PAD latex /* pad2ps: texmode = latex */ /* pad2ps: message = $\sqrt2$ */ $ x = 1 $ while ( $ x^2-2 > 0.0001 $) $ \displaystyle x = x - \fracx^2-22 x $ PAD 2 x = 1 x 2 2 > 0.0001 x = x x2 2 2x verbatim
28 4. $\sqrt2$ $ x = 1 $ $ xˆ2 2 > 0.0001 $ $ \displaystyle x = x \fracxˆ2 22 x $ 4.5 centering on off on off on 4.6 PAD locate topdown bottomup middle middle 4.7 page 1 1 4.8 figure 4.9 figure locate top bottom PAD PAD top PAD bottom bottom top 4.10 PAD titlebox on off PAD off PAD (C ) PA D on PAD PAD PAD off titlebox on
4.11. 29 1 N input N sum = 0 N > 1 i = 1, N print sum sum = sum + i 4.11 pageframe on off 4.12 PAD padframe on PAD on off centering on PAD off 4.13 PAD slice on PAD PAD 1 1 PAD off PAD 4.14 pad2ps PAD hrate vrate 1.0 hrate hrate poster on vrate 4.15 PAD pad2ps 1 PAD PAD 1
30 4. 3: PAD hrate 1 PA D poster on PostScript PAD poster on hrate vrate PAD 3 ( 3) ack.pad poster on PAD PAD 4.16 PAD pad2ps PAD PAD pad2ps PAD PAD PA D max length min length 0 pad2ps 4.17 newpage
4.18. PAD 31 4.18 PAD PAD PAD 2 vsp PAD PADEL vsp vsp PAD 400 120 vsp PAD PAD 0 120 PAD 4.19 page top 0 10000 9800 page bottom 0 10000 0 page left 0 9000 500 page right 0 9000 8500 page left page right centering off on page bottom 4.20 4.20.1 fontsize fontwidth 200 100 fontsize jfontwidth 200 4.20.2 PAD PAD
32 4. title rate 2.0 padtitle rate PAD 1.5 figure rate 1.5 padtitle rate figure rate figure 4.21 PAD PAD pad vspace 400 vspace 200 hspace 200 if vspace 50 box hspace 125 if rightspace 200 sideline space 50 padframe vspace 180 padframe hspace 300 4.22 PAD linewidth PAD 16 padlinewidth PAD 16 framelinewidth PAD 8
33 A pad2ps pad2ps
34 pad2ps.............................. 4 pad2df.............................. 5 pad2tex............................. 5 pad.sty.............................. 5 texmode............................ 5 -tab................................. 5 pad2eps............................. 6 -stdin............................... 6 epsf.sty............................. 6 PADEL............................. 7,.................................. 7,.................................. 9,.................................. 9 while............................... 10 do while......................... 10 for................................. 10,................................. 11 if else............................ 12,................................. 13 switch............................. 13 case................................ 13 default............................. 14 if else............................ 15 try catch........................ 16 label............................... 17 refer............................... 17 / /............................ 19 //................................. 19 mkpad............................. 20 C.................................. 20 -c.................................. 20 c2pad.............................. 20 -O................................. 20 -semicolon......................... 20 -D................................. 21 -ifdef............................... 21 C++............................... 21 -c++.............................. 21 c2pad.............................. 21 -inline.............................. 21 Bourne shell....................... 21 -sh................................. 22 sh2pad............................. 22 C shell............................. 22 -csh................................ 22 csh2pad............................ 22 Java............................... 22 -java............................... 22 java2pad........................... 22 -O................................. 23 -semicolon......................... 23 AWK.............................. 23 -awk............................... 23 awk2pad........................... 23 -P................................. 24 title................................ 24 message............................ 24,................................. 25 comment........................... 25,................................. 26 texmode........................... 26 centering........................... 26 locate.............................. 27 page............................... 27 figure.............................. 27 figure locate....................... 27 titlebox............................ 27 pageframe.......................... 27 padframe.......................... 28 slice................................ 28 hrate............................... 28 vrate............................... 28 poster.............................. 28 max length........................ 29 min length......................... 29 newpage........................... 29 vsp................................ 29 page top........................... 29 page bottom....................... 29 page left........................... 29 page right.......................... 29 fontsize............................ 30 fontwidth.......................... 30 jfontwidth......................... 30
35 title rate........................... 30 padtitle rate....................... 30 figure rate......................... 30 pad vspace......................... 30 vspace............................. 30 hspace............................. 30 if vspace........................... 30 box hspace......................... 30 if rightspace........................ 30 sideline space...................... 30 padframe vspace................... 30 padframe hspace................... 30 linewidth........................... 31 padlinewidth....................... 31 framelinewidth..................... 31