summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pst-pdf/pst-pdf.dtx
blob: bf3cbc1a484383a6a4096994d52c36a3bc402761 (plain)
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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
% \iffalse meta-comment
%
% Copyright (C) 
%   2005--2008: Rolf Niepraschk <Rolf.Niepraschk@gmx.de>, Hubert Gaesslein
%   2008--      Rolf Niepraschk <Rolf.Niepraschk@gmx.de>
% --------------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{pst-pdf.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{pst-pdf}
%<*package>
    [2019/11/15 v1.2e PS graphics for pdfLaTeX (RN,HjG)]
%</package>
%
%<*driver>
\listfiles
\documentclass[a4paper]{ltxdoc}
\usepackage[ignore]{pst-pdf}
\providecommand*\mainlang{}
\usepackage[english,\mainlang]{babel}
\usepackage{booktabs,calc,array,url}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\setlength\emergencystretch{3em}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{pst-pdf.dtx}
  \begin{otherlanguage}{english}
    \PrintChanges \clearpage
    \PrintIndex
  \end{otherlanguage}
\end{document}
%</driver>
% \fi
%
% \CheckSum{839}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v1.0a}{2005/01/27}{Initial version.}
% \changes{v1.0b}{2005/01/28}{Some code and documentation cleaning. (RN)}
% \changes{v1.0d}{2005/01/30}{Redefinition of \cmd{\includegraphics} in
%   modes 0 und 1. Now using of eps graphics directly in pdf\LaTeX{} is
%   possible. (RN)}
% \changes{v1.0j}{2005/02/22}{Check AtBeginDocument for package
%   `pstricks' even if ``nopstricks'' is given. (RN)}
% \changes{v1.0j}{2005/02/22}{For \cmd{\includegraphics}
% \cmd{\usepicture} and \string\verb+postscript+ the new options ``frame'',
% ``framesep'', ``framerule'', ``linewidth'', and ``ignore'' added. (RN)}
% \changes{v1.0l}{2005/02/25}{Options ``framesep'', ``framerule'',
% ``linewidth'' removed, ``fname'' and ``innerframe'' added. (RN)}
% \changes{v1.0m}{2005/02/26}{New package option ``notightpage'' added. (RN)}
% \changes{v1.0n}{2005/02/27}{Some code cleaning. (RN)}
% \changes{v1.0n}{2005/02/27}{Changed marcro names (\cmd{\savepicture}
% and \cmd{\usepicture}). (RN)}
% \changes{v1.0o}{2005/03/12}{Option ``fname'' renamed to ``showname''. (RN)}
% \changes{v1.0p}{2005/03/13}{Some code and documentation cleaning. (RN)}
% \changes{v1.0s}{2005/03/28}{Scaling e.g. of PostScript pictures now only
% in extraction mode. Some code cleaning. (RN)}
% \changes{v1.1b}{2005/04/09}{Some code and documentation cleaning. (RN)}
% \changes{v1.1c}{2005/04/17}{New package option ``tightpage'' added. (RN)}
% \changes{v1.1k}{2006/02/10}{New environment pst-pdf-defs: Support for
% PSTricks environment ``psmatrix'' inside user definitions. (RN,HjG)}
% \changes{v1.1m}{2006/03/10}{Merge english and german version of the
% documentation. (RN)}
% \changes{v1.2c}{2017/04/24}{``postscript'' environment no more allowed before 
% \cmd{\begin}{\ttfamily\char`\{document\char`\}} (changed example file). }
% \GetFileInfo{pst-pdf.dtx}
%
% \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment}
% \DoNotIndex{\providecommand,\def,\edef,\let,\gdef,\xdef,\global,\newtoks}
% \DoNotIndex{\chardef,\@namedef,\g@addto@macro,\newif,\newcounter}
% \DoNotIndex{\RequirePackage,\DeclareOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\input,\endinput,\IfFileExists,\InputIfFileExists}
% \DoNotIndex{\@ifdefinable,\@ifundefined,\@percentchar}
% \DoNotIndex{\iftrue,\iffalse}
% \DoNotIndex{\the,\if,\ifx,\else,\or,\fi,\ifnum,\ifdim,\ifcase,\ifodd}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\AtEndOfPackage}
% \DoNotIndex{\PackageError,\PackageWarning,\PackageWarningNoLine,\PackageInfo}
% \DoNotIndex{\message,\MessageBreak,\typeout,\space,\@spaces}
% \DoNotIndex{\@tempa,\@tempb,\x}
% \DoNotIndex{\z@,\z@skip,\p@,\@ne,\tw@,\thr@@,\@iv,\two@fourteen,\strip@pt}
% \DoNotIndex{\advance,\multiply,\divide}
% \DoNotIndex{\@for,\@tfor,\do,\@gobble,\@gobbletwo,\relax,\ignorespaces}
% \DoNotIndex{\csname,\endcsname,\begingroup,\endgroup,\bgroup,\egroup}
% \DoNotIndex{\expandafter,\afterassignment,\aftergroup,\noexpand}
% \DoNotIndex{\setbox,\box,\hbox,\vbox,\ht,\wd,\dp,\llap,\rlap}
% \DoNotIndex{\small,\large,\tiny,\ttfamily,\lowercase}
% \DoNotIndex{\@@,\@empty,\@firstoftwo,\@secondoftwo}
% \DoNotIndex{\@tempboxa,\@tempcnta,\@temptokena,\toks@,\@namedef,\@nameuse}
%
% \providecommand*\env[1]{\textsf{#1}}
% \providecommand*\clsname[1]{\textsf{#1}}
% \providecommand*\pkgname[1]{\textsf{\mbox{#1}}}
% \providecommand*\optname[1]{\textsf{#1}}
% \providecommand*\progname[1]{\textsf{`#1'}}
%
% \providecommand*\PS{Post\-Script}
%
% \newenvironment{optlist}%
% {\begin{description}%
%   \renewcommand\makelabel[1]{%
%     \descriptionlabel{\bfseries\optname{##1}}}%
%   \itemsep0.25\itemsep}%
% {\end{description}}
%
% \newcommand*\META[1]{\meta{\normalfont#1}}
% \newcommand*\TorF{\META{true\textbar false}}
%
% \newif\ifGERMAN  \GERMANfalse
% \newif\ifENGLISH \ENGLISHfalse
% \iflanguage{ngerman}{\GERMANtrue}{%
%   \iflanguage{german}{\GERMANtrue}{\GERMANfalse}}
% \iflanguage{english}{\ENGLISHtrue}{\ENGLISHfalse}
%
% ^^A ----------------------------------------------------------
%
% \ifGERMAN
%   \title{Das Paket \pkgname{pst-pdf}\thanks{Dieses Dokument
%     bezieht sich auf \textsf{pst-pdf}~\fileversion\ vom \filedate.}}
% \fi
% \ifENGLISH
%   \title{The \pkgname{pst-pdf} package\thanks{This document
%     corresponds to \textsf{pst-pdf}~\fileversion, dated \filedate.
%     Thanks to Peter Dyballa for the translation.}}
% \fi
%
% \author{%
%   Rolf Niepraschk\thanks{\texttt{Rolf.Niepraschk@gmx.de}}
%   \and
%   Hubert G\"a{\ss}lein}
% \date{\filedate}
%
% \maketitle
%
% \ifGERMAN
%   \section{Einleitung}
%
%   Das Paket \pkgname{pst-pdf} vereinfacht die Verwendung von
%   PSTricks-Grafiken und anderem \PS-Code in PDF-Dokumenten.
%   \"Ahnlich wie beim Erstellen des Literaturverzeichnisses mit bib\TeX{}
%   werden zus\"atzlich externe Programme aufgerufen. Sie dienen in
%   diesem Fall dazu, eine PDF-Datei, die s\"amtliche Grafiken
%   enth\"alt, zu erzeugen. Ihr Inhalt wird im endg\"ultigen Dokument
%   statt des urspr\"unglichen \PS-Codes eingef\"ugt.
% \fi
%
% \ifENGLISH
%   \section{Introduction}
%
%   The package \pkgname{pst-pdf} simplifies the use of graphics from
%   PSTricks and other \PS\ code in PDF documents. As in building a
%   bibliography with \BibTeX{} additional external programmes are being
%   invoked. In this case they are used to create a PDF file
%   (\cmd{\PDFcontainer}) that will contain all this graphics material. In the
%   final document this contents will be inserted instead of the original
%   \PS\ code.
% \fi
%
% \ifGERMAN
%   \section{Anwendung}
% \fi
%
% \ifENGLISH
%   \section{Usage}
% \fi
%
% \ifGERMAN
%   \subsection{Paketoptionen}
%
%   \begin{optlist}
%
%     \item[active] Aktiviert den Extraktionsmodus (DVI-Ausgabe).
%     Die explizite Angabe ist normalerweise unn\"otig (Standard im
%     \LaTeX-Modus).
%
%     \item[inactive] Keine besonderen Aktionen; es werden nur die
%     Pakete \pkgname{pstricks} und \pkgname{graphicx} geladen
%     (Standard bei Verwendung von V\TeX). Kann dazu benutzt werden,
%     um das Dokument mit \LaTeX\ in eine DVI-Datei zu wandeln und
%     dabei die automatische Verwendung des Extraktionsmodus' zu vermeiden.
%
%     \item[pstricks] Das Paket \pkgname{pstricks} wird geladen
%     (Standard).
%
%     \item[nopstricks] Das Paket \pkgname{pstricks} wird nicht
%     geladen. Wird sp\"ater festgestellt, dass \pkgname{pstricks} doch
%     noch anderweitig geladen wurde, wird die Umgebung |pspicture|
%     nachtr\"aglich in der Weise behandelt, als w\"are die Option
%     ``pstricks'' doch angegeben worden.
%
%     \item[draft] Im pdf\LaTeX-Modus werden aus der
%     Containerdatei eingef\"ugte Grafiken nur als Rahmen dargestellt.
%
%     \item[final] Im pdf\LaTeX-Modus werden aus der
%     Containerdatei eingef\"ugte Grafiken vollst\"andig
%     dargestellt (Standard).
%
%     \item[tightpage] Die Abmessung Grafiken in der Containerdatei
%     entsprechen denen der zugeh\"origen \TeX-Boxen (Standard).
%
%     \item[notightpage]
%     Die Abmessung der zur Grafik geh\"orenden \TeX-Box ist manchmal
%     nicht korrekt, da \PS-Anweisungen auch au{\ss}erhalb der Box
%     zeichnen k\"onnen. Die Option ``notightpage'' f\"uhrt dazu, dass die
%     Grafiken in der Containerdatei mindestens die Gr\"o{\ss}e des
%     gesamten Blattes einnehmen. Um die Grafiken
%     im sp\"ateren pdf\LaTeX-Lauf verwenden zu k\"onnen, muss die
%     Containerdatei nachbearbeitet werden, so dass die Gr\"o{\ss}e der
%     Grafiken auf die der sichtbaren Bestandteile reduziert ist. Dazu
%     kann z.\,B. das Programm |pdfcrop|\footnote{%
%     CTAN:~\url{support/pdfcrop/}} dienen. Die Anwendung dieses Verfahrens
%     kann die Angabe der Option ``trim'' er\"ubrigen (siehe
%     Abschnitt~\ref{sec:copt}).
%
%     \item[displaymath]
%     Es werden zus\"atzlich die mathematischen Umgebungen
%     \env{displaymath}, \env{eqnarray} und \env{\$\$} extrahiert und im
%     pdf-Modus
%     als Grafik eingef\"ugt. So k\"onnen zus\"atzliche PSTricks-Erg\"anzungen
%     leicht dem Inhalt dieser Umgebungen zugef\"ugt werden. (Frage: Wie
%     verhalten sich die AMS\LaTeX-Umgebungen?)
%
%     \item[\meta{other}] Alle anderen Optionen werden an das Paket
%     \pkgname{pstricks} weitergereicht.
%
%   \end{optlist}
% \fi
% \ifENGLISH
%   \subsection{Package options}
%
%     \begin{optlist}
%
%     \item[active] Activates the extraction mode (DVI output). An explicit
%       declaration usually is not necessary (default in \LaTeX\ mode).
%
%     \item[inactive] No special actions; only the packages
%       \pkgname{pstricks} and \pkgname{graphicx} are loaded (default in
%       V\TeX). Can be used to just convert the document with \LaTeX\ into a
%       DVI file while avoiding the automatic extraction mode.
%
%     \item[pstricks] The package \pkgname{pstricks} is loaded (default).
%
%     \item[nopstricks] The package \pkgname{pstricks} does not get loaded.
%       Once it is detected that \pkgname{pstricks} was loaded however in
%       some other way, the \env{pspicture} environment is treated as if the
%       option ``pstricks'' was given.
%
%     \item[draft] From the \cmd{\PDFcontainer} file included graphics is
%       displayed as frame in pdf\LaTeX\ mode.
%
%     \item[final] From the \cmd{\PDFcontainer} file included graphics is
%       correctly displayed in pdf\LaTeX\ mode (default).
%
%     \item[tightpage] The graphics' dimensions in the \cmd{\PDFcontainer}
%       file match exactly those of the corresponding \TeX\ boxes (default).
%
%     \item[notightpage] The dimensions of the \TeX\ box corresponding to its
%       graphics is not always correct, since a \PS\ statement can draw
%       outside its box. The option ``notightpage'' makes the graphics in the
%       \cmd{\PDFcontainer} file to be at least the size of the whole page.
%       To be able to make use of the graphics' in a later pdf\LaTeX\ run,
%       the \cmd{\PDFcontainer} file needs to be finished in a way that each
%       graphics gets reduced in size to its visible part. For this an
%       external programme like
%       |pdfcrop|\footnote{CTAN:~\url{support/pdfcrop/}} can be useful. Its
%       use can save declaring the option ``trim'' (see also
%       section~\ref{sec:copt}).
%
%     \item[displaymath] In PDF mode the mathematical environments
%       \env{displaymath}, \env{eqnarray}, and \env{\$\$} get also extracted
%       and included as graphics. This way additional PSTricks extensions can
%       easily be added to the contents of these environments. (Question: how
%       do AMS\LaTeX\ environments behave?)
%
%     \item[\meta{other}] All other options are passed to \pkgname{pstricks}
%       package.
%
%     \end{optlist}
% \fi
% \ifGERMAN
%   \subsection{Programmaufrufe}
%
%   Die folgende Tabelle zeigt den Ablauf, der n\"otig ist, um ein
%   PDF-Dokument mit \PS-Grafiken zu erzeugen\footnote{%
%   Die Shell-Scripte |ps4pdf| bzw. |ps4pdf.bat| f\"uhren alle angegebenen
%   Programmaufrufe automatisch aus.}. Im Vergleich dazu ist der
%   analoge Ablauf f\"ur Literaturverzeichnisse angegeben.\bigskip
%
%   \newcolumntype{P}[1]{>{\mbox{}\raggedright}p{#1}}
%   \noindent
%   \begin{tabular}[t]{@{}P{.65\linewidth}@{}P{.35\linewidth}@{}}
%     \textbf{\PS-Grafiken} & \textbf{Literaturverzeichnis} \tabularnewline
%     \toprule
%     |pdflatex document.tex| & |pdflatex document.tex|
%     \tabularnewline\midrule
%     \multicolumn{2}{@{}c@{}}{\emph{Hilfsaufrufe}} \tabularnewline
%     |latex document.tex| \tabularnewline
%     |dvips -o document-pics.ps document.dvi| \tabularnewline
%     |ps2pdf document-pics.ps|
%     &
%     |bibtex document.aux|
%     \tabularnewline\midrule
%     |pdflatex document.tex| & |pdflatex document.tex|
%   \end{tabular}\bigskip
%
%   Bei der Erzeugung wird nur
%   Code ber\"ucksichtigt, der sich innerhalb der Umgebungen |pspicture|
%   oder |postscript| befindet. Ebenfalls werden \PS-Grafiken, die
%   als Parameter von \cmd{\includegraphics} angegeben wurden, der
%   Containerdatei hinzugef\"ugt.
%   Der Name dieser Datei ist standardm\"a{\ss}ig
%   \meta{\cmd{\jobname}}|-pics.pdf|.
%   Er kann durch Umdefinieren des Makros
%   \cmd{\PDFcontainer} ge\"andert werden. \medskip
% \fi
% \ifENGLISH
%   \subsection{Program calls}
%
%   The following table shows the course necessary to create a PDF document
%   containing \PS\ graphics\footnote{The \TeX\ distribution ``te\TeX''
%     contains a UNIX shell script |ps4pdf| which executes all the necessary
%     steps. See: CTAN:~\url{macros/latex/contrib/ps4pdf/}}. As comparison
%   the analogous course for a bibliography is shown.\bigskip
%
%   \newcolumntype{P}[1]{>{\mbox{}\raggedright}p{#1}}
%   \noindent
%   \begin{tabular}[t]{@{}P{.65\linewidth}@{}P{.35\linewidth}@{}}
%     \textbf{\PS\ graphics} & \textbf{bibliography} \tabularnewline
%     \toprule
%     |pdflatex document.tex| & |pdflatex document.tex|
%     \tabularnewline\midrule
%     \multicolumn{2}{@{}c@{}}{\emph{auxiliary calls}} \tabularnewline
%     |latex document.tex| \tabularnewline
%     |dvips -o document-pics.ps document.dvi| \tabularnewline
%     |ps2pdf document-pics.ps|
%     &
%     |bibtex document.aux|
%     \tabularnewline\midrule
%     |pdflatex document.tex| & |pdflatex document.tex|
%   \end{tabular}\bigskip
%
%   While creating the output only code from inside a \env{pspicture} or
%   \env{postscript} environment is considered. \PS\ graphics files, which
%   are passed as parameter of an \cmd{\includegraphics} statement, too are
%   included into the \cmd{\PDFcontainer} file. This file's name is by
%   default \meta{\cmd{\jobname}}|-pics.pdf|. It can be changed by
%   re-defining the macro \cmd{\PDFcontainer}. \medskip
% \fi
%
% \ifGERMAN
%   \subsection{Nutzeranweisungen}
%
%   \DescribeEnv{pspicture}
%   \indent\cmd{\begin}|{pspicture}|\oarg{keys}%
%     \parg{x0,x1}\parg{y0,y1} \dots\cmd{\end}|{pspicture}|
%   \par\noindent
%   Die |pspicture|-Umgebung steht zur Verf\"ugung, wenn nicht die Option
%   ``|nopstricks|'' angegeben wurde. Sie wird so wie in PSTricks \"ublich
%   verwendet. Im pdf\LaTeX-Modus wird ihr Inhalt nur dann dargestellt,
%   wenn vorher die Containerdatei erzeugt wurde.
%   \medskip
%
%   \DescribeEnv{postscript}
%   \cmd{\begin}|{postscript}|\oarg{keys} \dots\cmd{\end}|{postscript}|
%   \par\noindent
%   Die |postscript|-Umgebung kann beliebigen Code mit Ausnahme von
%   Gleitumgebungen aufnehmen. Im pdf\LaTeX-Modus wird ihr Inhalt
%   ebenfalls der Containerdatei entnommen. Ist diese Datei nicht
%   vorhanden, wird -- anders als bei der |pspicture|-Umgebung -- der
%   sp\"ater ben\"otigte Platz m\"oglicherweise nicht korrekt frei gehalten.
%   \medskip
%
%   \DescribeMacro{\includegraphics}
%   \cmd{\includegraphics}\oarg{keys}\marg{filename}
%   \par\noindent
%   Wie in \pkgname{graphics}/\pkgname{graphicx} definiert zu verwenden.
%   Zus\"atzlich ist es nun m\"oglich, auch im pdf\LaTeX-Modus
%   EPS-Dateien als Argument anzugeben und ihren Inhalt darzustellen. Er
%   wird dazu ebenfalls der Containerdatei entnommen.
%   \medskip
%
%   \newcommand*\ooarg[1]{{\ttfamily<}\meta{#1}{\ttfamily>}}
%
%   \DescribeMacro{\includegraphicx}
%   \cmd{\includegraphicx}\oarg{keys}\parg{pfxadd}\ooarg{ovpfgd}\oarg{ovpbgd}%
%     \marg{filename}
%   \par\noindent
%   Wie im Paket \pkgname{psfragx} definiert zu verwenden.
%   \medskip
%
%   \DescribeMacro{\savepicture}
%   \cmd{\savepicture}\marg{name}
%   \par\noindent
%   Die zuletzt ausgegebene Grafik (Ergebnisse der Umgebungen |pspicture|,
%   |postscript| und der \cmd{\includegraphics}-Anweisungen mit
%   \PS-Dateien) wird unter dem als Parameter \"ubergebenen
%   Namen gespeichert.
%   \medskip
%
%   \DescribeMacro{\usepicture}
%   \cmd{\usepicture}\oarg{keys}\marg{name}
%   \par\noindent
%   Die zuvor mit \cmd{\savepicture} gespeicherte Grafik wird
%   ausgegeben. Der optionale Parameter entpricht dem bei der Anweisung
%   \cmd{\includegraphics} m\"oglichen.
%   \medskip
%
%   \DescribeEnv{pst-pdf-defs}
%   \cmd{\begin}\texttt{\{pst-pdf-defs\}} \dots
%   \cmd{\end}\texttt{\{pst-pdf-defs\}}
%   \par\noindent
%   Sollen eigene Makros oder Umgebungen definiert werden, die das Zeichen
%   \texttt{\&} (andere?) im Ersetzungstext enthalten, so m\"ussen diese
%   Definitionen von der Umgebung |pst-pdf-defs| umschlossen werden.
%   \medskip
% \fi
%
% \ifENGLISH
%   \subsection{User commands}
%
%   \DescribeEnv{pspicture}
%   \indent\cmd{\begin}|{pspicture}|\oarg{keys}%
%     \parg{x0,x1}\parg{y0,y1} \dots\cmd{\end}|{pspicture}|
%   \par\noindent
%   The \env{pspicture} environment is not available when the option
%   ``|nopstricks|'' was given. It is to be used the same way as if in
%   PSTricks. In pdf\LaTeX\ mode this environment's contents is only
%   displayed when the \cmd{\PDFcontainer} file was created before.
%   \medskip
%
%   \DescribeEnv{postscript}
%   \cmd{\begin}|{postscript}|\oarg{keys} \dots\cmd{\end}|{postscript}|
%   \par\noindent
%   The \env{postscript} environment can contain any code except floats. In
%   pdf\LaTeX\ mode its contents is take too off the \cmd{\PDFcontainer}
%   file. Other as in the \env{pspicture} environment the necessary space is
%   not always preserved when the \cmd{\PDFcontainer} file does not exist yet.
%   \medskip
%
%   \DescribeMacro{\includegraphics}
%   \cmd{\includegraphics}\oarg{keys}\marg{filename}
%   \par\noindent
%   To be used as in \pkgname{graphics}/\pkgname{graphicx} defined. In
%   pdf\LaTeX\ mode it is now additionally feasable to pass the name of an
%   EPS file. Its visible contents too is taken from the \cmd{\PDFcontainer}
%   file.
%   \medskip
%
%   \newcommand*\ooarg[1]{{\ttfamily<}\meta{#1}{\ttfamily>}}
%
%   \DescribeMacro{\includegraphicx}
%   \cmd{\includegraphicx}\oarg{keys}\parg{pfxadd}\ooarg{ovpfgd}\oarg{ovpbgd}%
%     \marg{filename}
%   \par\noindent
%   To be used like defined in package\pkgname{psfragx}.
%   \medskip
%
%   \DescribeMacro{\savepicture}
%   \cmd{\savepicture}\marg{name}
%   \par\noindent
%   The last output graphics (result of the \env{pspicture} or \env{postscript}
%   environments or the \cmd{\includegraphics} statement with an \PS\ file as
%   argument) is being saved in a file under the name as given by the parameter.
%   \medskip
%
%   \DescribeMacro{\usepicture}
%   \cmd{\usepicture}\oarg{keys}\marg{name}
%   \par\noindent
%   The graphic previously stored with \cmd{\savepicture} is outputted. The 
%   optional parameter corresponds to \cmd{\includegraphics}.
%   \medskip
%
%   \DescribeEnv{pst-pdf-defs}
%   \cmd{\begin}\texttt{\{pst-pdf-defs\}} \dots
%   \cmd{\end}\texttt{\{pst-pdf-defs\}}
%   \par\noindent
%   For defining macros or environments, which contain character \texttt{\&}
%   (others?) in the output, these defintions have to be wrapped with
%   environment |pst-pdf-defs|.
%   \medskip
% \fi
%
% \ifGERMAN
% \subsection{Command options} \label{sec:copt}
% Das Verhalten der Anweisungen \cmd{\includegraphics}, \cmd{\usepicture}
% und der  Umgebung |postscript| kann mit den folgenden optionalen
% Parametern beeinflusst werden (key-value-Syntax):
%   \begin{optlist}
%
%     \item[frame=\TorF] Es wird -- \"ahnlich wie bei der
%     Anweisung \cmd{\fbox}~-- ein Rahmen um die Grafik gezeichnet. Die
%     durch Rotation ge\"anderte Gesamtgr\"o{\ss}e wird dabei
%     ber\"ucksichtigt. Das Zeichnen geschieht im
%     pdf\LaTeX-Modus; vorher beim Erzeugen der Containerdatei wird dieser
%     Parmeter ignoriert. Standard: false.
%
%     \item[innerframe=\TorF] Wie ``|frame|'' jedoch
%     wird der Rahmen nur um die Grafik selbst, nicht aber um die
%     resultierende Box gezeichnet.
%
%     \item[ignore=\TorF] Bei ``|true|'' wird die Grafik
%     nicht ausgegeben. Bei Angabe von \cmd{\savepicture}\marg{name}
%     kann sie sp\"ater jedoch  an anderer Stelle mit
%     \cmd{\usepicture} verwendet werden. Standard: false.
%
%     \item[showname=\TorF] Gibt in kleiner
%     Schrift den tats\"achlich verwendeten Dateinamen unter der Grafik
%     aus. Standard: false.
%
%     \item[namefont=\META{font commands}] Beinflusst die Schriftart,
%     die bei ``|showname=true|'' benuzt wird. Standard:
%     \cmd{\ttfamily}\cmd{\tiny}
%
%   \end{optlist}
%
%   Alle Parameter k\"onnen auch global per
%   \cmd{\setkeys}|{Gin}|\marg{key=value} gesetzt werden.
% \fi
%
% \ifENGLISH
% \subsection{Command options} \label{sec:copt}
% The behaviour of the \cmd{\includegraphics} and \cmd{\usepicture}
% statements and the \env{postscript} environment can be modified with any
% of the following parameters (key value syntax):
%   \begin{optlist}
%
%   \item[frame=\TorF] As with the \cmd{\fbox} statement a frame is drawn
%     around the graphics. Any change of size due to rotation is taken into
%     account. Drawing happens in pdf\LaTeX\ mode; before, in creating the
%     \cmd{\PDFcontainer} file, it is ignored. Default: false.
%
%   \item[innerframe=\TorF] As in ``|frame|'', but the frame is drawn
%     around the gra\-phics, not its box.
%
%   \item[ignore=\TorF] If set to ``|true|'' no graphics are outputted. With 
%     macro \cmd{\savepicture}\marg{name} the graphics can be used later in a
%     different place via \cmd{\usepicture}. Default: false.
%
%   \item[showname=\TorF] A caption of minimal font size records the used
%     file's name. Default: false.
%
%   \item[namefont=\META{font commands}] Controls the font used when
%     ``|showname=true|'' is set. Default: \cmd{\ttfamily}\cmd{\tiny}
%
%   \end{optlist}
%
%   All parameters can be set globally as in
%   \cmd{\setkeys}|{Gin}|\marg{key=value}.
% \fi
%
%   \bigskip \pagebreak[2]
%
% \StopEventually{}
%
% \section{Implementation}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
% \subsection{Package options}
% \changes{v1.0c}{2005/01/29}{New options ``pstricks'', ``nopstricks'',
% ``draft'' and ``\mbox{final}''. (RN)}
% \changes{v1.1e}{2005/04/30}{New option ``displaymath'' (see preview
%   package). (HjG/RN)}
% \changes{v1.1f}{2005/04/30}{Package option ``ignore'' reimplemented.
%   Now the compilation of the dtx file in \LaTeX\ mode is possible. (RN)}
%    \begin{macrocode}
\newcommand*\ppf@TeX@mode{-1}
\newcommand*\ppf@draft{false}
\newif\if@ppf@PST@used\@ppf@PST@usedtrue
\newif\if@ppf@tightpage \@ppf@tightpagetrue
\DeclareOption{active}{\OptionNotUsed}
\DeclareOption{inactive}{\def\ppf@TeX@mode{9}}
\DeclareOption{ignore}{\def\ppf@TeX@mode{999}}
\DeclareOption{pstricks}{\@ppf@PST@usedtrue}
\DeclareOption{nopstricks}{\@ppf@PST@usedfalse}
\DeclareOption{displaymath}{%
  \PassOptionsToPackage\CurrentOption{preview}}
\DeclareOption{draft}{\def\ppf@draft{true}}
\DeclareOption{final}{\def\ppf@draft{false}%
  \PassOptionsToPackage\CurrentOption{graphicx}}
%    \end{macrocode}
% \changes{v1.1i}{2005/06/29}{Package option ``final'' also
%   for ``graphicx''. (RN)}
%    \begin{macrocode}
\DeclareOption{notightpage}{\@ppf@tightpagefalse}%
\DeclareOption{tightpage}{\@ppf@tightpagetrue}%
\DeclareOption*{%
  \PassOptionsToPackage\CurrentOption{pstricks}}
\ProcessOptions\relax
\ifnum\ppf@TeX@mode=999\relax\expandafter\endinput\fi
%    \end{macrocode}
% \ifGERMAN
% \subsection{Compilertests}
% Es wird getestet, welcher \TeX\ compiler in welchem Modus
% l\"auft (siehe `|graphics.cfg|' von te\TeX/\TeX Live). Entsprechend
% dem Ergebnis bekommen die Umgebungen |pspicture| und |postscript|
% unterschiedliche Funktionalit\"at. Der Test wird nur ausgef\"uhrt,
% wenn nicht die Paketoptionen |active| oder |inactive| angegeben wurden.
% \fi
% \ifENGLISH
% \subsection{Compiler tests}
% It is tested which \TeX\ compiler in which mode of operation is actually
% used (see `|graphics.cfg|' in te\TeX/\TeX\ Live). Accordingly the
% environments \env{pspicture} and \env{postscript} gain each a different
% range of functions. This test is only executed when the options |active|
% or |inactive| were not given.
% \fi
% \changes{v1.2a}{2016/07/11}{Engine tests changed (RN)}
% \changes{v1.2b}{2017/02/25}{Loading packages `if*' at wrong place (RN)} 
%    \begin{macrocode}
\RequirePackage{ifpdf,ifxetex,ifvtex}
\ifnum\ppf@TeX@mode=-1\relax
  \ifpdf
%    \end{macrocode}
% \quad$\Rightarrow$\,pdf\TeX{} or Lua\TeX{} are running in PDF mode
%    \begin{macrocode}
    \def\ppf@TeX@mode{1}%
    \RequirePackage{luatex85}%
  \else
    \ifvtex
%    \end{macrocode}
% \quad$\Rightarrow$\,V\TeX{} 
%    \begin{macrocode}
      \def\ppf@TeX@mode{9}%
    \else
      \ifxetex
%    \end{macrocode}
% \quad$\Rightarrow$\,Xe\TeX{} 
%    \begin{macrocode}
        \def\ppf@TeX@mode{9}%
      \else
%    \end{macrocode}
% \quad$\Rightarrow$\,DVI mode
%    \begin{macrocode}
        \def\ppf@TeX@mode{0}%
      \fi
    \fi
  \fi
\fi
%    \end{macrocode}
% \changes{v1.0g}{2005/02/12}{Definition of \cmd{\PDFcontainer}
%   now with \cmd{\edef}. (RN)}
%    \begin{macrocode}
\newcommand*\PDFcontainer{}
\edef\PDFcontainer{\jobname-pics.pdf}
\newcounter{pspicture}
\newcommand*\ppf@other@extensions[1]{}
\newcommand*\usepicture[2][]{}
\newcommand*\savepicture[1]{}
%    \end{macrocode}
%
% \begin{environment}{pst-pdf-defs}
%    \begin{macrocode}
\newenvironment*{pst-pdf-defs}{%
  \endgroup
%    ??? \@currenvline
}{%
  \begingroup
  \def\@currenvir{pst-pdf-defs}%
}
%    \end{macrocode}
% \end{environment}
%
% \changes{v1.2d}{2017/06/22}{Version parameter for `graphicx' and rename 
%   \cmd{\GPT@page} to \cmd{\Gin@page} at several places}
%    \begin{macrocode}
\RequirePackage{graphicx}[2017/06/01]%
\let\ppf@Ginclude@graphics\Ginclude@graphics
\let\ppf@Gin@extensions\Gin@extensions
\let\ppf@Gin@ii\Gin@ii
%    \end{macrocode}
%    \begin{macrocode}
\newif\if@ppf@pdftex@graphic
\newif\ifGin@frame\Gin@framefalse
\newif\ifGin@innerframe\Gin@innerframefalse
\newif\ifGin@showname\Gin@shownamefalse
\newif\ifGin@ignore\Gin@ignorefalse
%    \end{macrocode}
% \ifGERMAN
% \cmd{\ifpr@outer} wird eigentlich im Paket \pkgname{preview} definiert.
% Wir m\"ussen es aber be\-reits hier zus\"atzlich tun, da sonst \TeX\ u.\,U.
% beim Parsen der \cs\texttt{ifcase}-Struktur ``au{\ss}er Tritt'' kommt.
% \fi
% \ifENGLISH
% \cmd{\ifpr@outer} in fact is defined in package \pkgname{preview}. We
% have to do it here too since otherwise \TeX\ could ``stumble and fall''
% while parsing the \cs\texttt{ifcase} structure.
% \fi
% \changes{v1.1i}{2005/06/29}{\cmd{\ifpr@outer} must be predefined. (HjG/RN)}
%    \begin{macrocode}
\newif\ifpr@outer
%    \end{macrocode}
% \begin{macro}{\ppf@is@pdfTeX@graphic}
% \changes{v1.0i}{2005/02/18}{No more errors for given files without
%   extensions. (RN)}
% \changes{v1.0r}{2005/03/25}{Changed \cmd{\ppf@is@known@graphic} to
%   \cmd{\ppf@is@pdfTeX@graphic}. Now pdf\TeX\ graphics are prefered. (RN)}
% \changes{v1.2e}{2019/11/15}{Parameter \string\verb+#2+ is detokenized when 
%   expanded to \cmd{\pdfTeXext}}
% \ifGERMAN
% Parameter |#1| ist der Name einer Grafikdatei mit oder ohne Endung,
% Parameter |#2| enth\"alt die g\"ultigen Dateiendungen im pdf-Modus,
% Parameter |#3| enth\"alt die g\"ultigen Dateiendungen im dvi-Modus.
% Ist es m\"oglich, die Grafik im pdf-Modus zu verarbeiten, werden die
% Anweisungen in |#4| ausgef\"uhrt, sonst die in |#5|.
% \fi
% \ifENGLISH
% Parameter |#1| is the name of a graphics file with or without extension,
% parameter |#2| contains the valid extensions in PDF mode,
% parameter |#3| contains the valid extensions in DVI mode.
% If it works to process the graphics in PDF mode, then the statements
% in |#4| are executed, otherwise those in |#5|.
% \fi
%    \begin{macrocode}
\newcommand*\ppf@is@pdfTeX@graphic[5]{%
  \@ppf@pdftex@graphicfalse%
  \begingroup
    \edef\pdfTeXext{\detokenize\expandafter{#2}}%
%    \end{macrocode}
% \ifGERMAN
% Statt Einladen einer identifizierten Grafik nur Test der Grafikendung.
% \fi
% \ifENGLISH
% Instead of loading the found graphics, only a test on file name extension.
% \fi
%    \begin{macrocode}
    \def\Gin@setfile##1##2##3{%
      \@expandtwoargs\in@{,\detokenize\expandafter{##2},}{,\pdfTeXext,}%
      \ifin@\global\@ppf@pdftex@graphictrue\fi}%
%    \end{macrocode}
% \ifGERMAN
% Es m\"ussen Dateitypen beider Moden gefunden werden, um
% die Fehlermeldung ``File `|#1|' not found'' zu vermeiden.
% \fi
% \ifENGLISH
% File types for both modes need to be determined to prevent a wrong
% error message ``File `|#1|' not found''.
% \fi
%    \begin{macrocode}
    \edef\Gin@extensions{#2,#3}%
%    \end{macrocode}
% \ifGERMAN
% Testaufruf. Dabei Ausgabe vollst\"andig verhindern.
% \fi
% \ifENGLISH
% Trial invocation. Output is completely inhibited.
% \fi
%    \begin{macrocode}
    \pr@outerfalse\ppf@Ginclude@graphics{#1}%
  \endgroup
  \if@ppf@pdftex@graphic#4\else#5\fi
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\ifcase\ppf@TeX@mode\relax
%    \end{macrocode}
% \ifGERMAN
% \subsection{Extraction mode (dvi output)}
% Die Umgebung |pspicture| beh\"alt die Definition aus |pstricks.tex|.
% Aus\-schlie{\ss}\-lich der Code der Umgebungen |pspicture| und
% |postscript| sowie \cmd{\includegraphics} mit PS-Dateien bewirken
% Eintr\"age in die DVI-Datei. Der
% restliche Code des Dokuments wird bei der Ausgabe der DVI-Datei
% ignoriert. Nach Wandlung der DVI-Datei \"uber \PS\ (``|dvips|'')
% nach PDF (Datei \cmd{\PDFcontainer}) nimmt jede Grafik
% genau eine Seite der pdf-Datei ein.
% Der \TeX-Compiler mit DVI-Ausgabe sowie die Paketoption ``|active|''
% erzwingen diesen Modus.
% \fi
% \ifENGLISH
% \subsection{Extraction mode (DVI output)}
% The \env{pspicture} environment retains any definition from
% |pstricks.tex|. Only the code from the environments \env{pspicture} and
% \env{postscript} as well as \cmd{\includegraphics} with \PS\ files leads
% to records into the DVI file. The remainder of the document's code is
% ignored for output. After conversion of the DVI file via \PS\
% (``|dvips|'') into PDF (\cmd{\PDFcontainer} file) each graphics takes
% exactly one page in the \cmd{\PDFcontainer} file. The \TeX\ compiler with
% DVI output and the package option ``|active|'' both force this mode.
% \fi
% \changes{v1.1n}{2006/07/14}{\cmd{\nofiles} added (suggestion of Torsten
%   Bronger).}
% \changes{v1.1p}{2007/06/04}{\cmd{\nofiles} makes \cmd{\makeindex} and
%   \cmd{\makeglossary} to \cmd{\relax}. \cmd{\@empty} is better
%   because of later \cmd{\renewcommand}'s.}
% \changes{v1.2e}{2019/11/15}{gobble optional argument for \cmd{\makeindex}, 
%   \cmd{\makeglossary} and \cmd{\printindex}}
% \changes{v1.1q}{2008/02/17}{\cmd{\overfullrule} must not be > 0.}
%    \begin{macrocode}
  \PackageInfo{pst-pdf}{%
    MODE: \ppf@TeX@mode\space (dvi -- extraction mode)}
  \nofiles
  \let\makeindex\@empty \let\makeglossary\@empty \let\printindex\@empty
  \renewcommand*\makeindex[1][]{}%
  \renewcommand*\makeglossary[1][]{}%
  \renewcommand*\printindex[1][]{}%
  \AtBeginDocument{\overfullrule=\z@}%
  \if@ppf@PST@used\RequirePackage{pstricks}\fi
  \RequirePackage[active,dvips,tightpage]{preview}[2005/01/29]%
  \newcommand*\ppf@PreviewBbAdjust{}
  \newcommand*\ppf@RestoreBbAdjust{%
    \let\PreviewBbAdjust\ppf@PreviewBbAdjust}%
%    \end{macrocode}
% \ifGERMAN
% Es werden auch die im pdf\LaTeX-Modus erlaubten Endungen von Grafikdateien
% ben\"otigt.
% \fi
% \ifENGLISH
% The pdf\LaTeX\ mode compliant graphics file formats are needed too.
% \fi
% \changes{v1.1u}{2008/09/16}{\cmd{\pdfoutput} must be set when
%   loading ``pdftex.def'' in DVI mode. (RN)}
% \changes{v1.1v}{2008/10/09}{Local redefinition of \cmd{\pdfoutput} to be a 
%   counter. (RN)}
%    \begin{macrocode}
  \begingroup
    \let\AtBeginDocument\@gobble \let\PackageWarningNoLine\@gobbletwo
    \chardef\pdftexversion=121 %
    \newcount\pdfoutput
    \pdfoutput=1 %
    \input{pdftex.def}%
    \edef\x{\endgroup\def\noexpand\ppf@other@extensions{\Gin@extensions}
    }%
  \x
%    \end{macrocode}
% \changes{v1.1c}{2005/04/17}{Supress handling of pdf\LaTeX\ graphic
%   formats in DVI mode. (RN)}
% \ifGERMAN
% F\"ur die im PDF-Modus m\"oglichen Grafikformate d\"urfen keine
% speziellen Regeln definiert sein (z.\,B. wegen
% \progname{dvips}-Erweiterungen). F\"ur sie wird die universelle
% EPS-Regel verwendet, damit sie zumindest gefunden werden.
% \fi
% \ifENGLISH
% In PDF mode no rules must be defined for its compliant (PNG, JPEG, PDF)
% graphics file formats (because of for example \progname{dvips} extensions).
% The universal EPS rule is used to at least find these files.
% \fi
%    \begin{macrocode}
  \AtBeginDocument{%
    \@ifpackageloaded{keyval}{%
      \def\KV@errx#1{\PackageInfo{keyval}{#1}}%
      }{}%
    \@ifpackageloaded{xkeyval}{%
      \def\XKV@err#1{\PackageInfo{xkeyval}{#1}}%
    }{}%
%    \end{macrocode}
% \ifGERMAN
% In diesem Modus sollten undefinierte keys keinen Fehler bewirken.
% \fi
% \ifENGLISH
% In this mode undefined keys should not be an error.
% \fi
%    \begin{macrocode}
    \@for\@tempa:=\ppf@other@extensions\do{%
      \expandafter\let\csname Gin@rule@\@tempa\endcsname\relax}%
    \DeclareGraphicsRule{*}{eps}{*}{}}%
%    \end{macrocode}
% \ifGERMAN
% In diesem Modus keine Funktion.
% \fi
% \ifENGLISH
% No function in this mode.
% \fi
% \changes{v1.1s}{2008/05/25}{Dummy definition of the page key in DVI mode.}
%    \begin{macrocode}
  \define@key{Gin}{innerframe}[true]{}%
  \define@key{Gin}{frame}[true]{}%
  \define@key{Gin}{ignore}[true]{}%
  \define@key{Gin}{showname}[true]{}%
  \define@key{Gin}{namefont}{}%
  \@ifundefined{Gin@page}{\define@key{Gin}{page}{}}{}
%    \end{macrocode}
% \changes{v1.0o}{2005/03/12}{New code for ``notightpage''. (RN)}
% \changes{v1.1r}{2008/05/02}{Fixed values for \cmd{\PreviewBbAdjust} 
%   because \cmd{\paperwidth} is not allways defined (suggested by Will 
%   Robertson).}
%    \begin{macrocode}
  \if@ppf@tightpage\else
    \def\PreviewBbAdjust{%
      -600pt -600pt 600pt 600pt}%
    \AtEndDocument{%
      \PackageWarningNoLine{pst-pdf}{Picture container needs cropping.}}%
  \fi
%    \end{macrocode}
% \begin{environment}{postscript}
% \changes{v1.0e}{2005/02/03}{``trim'' option added. (RN)}
% \ifGERMAN
% Die Umgebung \env{postscript} wertet die trim-Option in derselben
% Weise wie \cmd{\includegraphics} aus (Angaben ohne Ma{\ss}einheit
% werden als bp interpretiert).
% \fi
% \ifENGLISH
% The \env{postscript} environment utilises the trim option in the same
% manner as does \cmd{\includegraphics} (any specification without dimension
% is interpreted as if given in bp).
% \fi
%    \begin{macrocode}
  \newenvironment{postscript}[1][]%
  {%
    \global\let\ppf@PreviewBbAdjust\PreviewBbAdjust
    \if@ppf@tightpage
      \begingroup
        \setkeys{Gin}{#1}%
        \xdef\PreviewBbAdjust{%
          -\Gin@vllx bp -\Gin@vlly bp \Gin@vurx bp \Gin@vury bp}%
      \endgroup
    \fi
    \ignorespaces
  }%
  {\aftergroup\ppf@RestoreBbAdjust}%
%    \end{macrocode}
% \end{environment}
%    \begin{macrocode}
  \PreviewEnvironment{postscript}%
  \AtBeginDocument{%
    \@ifundefined{PSTricksLoaded}{}%
    {%
%    \end{macrocode}
% \begin{environment}{pspicture}
% \ifGERMAN
% Originaldefinition \pkgname{preview} bekannt machen.
% \fi
% \ifENGLISH
% Announce \pkgname{preview} original definition.
% \fi
%    \begin{macrocode}
      \PreviewEnvironment{pspicture}%
%    \end{macrocode}
% \end{environment}
% \begin{environment}{psmatrix}
% \ifGERMAN
% Originaldefinition \pkgname{preview} bekannt machen.
% \fi
% \ifENGLISH
% Announce \pkgname{preview} original definition.
% \fi
%    \begin{macrocode}
      \@ifundefined{psmatrix}{}%
      {%
        \PreviewEnvironment{psmatrix}%
        \newcommand*\ppf@set@mode{}%
        \newcommand*\ppf@test@mmode{%
        \ifmmode
          \ifinner
            \let\ppf@set@mode=$%
          \else
            \def\ppf@set@mode{$$}%
          \fi
        \else
          \let\ppf@set@mode=\@empty
        \fi
        }%
        \let\ppf@psmatrix=\psmatrix
        \expandafter\let\expandafter\ppf@pr@psmatrix%
          \expandafter=\csname pr@\string\psmatrix\endcsname
        \let\ppf@endpsmatrix=\endpsmatrix
        \def\psmatrix{\ppf@test@mmode\ppf@psmatrix}
        \expandafter\def\csname pr@\string\psmatrix\endcsname{%
          \ppf@set@mode\ppf@pr@psmatrix}%
        \def\endpsmatrix{\ppf@endpsmatrix\ppf@set@mode}%
      }%
%    \end{macrocode}
% \end{environment}
% \ifGERMAN
% Internes Makro \cmd{\pst@object} bekanntmachen, um manchen
% PSTricks-Code au{\ss}erhalb von pspicture-Umgebungen ebenfalls
% verwenden zu k\"onnen. Derzeit sind Aufrufe der folgenden Art
% m\"oglich:
% \begin{flushleft}
%   \cmd{\pst@object}%
%   \marg{m}\meta{\texttt{*}}\oarg{o}\marg{o}\marg{o}\parg{o}\parg{o}\parg{o} \\
%   \qquad (|m|\,$=$\,notwendig, |*|\,$=$\,optional, |o|\,$=$\,optional)
% \end{flushleft}
% Mehr als drei optionale Argumente am Ende des Aufrufs, wie
% bei\-spiels\-wei\-se bei \cmd{\psline} denkbar, sind noch nicht m\"oglich.
% \fi
% \ifENGLISH
% Announce internal macro \cmd{\pst@object} to enable the use of some
% PSTricks code outside of \env{pspicture} environments. At the moment
% invocations of the following kind are feasible:
% \begin{flushleft}
%   \cmd{\pst@object}%
%   \marg{m}\meta{\texttt{*}}\oarg{o}\marg{o}\marg{o}\parg{o}\parg{o}\parg{o} \\
%   \qquad (|m|\,$=$\,necessary, |*|\,$=$\,optional, |o|\,$=$\,optional)
% \end{flushleft}
% More than three optional arguments at the call's end, as in
% \cmd{\psline} possible, do not work yet.
% \fi
% \changes{v1.1a}{2005/04/07}{Support for the internal PSTricks macro
%   \cmd{\pst@object}. (HjG/RN)}
%    \begin{macrocode}
      \PreviewMacro[{{}*[]%
        ?\bgroup{#{#1}{{#1}}}{}%
        ?\bgroup{#{#1}{{#1}}}{}%
        ?({#{(#1)}{({#1})}}{}%
        ?({#{(#1)}{({#1})}}{}%
        ?({#{(#1)}{({#1})}}{}%
        }]{\pst@object}}
%    \end{macrocode}
% \ifGERMAN
% Mehrfaches testweises Setzen von Tabelleninhalten durch ``tabularx''
% verhindern.
% \fi
% \ifENGLISH
% Prevent multiple test-wise setting of table contents by ``tabularx''.
% \fi
% \changes{v1.1c}{2005/04/17}{Special support for ``tabularx''. (RN)}
% \changes{v1.1q}{2008/02/17}{Problem with ``tabularx'' and
%   ``threeparttabel'' solved. (RN)}
%    \begin{macrocode}
    \@ifundefined{tabularx}{}{%
      \newcolumntype{X}{c}%
      \expandafter\let\expandafter\tabularx\csname tabular*\endcsname
      \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname
    }%
%    \end{macrocode}
% \changes{v1.1l}{2006/02/18}{Support for the package ``psfragx''. (RN)}
% \ifGERMAN
% Unterst\"utzung von \cmd{\includegraphicx} aus dem Paket \pkgname{psfragx}.
% \fi
% \ifENGLISH
% Support of \cmd{\includegraphicx} from the package \pkgname{psfragx}.
% \fi
%    \begin{macrocode}
    \@ifundefined{pfx@includegraphicx}{}{%
      \PreviewMacro[{{}{}}]{\pfx@includegraphicx}}%
  }%
%    \end{macrocode}
% \begin{macro}{\Gscale@@box}
% \ifGERMAN
% Skalieren verhindern.
% \fi
% \ifENGLISH
% Disable scaling.
% \fi
% \changes{v1.1o}{2006/08/31}{Disable scaling. (RN)}
%    \begin{macrocode}
  \def\Gscale@@box#1#2#3{%
    \toks@{\mbox}%
  }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Ginclude@graphics}
% \ifGERMAN
% Alle Grafiken mit bekanntem Format (z.\,B. EPS-Dateien) werden normal
% verarbeitet, was in diesem Modus bedeutet, dass sie der
% Preview-Funktionalit\"at unterliegen. Andere Grafiken (z.\,B. PDF-Dateien)
% werden ignoriert.
% \fi
% \ifENGLISH
% All graphics content of well known format (for instance EPS files) is
% treated in a regular way, which in this mode denotes that it is subject
% to \pkgname{preview} functions. Other graphics content (for instance PDF
% files) is ignored.
% \fi
% \changes{v1.0k}{2005/02/23}{Prevent division by zero. (RN)}
% \changes{v1.1h}{2005/06/26}{Check if inside of a PS-related
%   environment (correct graphic inclusion). (RN)}
% \changes{v1.1i}{2005/06/29}{Correction of the inside check. (RN/HjG)}
%    \begin{macrocode}
  \def\Ginclude@graphics#1{%
    \ifpr@outer
%    \end{macrocode}
% \ifGERMAN
% Im allgemeinen Fall sollen pdf\TeX-Grafiken bevorzugt werden (Einf\"ugen
% erst im pdf\TeX-Modus). Ist nur eine DVIPS-Graphik vorhanden, dann
% wirkt wieder die Originaldefintion und Registrierung beim
% preview-Paket muss erfolgen.
% \fi
% \ifENGLISH
% Generally pdf\TeX\ supported graphics formats are intended to be preferred
% (inclusion in final pdf\TeX\ run). If it's a \PS\ type graphics, then the
% original definition is in function again and registration for the
% \pkgname{preview} package is necessary in order to convert this \PS\ type
% graphics into PDF.
% \fi
%    \begin{macrocode}
      \ppf@is@pdfTeX@graphic{#1}{\ppf@other@extensions}{\Gin@extensions}%
%    \end{macrocode}
% \ifGERMAN
% Dummy-Box, um Division durch Null bei Skalierung/Rotation zu
% vermeiden. Wird ansonsten ignoriert.
% \fi
% \ifENGLISH
% Dummy box to prevent a division by zero while scaling or rotating.
% Otherwise ignored.
% \fi
%    \begin{macrocode}
      {\rule{10pt}{10pt}}%
      {\ppf@Ginclude@graphics{#1}}%
    \else
%    \end{macrocode}
% \ifGERMAN
% Innerhalb von PS-Umgebungen (\texttt{pspicture} usw.) muss sich
% \cmd{\includegraphics} wie die Originaldefinition verhalten (nur die
% DVIPS-Graphik-Typen sind g\"ultig).
% \fi
% \ifENGLISH
% Inside a \PS\ environment (\env{pspicture} etc.) \cmd{\includegraphics} has
% to behave as in its original definition (only DVIPS supported graphics
% formats are allowed).
% \fi
%    \begin{macrocode}
      \ppf@Ginclude@graphics{#1}%
    \fi
  }%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
  \PreviewMacro[{{}}]{\ppf@Ginclude@graphics}%
  \let\pdfliteral\@gobble%
\or
%    \end{macrocode}
% \ifGERMAN
% \subsection{pdf\LaTeX\ mode (pdf output)}
% Ist die Datei \cmd{\PDFcontainer} (default: \meta{\cmd{\jobname}}|-pics.pdf|)
% vorhanden, so wird der Inhalt der Umgebungen |pspicture| und
% |postscript| ignoriert.
% Stattdessen wird die zugeh\"orige Grafik aus der Datei \cmd{\PDFcontainer}
% eingebunden.
% \fi
% \ifENGLISH
% \subsection{pdf\LaTeX\ mode (PDF output)}
% When the \cmd{\PDFcontainer} file (default:
% \meta{\cmd{\jobname}}|-pics.pdf|) exists, the contents of the
% environments \env{pspicture} and \env{postscript} is ignored. Instead the
% corresponding graphics from the \cmd{\PDFcontainer} file is used.
% \fi
%    \begin{macrocode}
  \PackageInfo{pst-pdf}{MODE: \ppf@TeX@mode\space (pdfTeX mode)}%
%    \end{macrocode}
% \ifGERMAN
% Verhindert pdf\TeX{}s Warnung \texttt{Non-PDF special ignored!}.
% \fi
% \ifENGLISH
% Prevent pdf\TeX's message \texttt{Non-PDF special ignored!}.
% \fi
% \changes{v1.2d}{2017/06/22}{\cmd{\c@lor@to@ps} must not be undefined before 
%   loading `PSTricks'}
%    \begin{macrocode}
  \if@ppf@PST@used
    \let\ppf@temp\AtBeginDvi\let\AtBeginDvi\@gobble
    \def\c@lor@to@ps#1 #2\@@{}
    \RequirePackage{pstricks}\let\AtBeginDvi\ppf@temp
  \fi
%    \end{macrocode}
%    \begin{macrocode}
  \@temptokena{%
    \let\Gin@PS@file@header\@gobble\let\Gin@PS@literal@header\@gobble
    \let\Gin@PS@raw\@gobble\let\Gin@PS@restored\@gobble
    \@ifundefined{PSTricksLoaded}{}{%
%    \end{macrocode}
% \ifGERMAN
% F\"ur PSTricks $<$ 2.0 n\"otig.
% \fi
% \ifENGLISH
% Necessary if PSTricks $<$ 2.0.
% \fi
%    \begin{macrocode}
      \PSTricksOff
      \def\c@lor@to@ps#1 #2\@@{}
    }%
  }%
%    \end{macrocode}
% \ifGERMAN
% \PS-Ausgabe jetzt verhindern und sp\"ater noch einmal.
% \fi
% \ifENGLISH
% \PS\ output is now inhibited and later once again.
% \fi
%    \begin{macrocode}
  \the\@temptokena
  \expandafter\AtBeginDocument\expandafter
    {\the\@temptokena\@temptokena{}}%
  \@ifundefined{PSTricksLoaded}{}{%
%    \end{macrocode}
% \ifGERMAN
% Zum Parsen der Argumente von PSTricks' \cmd{\pst@object} laden wir
% \pkgname{preview} im active-Modus, restaurieren aber die
% standardm\"a{\ss}igen Definitionen von \cmd{\output}
% und \cmd{\shipout}. \cmd{\pr@startbox} und
% \cmd{\pr@endbox} dienen hier nur dazu, um \cmd{\pst@object} wirkungslos
% zu machen und stattdessen die zugeh\"orige Grafik aus der Containerdatei
% einzuladen. Derzeit werden nur maximal 3 optionale Pa\-ra\-meter in runden
% Klammern am Ende von \cmd{\pst@object} unterst\"utzt, was f\"ur viele,
% aber nicht f\"ur alle F\"alle ausreichend ist.
% \fi
% \ifENGLISH
% To parse the arguments of PSTricks' \cmd{\pst@object} we load
% \pkgname{preview} in active mode, but restore the default definitions of
% \cmd{\output} and \cmd{\shipout}. \cmd{\pr@startbox} and \cmd{\pr@endbox}
% serve here only to disable \cmd{\pst@object} and to load the
% corresponding graphics from the \cmd{\PDFcontainer} file. At present a
% maximum of three optional parameters in round braces (parenthesis) at the
% end of \cmd{\pst@object} is supported, which is sufficient, but not
% always enough.
% \fi
% \changes{v1.1b}{2005/04/09}{Ignore the call of
%   \cmd{\nofiles} inside of \pkgname{preview}. (RN)}
% \changes{v1.1p}{2007/07/27}{\cmd{\let}\cmd{\output}\cmd{\@gobble}
%   before loading of ``preview'' added. (RN)}
% \changes{v1.1t}{2008/09/09}{Remove the line 
%   ``\cmd{\let}\cmd{\output}\cmd{\@gobble}'' because of bad side 
%   effects. (RN)}
%    \begin{macrocode}
    \newtoks\ppf@output
    \ppf@output\expandafter{\the\output}%
    \let\ppf@nofiles=\nofiles \let\nofiles=\relax
    \let\ppf@shipout=\shipout
    \RequirePackage[active]{preview}[2005/01/29]%
    \let\shipout=\ppf@shipout \let\ppf@shipout=\relax
    \let\nofiles=\ppf@nofiles \let\ppf@nofiles=\relax
    \output\expandafter{\the\ppf@output} \ppf@output{}%
%    \end{macrocode}
% \ifGERMAN
% \cmd{\pr@startbox}, \cmd{\pr@endbox}: Gegen\"uber Originaldefinition
% vereinfacht.
% \fi
% \ifENGLISH
% \cmd{\pr@startbox}, \cmd{\pr@endbox}: simpler over original definitions.
% \fi
%    \begin{macrocode}
    \long\def\pr@startbox#1#2{%
      \ifpr@outer
        \toks@{#2}%
        \edef\pr@cleanup{\the\toks@}%
        \setbox\@tempboxa\vbox\bgroup
        \everydisplay{}%
        \pr@outerfalse%
        \expandafter\@firstofone
      \else
        \expandafter\@gobble
      \fi{#1}}%
    \def\pr@endbox{%
      \egroup
      \setbox\@tempboxa\box\voidb@x
      \ppf@@getpicture
      \pr@cleanup}%
%    \end{macrocode}
% \ifGERMAN
% (Siehe auch identische Definition im DVI-Modus.)
% \fi
% \ifENGLISH
% (See also the identical definition in DVI mode.)
% \fi
%    \begin{macrocode}
    \AtBeginDocument{%
      \@ifundefined{pst@object}{}%
      {%
        \PreviewMacro[{{}*[]%
          ?\bgroup{#{#1}{{#1}}}{}%
          ?\bgroup{#{#1}{{#1}}}{}%
          ?({#{(#1)}{({#1})}}{}%
          ?({#{(#1)}{({#1})}}{}%
          ?({#{(#1)}{({#1})}}{}%
          }]{\pst@object}}%
      }%
    }%
%    \end{macrocode}
% \ifGERMAN
% Es werden auch die im DVI-Modus erlaubten Endungen von Grafikdateien
% ben\"otigt.
% \fi
% \ifENGLISH
% Too the supported file name extensions from DVI mode are needed.
% \fi
%    \begin{macrocode}
  \begingroup
    \input{dvips.def}%
    \edef\x{\endgroup\def\noexpand\ppf@other@extensions{\Gin@extensions}}%
  \x
%    \end{macrocode}
% \ifGERMAN
% Dummy-Definition f\"ur die im DVI-Modus g\"ultigen Dateitypen.
% \fi
% \ifENGLISH
% Dummy definition for in DVI mode supported file formats.
% \fi
%    \begin{macrocode}
  \DeclareGraphicsRule{*}{eps}{*}{}%
%    \end{macrocode}
%    \begin{macrocode}
  \define@key{Gin}{innerframe}[true]{%
    \lowercase{\Gin@boolkey{#1}}{innerframe}}%
  \define@key{Gin}{frame}[true]{%
    \lowercase{\Gin@boolkey{#1}}{frame}}%
  \define@key{Gin}{ignore}[true]{%
    \lowercase{\Gin@boolkey{#1}}{ignore}}%
  \define@key{Gin}{frame@@}{%
%    \end{macrocode}
% \ifGERMAN
% (Nur intern zu benutzen!)
% \fi
% \ifENGLISH
% (For internal use only!)
% \fi
%    \begin{macrocode}
    \edef\@tempa{\toks@{\noexpand\frame{\the\toks@}}}%
    \ifcase#1\relax
      \ifGin@innerframe\else\let\@tempa\relax\fi
    \or
      \ifGin@frame\else\let\@tempa\relax\fi
    \fi
    \@tempa
  }%
  \define@key{Gin}{showname}[true]{%
    \lowercase{\Gin@boolkey{#1}}{showname}}%
  \define@key{Gin}{namefont}{%
    \begingroup
      \@temptokena\expandafter{\ppf@namefont#1}%
      \edef\x{\endgroup\def\noexpand\ppf@namefont{\the\@temptokena}}%
    \x
  }%
  \newcommand*\ppf@filename{}%
  \newcommand*\ppf@namefont{\tiny\ttfamily}%
  \newcommand*\ppf@Gin@keys{}%
  \let\ppf@Gin@setfile\Gin@setfile
%    \end{macrocode}
% \begin{macro}{\Gin@setfile}
% \ifGERMAN
% Realen Dateinamen und ggf. Seitenzahl zur sp\"ateren Verwendung merken.
% \fi
% \ifENGLISH
% Save real file name and, if applicable, page number for later use.
% \fi
% \changes{v1.0k}{2005/02/23}{Show also the pagenumber if exists. (RN)}
%    \begin{macrocode}
  \def\Gin@setfile#1#2#3{\ppf@Gin@setfile{#1}{#2}{#3}%
    \xdef\ppf@filename{%
      #3\ifx\Gin@page\@empty\else(\Gin@page)\fi}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Gin@ii}
% \ifGERMAN
%   Auswertung der Optionen ``frame'', ``ignore'' usw. sowie weiterer
%   Spezialf\"alle.
% \fi
% \ifENGLISH
%   Examine the options ``frame'', ``ignore'', etc. as soon as other
%   special cases.
% \fi
% \changes{v1.0s}{2005/03/28}{Rewritten. (RN)}
%    \begin{macrocode}
  \def\Gin@ii[#1]#2{%
    \begingroup
%    \end{macrocode}
% \ifGERMAN
% Der Wert \cmd{\ifGin@innerframe} muss bereits vor Zeichnen des
% inneren Rahmens bekannt sein. Die Werte f\"ur \cmd{\ifGin@showname} und
% \cmd{\ppf@namefont} m\"ussen auch nach Darstellung der Grafik verf\"ugbar
% sein. Daher durch eine Gruppe gesch\"utzt vorher Auswertung der Optionen.
% \fi
% \ifENGLISH
% The value of \cmd{\ifGin@innerframe} has to be known before the inner
% frame is drawn. The values for \cmd{\ifGin@showname} and
% \cmd{\ppf@namefont} need to be available after rendering the graphics
% too. Thus beforehand and protected inside a group examine the options.
% \fi
%    \begin{macrocode}
      \@temptokena{#1}\def\ppf@tempb{#2}%
%    \end{macrocode}
% \ifGERMAN
% Leerer Dateiname beim Aufruf von \cmd{\usepicture} aus.
% \fi
% \ifENGLISH
% Finds empty file name when calling \cmd{\usepicture}.
% \fi
%    \begin{macrocode}
      \ifx\ppf@tempb\@empty\else
        \ppf@is@pdfTeX@graphic{#2}{\Gin@extensions}{\ppf@other@extensions}%
%    \end{macrocode}
% \ifGERMAN
% Grafiken aus Containerdatei sind bereits skaliert usw. Nicht noch
% einmal, daher optionalen Parameter ignorieren.
% \fi
% \ifENGLISH
% Graphics out of \cmd{\PDFcontainer} are complete -- scaled, rotated, etc.
% Don't apply these things again and therefore ignore the optional parameters.
% \fi
% \changes{v1.1v}{2008/10/09}{Key settings only for pdf graphics. (RN)}
%    \begin{macrocode}
        {%
          \setkeys{Gin}{#1}%
          \ifx\ppf@tempb\PDFcontainer
            \@temptokena{page=\Gin@page}%
          \fi
        }%
        {%
          \refstepcounter{pspicture}%
          \@temptokena{page=\the\c@pspicture}\def\ppf@tempb{\PDFcontainer}%
        }%
      \fi
      \ifGin@ignore\else
%    \end{macrocode}
% \ifGERMAN
% ``|frame@@=0|''\,$=$\,innerer Rahmen, ``|frame@@=1|''\,$=$\,\"au{\ss}erer
% Rahmen.
% \fi
% \ifENGLISH
% ``|frame@@=0|''\,$=$\,inner frame, ``|frame@@=1|''\,$=$\,outer frame.
% \fi
%    \begin{macrocode}
        \edef\@tempa{\noexpand\ppf@Gin@ii[frame@@=0,\the\@temptokena,
          frame@@=1]{\ppf@tempb}}%
        \@tempa
        \ifGin@showname
          \ppf@namefont
          \raisebox{-\ht\strutbox}[0pt][0pt]{\llap{\ppf@filename}}%
          \gdef\ppf@filename{}%
        \fi
      \fi
    \endgroup
  }%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
  \IfFileExists{\PDFcontainer}%
  {%
%    \end{macrocode}
% \begin{macro}{\ppf@container@max}
% \ifGERMAN
% Die Anzahl der in der Containerdatei enthaltenen Seiten.
% \fi
% \ifENGLISH
% The number of pages as contained in \cmd{\PDFcontainer} file.
% \fi
%    \begin{macrocode}
    \pdfximage{\PDFcontainer}%
    \edef\ppf@container@max{\the\pdflastximagepages}%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
    \AtEndDocument{%
      \ifnum\c@pspicture>\z@
%    \end{macrocode}
% \ifGERMAN
% Warnung ist nur sinnvoll, wenn \"uberhaupt Grafiken ben\"otigt
% wurden.
% \fi
% \ifENGLISH
% A warning only makes sense when a graphics is needed at all.
% \fi
%    \begin{macrocode}
        \ifnum\c@pspicture=\ppf@container@max\else
          \PackageWarningNoLine{pst-pdf}{%
            `\PDFcontainer' contains \ppf@container@max\space pages
            \MessageBreak but \the\c@pspicture\space pages are requested:
            \MessageBreak File `\PDFcontainer' is no more valid!
            \MessageBreak Recreate it
          }%
        \fi
      \fi
    }%
  }%
  {%
    \def\ppf@container@max{0}%
    \AtEndDocument{%
      \ifnum\c@pspicture>\z@
        \filename@parse{\PDFcontainer}%
        \PackageWarningNoLine{pst-pdf}{%
          File `\PDFcontainer' not found.\MessageBreak
          Use the following commands to create it:\MessageBreak
          ----------------------------------------------------
          \MessageBreak
          latex \jobname.tex\MessageBreak
          dvips -o \filename@base.ps \jobname.dvi\MessageBreak
          ps2pdf \filename@base.ps\MessageBreak
          ----------------------------------------------------
        }%
      \fi
    }%
  }%
%    \end{macrocode}
% \begin{macro}{\ppf@isnum}
% \ifGERMAN
% Ist Parameter |#1| numerisch, werden Anweisungen in |#2|
% sonst die in |#3| ausgef\"uhrt (siehe \pkgname{bibtopic.sty}).
% \fi
% \ifENGLISH
% If parameter |#1| is numeric, the instructions in |#2|,
% otherwise those in |#3| are executed (see \pkgname{bibtopic.sty}).
% \fi
%    \begin{macrocode}
  \newcommand\ppf@isnum[1]{%
    \if!\ifnum9<1#1!\else_\fi\expandafter\@firstoftwo
    \else\expandafter\@secondoftwo\fi}%
%    \end{macrocode}
% \end{macro}
% \begin{environment}{psmatrix}
% \changes{v1.0h}{2005/02/15}{Based no more on the comment environment
%   from the verbatim package. (RN)}
% \begin{environment}{pspicture}
% \changes{v1.1g}{2005/05/28}{pspicture environment
%   must still parse its arguments. (RN/HjG)}
% \ifGERMAN
% Beide Umgebungen ignorieren ihren Inhalt und laden stattdessen die
% zugeh\"orige Grafik aus der Containerdatei. Auf den Wert des dabei
% benutzten Z\"ahlers (|pspicture|)
% kann per \cmd{\label}/\cmd{\ref} zugegriffen werden.
% \fi
% \ifENGLISH
% Both environments ignore their contents and load instead the corresponding
% graphics out of the \cmd{\PDFcontainer} file. The value of the herein used
% |pspicture| counter's value can be used in \cmd{\label}/\cmd{\ref}.
% \fi
% \begin{environment}{postscript}
% \changes{v1.1d}{2005/04/19}{Support for PSTricks environment
%   ``psmatrix''. (RN)}
% \changes{v1.1g}{2005/05/28}{``psmatrix'' environment
%   (preserve math mode). (RN/HjG)}
%    \begin{macrocode}
  \newcommand*\ppf@set@mode{}%
  \newcommand*\ppf@test@mmode{%
  \ifmmode
    \ifinner
      \let\ppf@set@mode=$%
    \else
      \def\ppf@set@mode{$$}%
    \fi
  \else
    \let\ppf@set@mode=\@empty
  \fi
  }
%    \end{macrocode}
% \changes{v1.1t}{2008/09/09}{Using \pkgname{environ} the environment
% \env{postscript} is now simple and more robust. (RN)}
%    \begin{macrocode}
  \RequirePackage{environ}%
  \newenvironment{postscript}[1][]{%
    \def\@tempa{postscript}%
    \ifx\@tempa\@currenvir
      \def\ppf@Gin@keys{#1}%
    \else
      \def\ppf@Gin@keys{}%
    \fi
    \ppf@@getpicture
    \Collect@Body\@gobble}{}%
  \AtBeginDocument{%
    \@ifundefined{PSTricksLoaded}{}{%
      \def\pst@@@picture[#1](#2,#3)(#4,#5){\postscript}%
      \def\endpspicture{\endpostscript\endgroup}%
      \@ifundefined{psmatrix}{}{%
        \let\psmatrix=\postscript
        \let\endpsmatrix=\endpostscript}%
    }%
    \@ifundefined{pfx@includegraphicx}{}{%
%    \end{macrocode}
% \ifGERMAN
% Die im pdf\TeX-Modus unn\"utze Umdefinition von
% \cmd{\includegraphics} (Paket \pkgname{psfragx}) f\"uhrt zu zweifachem
% Einf\"ugen des Ergebnisses, weshalb die Originaldefition wiederhergestellt
% wird.
% \fi
% \ifENGLISH
% The useless redefinition of \cmd{\includegraphics} in pdf\TeX\ mode
% (package \pkgname{psfragx}) is leading to double insertion of the result.
% We go back to the original meaning.
% \fi
%    \begin{macrocode}
      \let\includegraphics=\pfx@includegraphics
      \def\pfx@includegraphicx#1#2{\ppf@@getpicture}%
    }%
  }%
%    \end{macrocode}
% \end{environment}
% \end{environment}
% \end{environment}
% \begin{macro}{\savepicture}
% \changes{v1.0f}{2005/02/04}{New macro \cmd{\savepspicture}. (RN)}
% \ifGERMAN
% Speichert die Nummer der aktuellen Grafik in einem Makro mit Namen
% \cmd{\ppf@@@}|#1|.
% \fi
% \ifENGLISH
% Saves the recent graphics' number in a macro named \cmd{\ppf@@@}|#1|.
% \fi
%    \begin{macrocode}
  \def\savepicture#1{%
    \expandafter\xdef\csname ppf@@@#1\endcsname{\the\pdflastximage}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\usepicture}
% \changes{v1.0f}{2005/02/04}{New macro \cmd{\usepspicture}. Useful
%   for putting a PSTricks graphic in a box or something else. (RN)}
% \changes{v1.0g}{2005/02/12}{Now \cmd{\usepspicture} does accept a
%   numerical parameter. (RN)}
% \changes{v1.0q}{2005/03/20}{Now \cmd{\usepspicture} works for all
%   kind of graphics. (RN)}
% \ifGERMAN
% F\"ugt Grafik mit symbolischem Namen |#2| ein. Der Name
% muss vorher mit \cmd{\savepicture}\marg{Name} vereinbart worden
% sein. Statt des Namens kann auch eine Zahl angegeben werden, die dann
% direkt eine Grafik aus der Containerdatei adressiert.
% Der optionale Parameter |#1| entspricht dem bei \cmd{\includegraphics}.
% \fi
% \ifENGLISH
% Inserts graphics with symbolic name |#2|. This name has to be declared
% beforehand in \cmd{\savepicture}\marg{name}. Instead of a name a number
% can be used too, which directly addresses a graphics in the
% \cmd{\PDFcontainer} file. The optional parameter |#1| corresponds to the
% one in \cmd{\includegraphics}.
% \fi
%    \begin{macrocode}
  \renewcommand*\usepicture[2][]{%
    \@ifundefined{ppf@@@#2}%
    {%
      \ppf@isnum{#2}%
      {\ppf@getpicture{#1}{#2}}%
      {\@latex@error{picture `#2' undefined}\@ehc}%
    }%
    {%
      \begingroup
        \def\Ginclude@graphics##1{%
          \xdef\ppf@filename{#2}%
          \setbox\z@\hbox{\pdfrefximage\@nameuse{ppf@@@#2}}%
          \Gin@nat@height\ht\z@ \Gin@nat@width\wd\z@
          \def\Gin@llx{0} \let\Gin@lly\Gin@llx
          \Gin@defaultbp\Gin@urx{\Gin@nat@width}%
          \Gin@defaultbp\Gin@ury{\Gin@nat@height}%
          \Gin@bboxtrue\Gin@viewport@code
          \Gin@nat@height\Gin@ury bp%
          \advance\Gin@nat@height-\Gin@lly bp%
          \Gin@nat@width\Gin@urx bp%
          \advance\Gin@nat@width-\Gin@llx bp%
          \Gin@req@sizes
          \ht\z@\Gin@req@height \wd\z@\Gin@req@width
          \leavevmode\box\z@}%
        \define@key{Gin}{type}{}%
        \includegraphics[scale=1,#1]{}%
      \endgroup
    }}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ppf@getpicture}
% \ifGERMAN
% F\"ugt die Seite (Grafik) mit Nummer |#2| aus der Containerdatei
% ein. Parameter |#1|: Optionen wie bei \cmd{\includegraphics}.
% \fi
% \ifENGLISH
% Inserts the page (graphics) with number |#2| from the \cmd{\PDFcontainer}
% file. Parameter |#1|: any option as in \cmd{\includegraphics}.
% \fi
%    \begin{macrocode}
  \newcommand*\ppf@getpicture[2]{%
    \@tempcnta=#2\relax%
    \ifnum\@tempcnta>\ppf@container@max
      \PackageWarningNoLine{pst-pdf}{%
        pspicture No. \the\@tempcnta\space undefined}%
    \else
      \includegraphics[draft=\ppf@draft,#1,page=\the\@tempcnta]%
        {\PDFcontainer}%
    \fi
    \gdef\ppf@Gin@keys{}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ppf@@getpicture}
% \ifGERMAN
% F\"ugt die n\"achste Seite (Grafik) aus der Containerdatei ein.
% \fi
% \ifENGLISH
% Inserts next page (graphics) from the \cmd{\PDFcontainer} file.
% \fi
%    \begin{macrocode}
  \newcommand*\ppf@@getpicture{%
    \ifpr@outer
      \refstepcounter{pspicture}%
      \expandafter\ppf@getpicture\expandafter{\ppf@Gin@keys}%
      {\the\c@pspicture}%
    \fi}%
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{pst-pdf-defs}
% \ifGERMAN
%   Umgebung, die keine eigene Gruppe aufmacht. Innerhalb der Umgebung
%   bekommt das Zeichen |&| den Kategoriecode "`other"'. Gedacht f\"ur
%   eigene Makrodefinitionen, die z.\,B.\ eine \env{psmatrix} enthalten.
% \fi
% \ifENGLISH
%   Environment without grouping. The character |&| has the catcode 
%   ``other''. Useful for user-defined macro definitions with e.\,g.\ %
%   \env{psmatrix} inside.
% \fi
%    \begin{macrocode}
  \renewenvironment*{pst-pdf-defs}%
  {%
    \endgroup
%    ??? \@currenvline
    \chardef\ppf@temp=\catcode`\&%
    \@makeother\&%
  }{%
    \catcode`\&=\ppf@temp
    \begingroup
    \def\@currenvir{pst-pdf-defs}%
  }
%    \end{macrocode}
% \end{environment}
%
%    \begin{macrocode}
\else
%    \end{macrocode}
% \ifGERMAN
% \subsection{Inactiver Modus}
% Es werden nur die Pakete \pkgname{pstricks} und \pkgname{graphicx} geladen
% -- keine weitere Einflussnahme. Die Paketoption
% "`|inactive|"' sowie der V\TeX-Compiler erzwingen diesen Modus.
% \fi
% \ifENGLISH
% \subsection{Inactive Mode}
% Only the packages \pkgname{pstricks} and \pkgname{graphicx} are loaded
% -- no further exertion of influence. The package option
% ``|inactive|'' as soon as the V\TeX compiler force this mode.
% \fi
%    \begin{macrocode}
  \PackageInfo{pst-pdf}{MODE: \ppf@TeX@mode\space (inactive mode)}%
  \newenvironment{postscript}[1][]{\ignorespaces}{}
  \let\ppf@is@pdfTeX@graphic\relax
\fi
%    \end{macrocode}
% \changes{v1.0f}{2005/02/04}{Config file loading added. (RN)}
%    \begin{macrocode}
\InputIfFileExists{pst-pdf.cfg}{%
  \PackageInfo{pst-pdf}{Local config file pst-pdf.cfg used}}{}
%</package>
%    \end{macrocode}
%
% \Finale
%\endinput
%
% And here comes the example documents ...
%<*example>
%% Process this file with the scripts `ps4pdf' or `ps4pdf.bat' or call
%%
%%   latex pst-pdf-example.tex
%%   dvips -Ppdf -o pst-pdf-example-pics.ps pst-pdf-example.dvi
%%   ps2pdf -dAutoRotatePages=/None pst-pdf-example-pics.ps pst-pdf-example-pics.pdf
%%   pdflatex pst-pdf-example.tex
%%
\listfiles\errorcontextlines=100\relax
\documentclass[12pt]{article}

%% before `psfrag'!
\usepackage[displaymath,dvipsnames]{pst-pdf}
%%\usepackage[displaymath,dvipsnames,notightpage]{pst-pdf}

\usepackage{pst-node,pst-tree}

\usepackage{psfrag,tabularx}

\pagestyle{empty}

\begin{pst-pdf-defs}%

%% This definition must be within the pst-pdf-defs environment!
\newcommand*\mytree{%
  \begin{psmatrix}[rowsep=.2cm,colsep=2cm]
               &       & E   \\
               & A     &     \\
               &       & F   \\
  $\bullet$    &       &     \\
               &       & G   \\
               & B     &     \\
               &       & H   \\
  \scriptsize
  \psset{shortput=nab,arrows=->,labelsep=2pt,nodesep=2pt,nrot=:U}

  \ncline{4,1}{2,2}\ncput*{$0,2$}
  \ncline{4,1}{6,2}\ncput*{$x$}

  \ncline{2,2}{1,3}\ncput*{$0,3$}
  \ncline{2,2}{3,3}\ncput*{$y$}

  \ncline{6,2}{5,3}\ncput*{$z$}
  \ncline{6,2}{7,3}\ncput*{$0,8$}
  \end{psmatrix}%
}

\end{pst-pdf-defs}%

%% This works without the pst-pdf-defs environment!
\newcommand*\mymatrix{%
  \begin{postscript}
  \[
  \begin{array}{rcl}
   a & b & c \\
   1 & 2 & 3 \\
  \end{array}
  \]
  \end{postscript}%
}


\begin{document}

\setkeys{Gin}{showname,frame}%

\psset{unit=0.0714\textwidth}% 1/14 * \textwidth
\newpsobject{showgrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=6pt}

\newcommand*\BASEMARKER{\rule{.5em}{.4pt}}

\setlength\parindent{0pt}

\centering

\section*{\textsf{pst-pdf:}
  PSTricks and other PostScript code in pdf\LaTeX\ documents}

\vfill

\begin{pspicture}(-5.5,-5.25)(5.25,5.25)%
%%\begin{pspicture}[trim=-.5 -.25 .25 .25,frame](-5,-5)(5,5)% PSTricks2
  \pscircle*[linecolor=Apricot]{5}
  \rput(0,0.5){\includegraphics[width=8\psxunit]{elephant}}
  \Huge\sffamily\bfseries
  \rput(-4.5,4.5){A} \rput(4.5,4.5){B}
  \rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
  \rmfamily
  \rput(0,-3.8){PSTricks}
  \rput(0,3.8){\LaTeX}
  \showgrid
\end{pspicture}\savepicture{ps:A}

\vfill\null\newpage

\includegraphics[width=.475\textwidth]{insect1}

\vfill

\usepicture[width=.47\textwidth]{ps:A}

\includegraphics[width=.475\textwidth,frame=false,
  namefont={\Huge\itshape}]{knuth}
\hfill
\usepicture[angle=45,origin=bl,width=.475\textwidth,innerframe]{1}%

\vfill

\includegraphics[width=.47\textwidth]{psf-demo}
\hfill
\begin{psfrags}
  \psfragscanon
  \psfrag{x1}[br][  ]{\LaTeX} \psfrag{x2}[br][br]{\LaTeX}
  \psfrag{x3}[br][tl]{\LaTeX} \psfrag{x4}[br][Br]{\LaTeX}
  \psfrag{x5}[Br][ r][1.15][45]{\Huge\LaTeX}
  \psfrag{x6}[tl][ l][1.15][45]{\Huge\LaTeX}
  \includegraphics[width=.47\textwidth]{psf-demo}
\end{psfrags}

\includegraphics[width=\textwidth,showname=false,frame=false]{insect15}

\bigskip

\Large

\begin{equation}
  \sigma(t)=\frac{1}{\sqrt{2\pi}}
  \int^t_0 e^{-x^2/2} dx
\end{equation}

\clearpage

\setkeys{Gin}{showname=false,frame=false}%

{ \Huge \renewcommand*\arraystretch{1.5}

  \noindent
  \begin{tabularx}{\textwidth}{|@{}>{\centering}X@{}|} \hline

  \psframebox*[fillcolor=green,framearc=.6]{HUGO}\BASEMARKER
  \fbox{\BASEMARKER GUSTAV}  \tabularnewline

  \begin{postscript}
  \psframebox*[fillcolor=green,framearc=.6]{HUGO}\BASEMARKER
  \fbox{\BASEMARKER GUSTAV}
  \end{postscript}           \tabularnewline \hline

  \end{tabularx}

}

\bigskip

\definecolor{pink}{rgb}{1, .75, .8}
\renewcommand\psedge{\nccurve}
\newcommand{\Female}[2][]{{\psset{linecolor=pink}\TR[#1]{\emph{#2}}}}
\newcommand{\Male}[2][]{{\psset{linecolor=blue}\TR[#1]{#2}}}

\psset{nodesep=2pt,angleA=90,angleB=-90}

{ \footnotesize

   %% From: The \LaTeX\ Graphics Companion; first release.
   \pstree[treemode=U]{\Female{{\bfseries Matilde}}}{%
     \pstree{\Male{Sebastian}}{%
       \pstree{\Male[name=P]{Philip}}{\Male{Frederick}\Female{Ethel}}
       \pstree{\Female[name=W]{Mary}}{\Male{Lionel}\Female{Agnes}}}
     \pstree{\Female{Leonor}}{%
       \pstree{\Male[name=R]{Ra\'ul}}{\Male{Joaquim}\Female{J\'ulia}}
       \pstree{\Female[name=A]{Am\'elia}}{\Male{\'Alvaro}\Female{Augusta}}}
   }

  \iffalse  % --> Cannot work outside of a special environment!
  \psset{linecolor=green,doubleline=true,linestyle=dotted}
  \ncline{P}{W}\nbput{1940}
  \ncline{R}{A}\nbput{1954}
  \fi
}

\bigskip

\psset{arrows=->,fillcolor=white,fillstyle=solid}

\footnotesize

\newcommand{\Show}[1]{\psshadowbox{#1}}

\begin{psmatrix}[mnode=r,ref=t,unit=.3]
  \psframebox[linestyle=none,framesep=.75]{%
    \begin{psmatrix}[name=A,ref=c]
      \Show{Stakeholder}
    \end{psmatrix}} &
  \psframebox[fillstyle=solid,fillcolor=pink,framesep=.95]{%
    \rule{1cm}{0pt}
    \begin{psmatrix}[ref=c]
      [name=B]\Show{Goal} & \Show{Criteria}\\
              \Show{Sub-goal} & \Show{Justification}
      \ncline{1,1}{1,2}
      \ncline{1,1}{2,2}
      \ncline{1,1}{2,1}\tlput{Strategy}
      \ncline{2,1}{2,2}
    \end{psmatrix}}
  \ncline[angleB=180]{A}{B}\naput[npos=.7]{Model}
\end{psmatrix}

\begin{postscript}[angle=90,height=\textheight,frame=false]

\pstree[treemode=U]{\Female{{\bfseries Matilde}}}{%
  \pstree{\Male{Sebastian}}{%
    \pstree{\Male[name=P]{Philip}}{\Male{Frederick}\Female{Ethel}}
    \pstree{\Female[name=W]{Mary}}{\Male{Lionel}\Female{Agnes}}}
  \pstree{\Female{Leonor}}{
  \pstree{\Male[name=R]{Ra\'ul}}{\Male{Joaquim}\Female{J\'ulia}}
  \pstree{\Female[name=A]{Am\'elia}}{\Male{\'Alvaro}\Female{Augusta}}}
}

\psset{linecolor=green,doubleline=true,linestyle=dotted}
\ncline{P}{W}\nbput{1940}
\ncline{R}{A}\nbput{1954}

\end{postscript}

\bigskip

\psset{arrows=-}

\begin{displaymath}
  \bordermatrix{%
  & A            & B & C\cr
  & \rnode{D}{D} & E & \rnode{F}{F}\cr
  & G            & H & I\cr
  & \rnode{J}{J} & K & M
  }
  \ncline[nodesep=-1em,linecolor=red]{D}{F}
  \ncline[nodesep=-1em,linecolor=red]{D}{J}
\end{displaymath}

\bigskip

\mytree

\bigskip

\mymatrix

\end{document}
%</example>