summaryrefslogtreecommitdiff
path: root/graphics/pstricks/contrib/pst-optexp/pst-optexp.dtx
blob: 5e2c06953a84ded8d992b159a9b1dd75629c741e (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
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
19225
19226
19227
19228
19229
19230
19231
19232
19233
19234
19235
19236
19237
19238
19239
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354
19355
19356
19357
19358
19359
19360
19361
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
19380
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
19413
19414
19415
19416
19417
19418
19419
19420
19421
19422
19423
19424
19425
19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463
19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543
19544
19545
19546
19547
19548
19549
19550
19551
19552
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567
19568
19569
19570
19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590
19591
19592
19593
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
19625
19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810
19811
19812
19813
19814
19815
19816
19817
19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
19980
19981
19982
19983
19984
19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
20591
20592
20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
20729
20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780
20781
20782
20783
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859
20860
20861
20862
20863
20864
20865
20866
20867
20868
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
20896
20897
20898
20899
20900
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918
20919
20920
20921
20922
20923
20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945
20946
20947
20948
20949
20950
20951
20952
20953
20954
20955
20956
20957
20958
20959
20960
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
21079
21080
21081
21082
21083
21084
21085
21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
21295
21296
21297
21298
21299
21300
21301
21302
21303
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
21323
21324
21325
21326
21327
21328
21329
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
21347
21348
21349
21350
21351
21352
21353
21354
21355
21356
21357
21358
21359
21360
21361
21362
21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436
21437
21438
21439
21440
21441
21442
21443
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534
21535
21536
21537
21538
21539
21540
21541
21542
21543
21544
21545
21546
21547
21548
21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593
21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
21614
21615
21616
21617
21618
21619
21620
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748
21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771
21772
21773
21774
21775
21776
21777
21778
21779
21780
21781
21782
21783
21784
21785
21786
21787
21788
21789
21790
21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896
21897
21898
21899
21900
21901
21902
21903
21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928
21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
21983
21984
21985
21986
21987
21988
21989
21990
21991
21992
21993
21994
21995
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
22011
22012
22013
22014
22015
22016
22017
22018
22019
22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
22095
22096
22097
22098
22099
22100
22101
22102
22103
22104
22105
22106
22107
22108
22109
22110
22111
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
22205
22206
22207
22208
22209
22210
22211
22212
22213
22214
22215
22216
22217
22218
22219
22220
22221
22222
22223
22224
22225
22226
22227
22228
22229
22230
22231
22232
22233
22234
22235
22236
22237
22238
22239
22240
22241
22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
22300
22301
22302
22303
22304
22305
22306
22307
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
22330
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
22374
22375
22376
22377
22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
22389
22390
22391
22392
22393
22394
22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
22410
22411
22412
22413
22414
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
22439
22440
22441
22442
22443
22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
22460
22461
22462
22463
22464
22465
22466
22467
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
22484
22485
22486
22487
22488
22489
22490
22491
22492
22493
22494
22495
22496
22497
22498
22499
22500
22501
22502
22503
22504
22505
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536
22537
22538
22539
22540
22541
22542
22543
22544
22545
22546
22547
22548
22549
22550
22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568
22569
22570
22571
22572
22573
22574
22575
22576
22577
22578
22579
22580
22581
22582
22583
22584
22585
22586
22587
22588
22589
22590
22591
22592
22593
22594
22595
22596
22597
22598
22599
22600
22601
22602
22603
22604
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631
22632
22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
22648
22649
22650
22651
22652
22653
22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677
22678
22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
22881
22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
22898
22899
22900
22901
22902
22903
22904
22905
22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
23000
23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012
23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
23080
23081
23082
23083
23084
23085
23086
23087
23088
23089
23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
23116
23117
23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
23197
23198
23199
23200
23201
23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275
23276
23277
23278
23279
23280
23281
23282
23283
23284
23285
23286
23287
23288
23289
23290
23291
23292
23293
23294
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311
23312
23313
23314
23315
23316
23317
23318
23319
23320
23321
23322
23323
23324
23325
23326
23327
23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
23361
23362
23363
23364
23365
23366
23367
23368
23369
23370
23371
23372
23373
23374
23375
23376
23377
23378
23379
23380
23381
23382
23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395
23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
23459
23460
23461
23462
23463
23464
23465
23466
23467
23468
23469
23470
23471
23472
23473
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
23491
23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
23518
23519
23520
23521
23522
23523
23524
23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552
23553
23554
23555
23556
23557
23558
23559
23560
23561
23562
23563
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573
23574
23575
23576
23577
23578
23579
23580
23581
23582
23583
23584
23585
23586
23587
23588
23589
23590
23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602
23603
23604
23605
23606
23607
23608
23609
23610
23611
23612
23613
23614
23615
23616
23617
23618
23619
23620
23621
23622
23623
23624
23625
23626
23627
23628
23629
23630
23631
23632
23633
23634
23635
23636
23637
23638
23639
23640
23641
23642
23643
23644
23645
23646
23647
23648
23649
23650
23651
23652
23653
23654
23655
23656
23657
23658
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
23688
23689
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709
23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731
23732
23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
23898
23899
23900
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
23967
23968
23969
23970
23971
23972
23973
23974
23975
23976
23977
23978
23979
23980
23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
24649
24650
24651
24652
24653
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702
24703
24704
24705
24706
24707
24708
24709
24710
24711
24712
24713
24714
24715
24716
24717
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009
25010
25011
25012
25013
25014
25015
25016
25017
25018
25019
25020
25021
25022
25023
25024
25025
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075
25076
25077
25078
25079
25080
25081
25082
25083
25084
25085
25086
25087
25088
25089
25090
25091
25092
25093
25094
25095
25096
25097
25098
25099
25100
25101
25102
25103
25104
25105
25106
25107
25108
25109
25110
25111
25112
25113
25114
25115
25116
25117
25118
25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
25138
25139
25140
25141
25142
25143
25144
25145
25146
25147
25148
25149
25150
25151
25152
25153
25154
25155
25156
25157
25158
25159
25160
25161
25162
25163
25164
25165
25166
25167
25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
25178
25179
25180
25181
25182
25183
25184
25185
25186
25187
25188
25189
25190
25191
25192
25193
25194
25195
25196
25197
25198
25199
25200
25201
25202
25203
25204
25205
25206
25207
25208
25209
25210
25211
25212
25213
25214
25215
25216
25217
25218
25219
25220
25221
25222
25223
25224
25225
25226
25227
25228
25229
25230
25231
25232
25233
25234
25235
25236
25237
25238
25239
25240
25241
25242
25243
25244
25245
25246
25247
25248
25249
25250
25251
25252
25253
25254
25255
25256
25257
25258
25259
25260
25261
25262
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283
25284
25285
25286
25287
25288
25289
25290
25291
25292
25293
25294
25295
25296
25297
25298
25299
25300
25301
25302
25303
25304
25305
25306
25307
25308
25309
25310
25311
25312
25313
25314
25315
25316
25317
25318
25319
25320
25321
25322
25323
25324
25325
25326
25327
25328
25329
25330
25331
25332
25333
25334
25335
25336
25337
25338
25339
25340
25341
25342
25343
25344
25345
25346
25347
25348
25349
25350
25351
25352
25353
25354
25355
25356
25357
25358
25359
25360
25361
25362
25363
25364
25365
25366
25367
25368
25369
25370
25371
25372
25373
25374
25375
25376
25377
25378
25379
25380
25381
25382
25383
25384
25385
25386
25387
25388
25389
25390
25391
25392
25393
25394
25395
25396
25397
25398
25399
25400
25401
25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
25412
25413
25414
25415
25416
25417
25418
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
25433
25434
25435
25436
25437
25438
25439
25440
25441
25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
25453
25454
25455
25456
25457
25458
25459
25460
25461
25462
25463
25464
25465
25466
25467
25468
25469
25470
25471
25472
25473
25474
25475
25476
25477
25478
25479
25480
25481
25482
25483
25484
25485
25486
25487
25488
25489
25490
25491
25492
25493
25494
25495
25496
25497
25498
25499
25500
25501
25502
25503
25504
25505
25506
25507
25508
25509
25510
25511
25512
25513
25514
25515
25516
25517
25518
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582
25583
25584
25585
25586
25587
25588
25589
25590
25591
25592
25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
25605
25606
25607
25608
25609
25610
25611
25612
25613
25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
25625
25626
25627
25628
25629
25630
25631
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648
25649
25650
25651
25652
25653
25654
25655
25656
25657
25658
25659
25660
25661
25662
25663
25664
25665
25666
25667
25668
25669
25670
25671
25672
25673
25674
25675
25676
25677
25678
25679
25680
25681
25682
25683
25684
25685
25686
25687
25688
25689
25690
25691
25692
25693
25694
25695
25696
25697
25698
25699
25700
25701
25702
25703
25704
25705
25706
25707
25708
25709
25710
25711
25712
25713
25714
25715
25716
25717
25718
25719
25720
25721
25722
25723
25724
25725
25726
25727
25728
25729
25730
25731
25732
25733
25734
25735
25736
25737
25738
25739
25740
25741
25742
25743
25744
25745
25746
25747
25748
25749
25750
25751
25752
25753
25754
25755
25756
25757
25758
25759
25760
% \iffalse meta-comment
%
% Copyright (C) 2007-2021 by Christoph Bersch <usenet@bersch.net>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% 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.3c or later is part of all distributions of LaTeX
% version 2008/05/04 or later.
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{pst-optexp.dtx}
%</driver>
%<stylefile>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<stylefile>\ProvidesPackage{pst-optexp}
%<*stylefile>
    [2021/02/26 v6.0 Optical experimental setups with PSTricks]
%</stylefile>
%
%<*driver>
\documentclass[
paper=a4,
headinclude=false,
footinclude=false,
oneside,
toc=index,
headsepline,
parskip=half-]{scrreprt}
\usepackage{doc}
\setcounter{IndexColumns}{2}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage{lmodern} 
\usepackage{amsmath, marvosym} 
\usepackage{bera}
\providecommand*\mainlang{}
\usepackage[ngerman, english,\mainlang]{babel}
\usepackage{prettyref}
\usepackage[dvipsnames,x11names,svgnames]{xcolor}
\usepackage{array,booktabs,paralist,tabularx}
\usepackage{ragged2e, calc}
\newlength{\POEcaptionmargin}
\newlength{\POEcaptionheight}
\usepackage[labelfont={color=DOrange}, 
            singlelinecheck=false, 
            justification=raggedright]{caption} 
\DeclareCaptionFormat{poenocaption}{%
  \setlength{\POEcaptionmargin}{\widthof{#1}+7pt}%
  \setlength{\POEcaptionheight}{\heightof{#1}+3pt}%
  \hspace*{-\POEcaptionmargin}#1\par\vspace*{-\POEcaptionheight}%
}%
\DeclareCaptionFormat{poecaption}{%
  \setlength{\POEcaptionmargin}{\widthof{#1}+7pt}%
  \hspace*{-\POEcaptionmargin}#1#2#3\par
}%
\captionsetup[lstlisting]{format=poenocaption}
\usepackage{nicefrac}
\usepackage{pst-func}
\usepackage{pst-optexp}
\usepackage[makeindex]{splitidx}
\usepackage{hypdoc}
\hypersetup{%
  colorlinks=true, 
  urlcolor=DOrange, 
  linkcolor=pdflinkcolor, 
  breaklinks,
  linktocpage=true} 
\usepackage{breakurl}
\definecolor{DOrange}{rgb}{1,.4,.2}%
\definecolor{DDOrange}{rgb}{0.7, 0.23, 0.07}%
\colorlet{pdflinkcolor}{DOrange}
\colorlet{DGreen}{green!90!black}
\usepackage{pst-tree}
\usepackage{showexpl}
\usepackage{scrhack}
\makeatletter\renewcommand*\SX@Info{}\makeatother
\usepackage{etoolbox}
\undef{\cs}\undef{\cmd}
\usepackage{ltxdockit}
\newcommand{\poeTR}[1]{\TR{\ttfamily\color{DOrange}#1}}
\definecolor{colKeys}{rgb}{0,0,0}
\definecolor{colIdentifier}{rgb}{0,0,0}
\colorlet{colComments}{green!60!black}
\definecolor{colString}{rgb}{0,0.5,0}
\newlength{\codeoverhang}
\setlength{\codeoverhang}{0.5\marginparwidth+\marginparsep}
\lstset{%
  language=[LaTeX]TeX, identifierstyle=\color{colIdentifier},
  keywordstyle=\color{colKeys},
  keywordstyle = [21]\color{DOrange},
  keywordstyle = [22]\color{DOrange},
  stringstyle=\color{colString},
  commentstyle=\color{colComments},
  alsoletter={12},
  float=hbp,
  basicstyle=\ttfamily\small,
  columns=flexible,
  tabsize=4,
  showspaces=false,
  showstringspaces=false,
  breaklines=true,
  breakautoindent=true,
  breakatwhitespace=true,
  captionpos=t,
  belowcaptionskip=0pt,
  abovecaptionskip=0pt,
  xleftmargin=1em,
  prebreak = {\raisebox{-0.5ex}[\ht\strutbox]{\kern0.5ex\large\Righttorque}},
  rulecolor=\color{black!20}, 
  texcsstyle = [20]\color{DDOrange},
  moretexcs = [20]{lens, optbox, oenode, oenodeIn, oenodeExt, oenodeOut,
    oenodeRefA, oenodeRefB, oenodeTrefA, oenodeTrefB, oenodeLabel,
    oenodeRotref, oenodeBeam, oenodeBeamUp, oenodeBeamLow, oenodeCenter,
    oenodeIfc, oeBeamVec, oeBeamVecUp, oeBeamVecLow, oeBeamVecMedian,
    oeBeamCenter, optplate, optretplate, pinhole, crystal, optdetector,
    optdiode, doveprism, glanthompson, polarization, mirror, parabolicmirror, 
    oapmirror, axicon, optwedge, asphericlens,
    beamsplitter, optgrating, optprism, rightangleprism, pentaprism, optaom,
    optdipole, opttripole, optfiber, optamp, optmzm, optfilter, optsource,
    polcontrol, optisolator, optswitch, fiberdelayline,
    optfiberpolarizer, fibercollimator, optcoupler, wdmcoupler,
    wdmsplitter, optcirculator, fiberbox, eleccoupler, elecsynthesizer,
    elecmixer, optarrowcomp, optbarcomp, transmissiongrating, drawbeam, drawwidebeam,
    drawfiber, drawwire, frontlayer, backlayer, newOptexpDipole,
    newOptexpTripole, newOptexpFiberDipole, newOptexpComp,
    newOptexpFiberComp, optplane},
  explpreset={%
    pos=l, width=-99pt, hsep=5mm, overhang=\codeoverhang, varwidth,
    vsep=\bigskipamount, rframe={}}, extendedchars=true
}%
\lstdefinestyle{example}{explpreset={%
    escapechar=*, pos=l, width=-99pt, hsep=5mm, overhang=\codeoverhang,
    varwidth, vsep=\bigskipamount, rframe={}}}
\makeatletter
\providecommand\ON{%
  \gdef\lst@alloverstyle##1{\textcolor{black!50}{\strut##1}%
}}
\providecommand\OFF{\xdef\lst@alloverstyle##1{##1}}
\makeatother
\colorlet{sectioncolor}{DOrange}
\addtokomafont{sectioning}{\color{sectioncolor}}
\usepackage[automark,markcase=ignorenouppercase]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearmainofpairofpagestyles
\clearplainofpairofpagestyles
\ohead{\pagemark}
\ihead{\headmark}
\ofoot[\pagemark]{}
\automark[subsection]{section}
\setkomafont{headsepline}{\color{DOrange}}
\DeclareTOCStyleEntry[level=0, numwidth=2.0em]{default}{chapter}
\DeclareTOCStyleEntry[level=1, indent=1.5em, numwidth=3.0em]{default}{section}
\DeclareTOCStyleEntry[level=2, indent=3.8em, numwidth=4.0em]{default}{subsection}
\makeatletter
\newrobustcmd*{\fnurl}[1][]{\hyper@normalise\ltd@fnurl{#1}}
\def\ltd@fnurl#1#2{\footnote{#1\hyper@linkurl{\Hurl{#2}}{#2}}}
\newrobustcmd*{\arxivurl}[1]{\href{http://arxiv.org/abs/#1}{arXiv:#1}}
\newrobustcmd*{\doiurl}[1]{\href{http://dx.doi.org/#1}{DOI:#1}}
\makeatother
\usepackage{csquotes}
\MakeAutoQuote{«}{»}
%^^A spot is used in ltxdockit.sty
\colorlet{spot}{sectioncolor}
\newpsstyle{Refline}{linecolor=gray!70}
\newpsstyle{CenterNode}{linecolor=blue, dotstyle=x, dotscale=1.5}
\psset[optexp]{usefiberstyle}
\colorlet{Refline}{gray!70}
%^^A Fonts definitions used in ltxdockit.sty
\renewcommand*{\verbatimfont}{\ttfamily}
\renewcommand*{\displayverbfont}{\ttfamily}
\renewcommand*{\marglistfont}{\spotcolor\sffamily\small}
\renewcommand*{\margnotefont}{\sffamily\small}
\renewcommand*{\optionlistfont}{\spotcolor\sffamily\displayverbfont}
\renewcommand*{\ltxsyntaxfont}{\ttfamily}
\renewcommand*{\ltxsyntaxlabelfont}{\spotcolor\displayverbfont}
\renewcommand*{\changelogfont}{\normalfont}
\renewcommand*{\changeloglabelfont}{\spotcolor\sffamily\bfseries}

\makeatletter
%^^A an idea from GL to provide links inside the listings to the pst-optexp commands: 
%^^A <https://groups.google.com/groups/search?as_umsgid=4d89ee49%240%2418590%24426a74cc%40news.free.fr>
\providerobustcmd*\ifrefundefined [1]{%
  \begingroup%
    \csname @safe@activestrue\endcsname%
    \expandafter\endgroup\csname @\ifodd
      \ifcsname r@comp:#1\endcsname 1\else
        \ifcsname r@prm:#1\endcsname 1\else 
          \ifcsname r@cs:#1\endcsname 1\else
            \ifcsname r@sty:#1\endcsname 1\else 0
      \fi\fi\fi\fi second\else first\fi oftwo\endcsname
}% \ifrefundefined
\def\lsthk@OutputBox@H@@k{%
    \begingroup%
      \let\lst@UM\@empty%
      \edef\@tempc{\detokenize\expandafter{\the\lst@token }}%\edef
      \ifrefundefined{\@tempc}%
    \endgroup%
    \sethyperlistings%
}% \lsthk@OutputBox@H@@k
\def\sethyperlistings {\global\let \hyperlistingsreference =\@tempc
     \endgroup \aftergroup \dohyperlistings }% after \hbox
\def\dohyperlistings {\def\lst@alloverstyle ##1{\hyperlistings ##1}}
\def\hyperlistings{%
    \setbox\@tempboxa\hbox%
    \bgroup%
      \rlap{\hypersetup {linkcolor=.}\relax\fboxrule\z@%
        \ifcsdef{r@prm:\hyperlistingsreference}%
          {\hyperref[prm:\hyperlistingsreference]{\xLkeyword{\hyperlistingsreference}\boxframe{\wd\@tempboxa}{\ht\@tempboxa}{\dp\@tempboxa}}}%
          {\ifcsdef{r@comp:\hyperlistingsreference}%
            {\hyperref[comp:\hyperlistingsreference]{\xLcomp{\hyperlistingsreference}\boxframe{\wd\@tempboxa}{\ht\@tempboxa}{\dp\@tempboxa}}}%
            {\ifcsdef{r@sty:\hyperlistingsreference}%
              {\hyperref[sty:\hyperlistingsreference]{\xLstyle{\hyperlistingsreference}\boxframe{\wd\@tempboxa}{\ht\@tempboxa}{\dp\@tempboxa}}}%
              {\hyperref[cs:\hyperlistingsreference]{\xLcs{\hyperlistingsreference}\boxframe{\wd\@tempboxa}{\ht\@tempboxa}{\dp\@tempboxa}}}}}}%
      \unhbox\@tempboxa%
    \egroup%
}% \hyperlistings
\let\lsthk@OutputBox\lsthk@OutputBox@H@@k

\renewenvironment*{ltxsyntax}
  {\list{}{%
     \setlength{\labelwidth}{\marglistwidth}%
     \setlength{\labelsep}{0pt}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{%
       \hss\ltxsyntaxfont\ltxsyntaxlabelfont##1}}%
   \let\cmditem\POE@cmditem
   \let\envitem\ltd@envitem
   \let\compitem\POE@compitem}
  {\endlist}

\newenvironment*{stylelist}
  {\list{}{%
     \setlength{\labelwidth}{\marglistwidth}%
     \setlength{\labelsep}{0.5\marglistsep}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\optionlistfont##1}}%
     \let\styleitem\POE@styleitem
     \let\typeitem\POE@typeitem}%
  {\endlist}

\def\ltd@optionlist{%
  \let\optitem\POE@optitem
  \let\valitem\POE@valitem
  \let\choitem\POE@choitem
  \let\boolitem\POE@boolitem
  \let\intitem\POE@intitem
  \let\numitem\POE@numitem
  \let\psnumitem\POE@psnumitem
  \let\poeitem\ltd@item
  \let\styleitem\POE@styleitem
  \let\typeitem\POE@typeitem}

\def\POE@styleitem{%
  \@ifnextchar[%]
    {\POE@styleitem@i}
    {\POE@styleitem@i[]}}
\def\POE@styleitem@i[#1]#2{%
  \item[{#2}]%
  \label{sty:#2}\xdefLstyle{#2}%
  \begingroup\raggedright
  \prm{psstyle}%
  \settowidth\@tempdimb{\prm{psstyle}}%
  \settowidth\@tempdimc{#2}%
  \@tempdimc=\dimexpr\@tempdimc+\labelsep-\labelwidth\relax
  \ifdim\@tempdimc>0pt%
    \@tempdima=\dimexpr\linewidth-\@tempdimb-\@tempdimc-1em\relax
  \else
    \@tempdima=\dimexpr\linewidth-\@tempdimb-1em\relax
  \fi
  \ifblank{#1}{}{\hfill\parbox[t]{\@tempdima}{\raggedleft default:~\ltd@textverb{#1}}}%
  \par\endgroup}

\def\POE@typeitem#1#2{%
  \item[{#1}]%
  \label{prm:#1}\docindexdef{#1=\nxLkeyword{#1}}%
  \begingroup\raggedright
  #2%
  \settowidth\@tempdimb{\prm{psstyle}}%
  \settowidth\@tempdimc{#1}%
  \@tempdimc=\dimexpr\@tempdimc+\labelsep-\labelwidth\relax
  \ifdim\@tempdimc>0pt%
    \@tempdima=\dimexpr\linewidth-\@tempdimb-\@tempdimc-1em\relax
  \else
    \@tempdima=\dimexpr\linewidth-\@tempdimb-1em\relax
  \fi
  \par\endgroup}

\def\POE@option#1#2#3{%
  \item[#1]%
  \begingroup\raggedright
  \ltd@textverb{=}%
  \settowidth\@tempdimb{\ltd@textverb{=}}%
  \settowidth\@tempdimc{#1}%
  \@tempdimc=\dimexpr\labelwidth-\@tempdimc\relax
  \ifdim\@tempdimc<0pt
    \@tempdima=\dimexpr\linewidth-\@tempdimb+\@tempdimc-2em\relax
  \else
    \@tempdima=\dimexpr\linewidth-\@tempdimb-2em\relax
  \fi
  \ifblank{#3}
    {}
    {\settowidth\@tempdimb{default: #3}%
     \@tempdima=\dimexpr\@tempdima-\@tempdimb-2em\relax}%
  \parbox[t]{\@tempdima}{\raggedright #2}%
  \ifblank{#3}
    {}
    {\hfill default:~#3}%
  \par\endgroup
  \nobreak\vspace{\itemsep}}

\def\POE@optitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@optitem@i}
    {\booltrue{@tempswa}\POE@optitem@i}}
\newcommand*{\POE@optitem@i}[3][]{%
  \ifbool{@tempswa}%
    {\label{prm:#2}\xdefLkeyword{#2}}%
    {\xLkeyword{#2}}%
  \ifblank{#1}
    {\POE@option{#2}{#3}{}}
    {\POE@option{#2}{#3}{\ltd@textverb{#1}}}}%

\def\POE@valitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@valitem@i}
    {\booltrue{@tempswa}\POE@valitem@i}}
\newcommand*{\POE@valitem@i}[3][]{%
  \ifbool{@tempswa}%
    {\label{prm:#2}\xdefLkeyword{#2}}%
    {\xLkeyword{#2}}%
  \ifblank{#1}
    {\POE@option{#2}{\prm{#3}}{}}
    {\POE@option{#2}{\prm{#3}}{\ltd@textverb{#1}}}}%

\def\POE@choitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@choitem@i}
    {\booltrue{@tempswa}\POE@choitem@i}}
\newcommand*{\POE@choitem@i}[3][]{%
  \ifbool{@tempswa}%
    {\label{prm:#2}\xdefLkeyword{#2}}%
    {\xLkeyword{#2}}%
  \ifblank{#1}
    {\POE@option{#2}{\ltd@verblist{#3}}{}}
    {\POE@option{#2}{\ltd@verblist{#3}}{\ltd@textverb{#1}}}}%

\def\POE@boolitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@boolitem@i}
    {\booltrue{@tempswa}\POE@boolitem@i}}
\newcommand*{\POE@boolitem@i}[2][]{%
  \ifbool{@tempswa}%
    {\label{prm:#2}\xdefLkeyword{#2}}%
    {\xLkeyword{#2}}%
  \ifblank{#1}
    {\POE@option{#2}{\ltd@verblist{true,false}}{}}
    {\POE@option{#2}{\ltd@verblist{true,false}}{\ltd@textverb{#1}}}}%

\def\POE@intitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@intitem@i}
    {\booltrue{@tempswa}\POE@intitem@i}}
\newcommand*{\POE@intitem@i}[2][]{%
  \ifbool{@tempswa}%
    {\label{prm:#2}\xdefLkeyword{#2}}%
    {\xLkeyword{#2}}%
  \ifblank{#1}
    {\POE@option{#2}{\prm{int}}{}}
    {\POE@option{#2}{\prm{int}}{\ltd@textverb{#1}}}}%

\def\POE@numitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@numitem@i}
    {\booltrue{@tempswa}\POE@numitem@i}}
\newcommand*{\POE@numitem@i}[2][]{%
  \ifbool{@tempswa}%
    {\label{prm:#2}\xdefLkeyword{#2}}%
    {\xLkeyword{#2}}%
  \ifblank{#1}
    {\POE@option{#2}{\prm{num}}{}}
    {\POE@option{#2}{\prm{num}}{\ltd@textverb{#1}}}}%

\def\POE@psnumitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@psnumitem@i}
    {\booltrue{@tempswa}\POE@psnumitem@i}}
\newcommand*{\POE@psnumitem@i}[2][]{%
  \ifbool{@tempswa}%
    {\label{prm:#2}\xdefLkeyword{#2}}%
    {\xLkeyword{#2}}%
  \ifblank{#1}
    {\POE@option{#2}{\prm{psnum}}{}}
    {\POE@option{#2}{\prm{psnum}}{\ltd@textverb{#1}}}}%

\def\ltd@csitem{%
  \@ifstar
    {\boolfalse{@tempswa}\ltd@csitem@i}
    {\booltrue{@tempswa}\ltd@csitem@i}}
\def\ltd@csitem@i#1{%
  \ifbool{@tempswa}
    {\ltd@item@ii{\textbackslash#1\hspace\marglistsep}{#1}}
    {\ltd@item@ii{\textbackslash#1\hspace\marglistsep}{}}}

\def\POE@cmditem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@cmditem@i}
    {\booltrue{@tempswa}\POE@cmditem@i}}
\def\POE@cmditem@i#1{%
  \ifbool{@tempswa}
    {\POE@cmditem@ii{\textbackslash#1}{cs:#1}}
    {\POE@cmditem@ii{\textbackslash#1}{}}}
\def\POE@compitem{%
  \@ifstar
    {\boolfalse{@tempswa}\POE@compitem@i}
    {\booltrue{@tempswa}\POE@compitem@i}}
\def\POE@compitem@i#1{%
  \ifbool{@tempswa}
    {\POE@cmditem@ii{\textbackslash#1}{comp:#1}}
    {\POE@cmditem@ii{\textbackslash#1}{}}}
\def\POE@cmditem@ii#1#2{%
  \ltd@itemsave
  \ifhmode
    \itemsep-\topsep
  \else
    \ltd@itembreak
  \fi
  \item[#1]%
  \ltd@itemrest
  \ifblank{#2}{}{\label{#2}}%
  \begingroup
  \ltd@syntaxsetup
  \ltxsyntaxfont
  \let\@tempa\@empty
  \ltd@parseargs}

\def\ltd@csitem@ii#1#2{%
  \ltd@itemsave
  \ifhmode
    \itemsep-\topsep
  \else
    \ltd@itembreak
  \fi
  \item[#1]%
  \ltd@itemrest
  \ifblank{#2}{}{\label{cs:#2}}%
  \begingroup
  \ltd@syntaxsetup
  \ltxsyntaxfont
  \let\@tempa\@empty
  \ltd@parseargs}


\let\plainllap\llap
\newrobustcmd\macro@llap[1]{{\global\let\llap\plainllap
 \setbox0=\hbox\bgroup \macro@font\small\saved@macroname\egroup
 \ifdim\wd0>30mm
    \hbox to\z@ \bgroup\hss \hbox to30mm{\unhcopy0\hss}\egroup
    \edef\@tempa{\hskip\dimexpr\the\wd0-30mm}\global\everypar\expandafter{\the\expandafter\everypar
                                                                           \@tempa \global\everypar{}}%
 \else \llap{\unhbox0}\fi}}
 \AtBeginEnvironment{macro}{\let\llap\macro@llap}
\makeatother

\newcommand*{\PSstring}[1]{{\normalfont\small\ttfamily(#1)}}
\newcommand*{\PSarray}[1]{{\normalfont\small\ttfamily[#1]}}
\newcommand*{\PSname}[1]{{\normalfont\small\ttfamily/#1}}
\newcommand*{\PSproc}[1]{{\normalfont\small\ttfamily\textbraceleft #1\textbraceright}}
\newcommand*{\PSvar}[1]{{\normalfont\small\ttfamily #1}}
\newcommand*{\PSop}[1]{{\normalfont\small\ttfamily\color{DOrange}\hskip 3pt #1\hskip 3pt}}

\newcommand*{\compref}[1]{\ref{comp:#1}}
\newcommand*{\hyperpagedef}[1]{\textbf{\hyperpage{#1}}}
\newcommand*{\nodename}[1]{\emph{#1}}
\newcommand*{\param}[1]{\normalfont\texttt{#1}}
\newcommand*{\paramvalue}[1]{\texttt{#1}}
\newcommand*{\styleshape}[1]{\texttt{#1}}
\newcommand{\docindex}[1]{\sindex[doc]{#1|hyperpage}}
\newcommand{\docindexdef}[1]{\sindex[doc]{#1|hyperpagedef}}
\makeatletter
\def\Lcs{\@ifstar{\Lcs@nobm}{\Lcs@bm}}
\def\Lcs@nobm#1{\nxLcs{#1}\xLcs{#1}}
\def\Lcs@bm#1{\hyperref[cs:#1]{\Lcs@nobm{#1}}}
\def\xLcs#1{\docindex{#1=\nxLcs{#1}}\docindex{\POEindexMacro!#1=\nxLcs{#1}}}
\def\nxLcs#1{\texttt{\textbackslash#1}}

\def\Lcomp{\@ifstar{\Lcomp@nobm}{\Lcomp@bm}}
\def\Lcomp@nobm#1{\nxLcomp{#1}\xLcomp{#1}}
\def\Lcomp@bm#1{\hyperref[comp:#1]{\Lcomp@nobm{#1}}}
\def\xLcomp#1{\docindex{#1=\nxLcomp{#1}}\docindex{\POEindexComp!#1=\nxLcomp{#1}}}
\def\nxLcomp#1{\texttt{\textbackslash#1}}

\def\LPack#1{\nxLPack{#1}\docindex{#1=\nxLPack{#1}}\docindex{\POEindexPack!#1=\nxLPack{#1}}}
\def\nxLPack#1{\texttt{#1}}

\def\Lenv{\@ifstar{\Lenv@nobm}{\Lenv@bm}}
\def\Lenv@nobm#1{\nxLenv{#1}\xLenv{#1}}
\def\Lenv@bm#1{\hyperref[env:#1]{\Lenv@nobm{#1}}}
\def\xLenv#1{\docindex{#1=\nxLenv{#1}}\docindex{\POEindexEnv!#1=\nxLenv{#1}}}
\def\nxLenv#1{\texttt{#1}}
\let\orig@ltd@envitem\ltd@envitem
\def\ltd@envitem#1{\orig@ltd@envitem{#1}\label{env:#1}\xLenv{#1}}

\def\Lkeyword{\@ifstar{\Lkeyword@nobm}{\Lkeyword@bm}}
\def\Lkeyword@nobm#1{\nxLkeyword{#1}\xLkeyword{#1}}
\def\Lkeyword@bm#1{\hyperref[prm:#1]{\Lkeyword@nobm{#1}}}
\def\xLkeyword#1{\docindex{#1=\nxLkeyword{#1}}\docindex{\POEindexKeyword!#1=\nxLkeyword{#1}}}
\def\xdefLkeyword#1{\docindexdef{#1=\nxLkeyword{#1}}\docindexdef{\POEindexKeyword!#1=\nxLkeyword{#1}}}
\def\nxLkeyword#1{\texttt{#1}}

\def\xLoption#1{\docindex{#1=\texttt{#1}}}
\def\Loption#1{\texttt{#1}\xLoption{#1}}
\def\nxLoption#1{\texttt{#1}}

\def\Lstyle{\@ifstar{\Lstyle@nobm}{\Lstyle@bm}}
\def\Lstyle@nobm#1{\nxLstyle{#1}\xLstyle{#1}}
\def\Lstyle@bm#1{\hyperref[sty:#1]{\Lstyle@nobm{#1}}}
\def\xLstyle#1{\docindex{#1=\nxLstyle{#1}}\docindex{\POEindexStyle!#1=\nxLstyle{#1}}}
\def\xdefLstyle#1{\docindexdef{#1=\nxLstyle{#1}}\docindexdef{\POEindexStyle!#1=\nxLstyle{#1}}}
\def\nxLstyle#1{\texttt{#1}}

\def\Ldipole#1{\nxLcs{#1}\xLdipole{#1}}
\def\xLdipole#1{\docindexdef{#1=\nxLcs{#1}}\docindexdef{\POEindexComp!#1=\nxLcs{#1}}}

\def\Ltripole#1{\nxLcs{#1}\xLtripole{#1}}
\def\xLtripole#1{\docindexdef{#1=\nxLcs{#1}}\docindexdef{\POEindexComp!#1=\nxLcs{#1}}}

\def\Lfdipole#1{\nxLcs{#1}\xLfdipole{#1}}
\def\xLfdipole#1{\docindexdef{#1=\nxLcs{#1}}\docindexdef{\POEindexComp!#1=\nxLcs{#1}}}

\def\Lfmultipole#1{\nxLcs{#1}\xLfmultipole{#1}}
\def\xLfmultipole#1{\docindexdef{#1=\nxLcs{#1}}\docindexdef{\POEindexComp!#1=\nxLcs{#1}}}

\def\Lemultipole#1{\nxLcs{#1}\xLemultipole{#1}}
\def\xLemultipole#1{\docindexdef{#1=\nxLcs{#1}}\docindexdef{\POEindexComp!#1=\nxLcs{#1}}}
\makeatother

\newcommand{\dipoledesc}[1]{%
  \xLdipole{#1}%
  \compitem{#1}[options](in)(out){label}%
}
\newcommand{\tripoledesc}[1]{%
  \xLtripole{#1}%
  \compitem{#1}[options](in)(center)(out){label}%
}

\newcommand{\fiberdipoledesc}[1]{%
  \xLfdipole{#1}%
  \compitem{#1}[options](in)(out){label}%
}

\newenvironment*{pssyntax}
  {\list{}{\small
     \setlength{\labelsep}{0pt}%
     \setlength{\leftmargin}{10pt}%
     \item[]}}
  {\endlist}

\newcommand{\psarglistfont}{\small}
\newenvironment*{psarglist}
  {\list{}{%
     \setlength{\labelwidth}{10pt}%
     \setlength{\labelsep}{0pt}%
     \setlength{\leftmargin}{0pt}%
     \setlength{\itemsep}{\parsep}%
     \setlength{\parsep}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\psarglistfont##1}}}
  {\endlist}

\makeatletter
\renewenvironment{theglossary}{\GlossaryParms \let\item\@idxitem \ignorespaces}{}
\makeatother
\def\psargitem#1{\item[#1]\hfill\par\nobreak}

\addtopsstyle{Fiber}{linecolor=DOrange,linewidth=1.5\pslinewidth}
\addtopsstyle{Beam}{linewidth=1.5\pslinewidth}
\EnableCrossrefs
\CodelineIndex
\OnlyDescription
\begin{document}
  \DocInput{pst-optexp.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \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         \~}
%
% \GetFileInfo{pst-optexp.dtx}
%
% \DoNotIndex{\@,\g@addto@macro,\newif,\gdef,\xdef,\newcounter,\or,\ifcase,\\}
% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\let,\if,\ifx,\else,\fi,\@ifnextchar}
% \DoNotIndex{\space,\relax,\nr,\val,\ignorespaces,\ifdim,\ifcat,\@nil,\@none,\@empty}
% \DoNotIndex{\PackageError,\PackageWarning,\advance,\csname,\endcsname,\bgroup,\egroup}
% \DoNotIndex{\expandafter,\POE@comp,\@postcode}
% \DoNotIndex{\psset}
% \DoNotIndex{\@wd,\@sz,\@ht,\@yshift,\@step,\@xl,\@sep,\@r,\@dp,\@altan,\@extpostcode}
% \DoNotIndex{\@f@cnt,\@f@r,\@f@sep,\@hshift,\@bs@wd,\@c@caxisL,\@cnt,\@pstfalse,\@psttrue}
% \DoNotIndex{\@th,\@rL,\@rR,\i,\long,\optexp@nodeA,\optexp@nodeB}
% \DoNotIndex{\POE@temp,\POE@tempa,\POE@tempb,\POE@tempc,\POE@tempd}
% \DoNotIndex{\POE@getref@b,\POE@getref@c,\POE@getref@l,\POE@getref@r,\POE@getref@t}
% \DoNotIndex{\the,\toks@}
% 
% \newif\ifGERMAN  \GERMANfalse
% \newif\ifENGLISH \ENGLISHfalse
% \iflanguage{ngerman}{\GERMANtrue}{%
%   \iflanguage{german}{\GERMANtrue}{\GERMANfalse}}
% \iflanguage{english}{\ENGLISHtrue}{\ENGLISHfalse}
%
% \ifGERMAN
%   \newrefformat{chap}{Kap.~\ref{#1}}
%   \newrefformat{sec}{Kap.~\ref{#1}}
%   \newrefformat{l}{Zeile~\ref{#1}}
%   \newrefformat{ex}{Bsp.~\ref{#1}}
%   \newrefformat{tab}{Tab.~\ref{#1}}
%   \newrefformat{fig}{Abb.~\ref{#1}}
%   \newindex[Quelltextindex]{idx}
%   \newindex[Dokumentationsindex]{doc}
%   \newcommand{\POEindexComp}{Komponenten}
%   \newcommand{\POEindexStyle}{Stile}
%   \newcommand{\POEindexMacro}{Makros}
%   \newcommand{\POEindexKeyword}{Parameter}
%   \newcommand{\POEindexEnv}{Umgebungen}
%   \newcommand{\POEindexPack}{Pakete}
%   \renewcommand*\lstlistingname{Bsp.}
% \fi
% \ifENGLISH
%   \newrefformat{chap}{Sec.~\ref{#1}}
%   \newrefformat{sec}{Sec.~\ref{#1}} 
%   \newrefformat{l}{Line~\ref{#1}}
%   \newrefformat{ex}{Ex.~\ref{#1}}
%   \newrefformat{tab}{Tab.~\ref{#1}}
%   \newrefformat{fig}{Fig.~\ref{#1}}
%   \newindex[Code index]{idx}
%   \newindex[Documentation index]{doc}
%   \newcommand{\POEindexComp}{components}
%   \newcommand{\POEindexStyle}{styles}
%   \newcommand{\POEindexMacro}{macros}
%   \newcommand{\POEindexKeyword}{parameters}
%   \newcommand{\POEindexEnv}{environments}
%   \newcommand{\POEindexPack}{packages}
%   \renewcommand*\lstlistingname{Ex.}
% \fi
%
% \newcommand{\refpointexplanation}{%
%   \ifGERMAN
%   Analog zum Referenzpunkt von \nxLcs{rput}, kann jede Kombination von
%   \opt{c} (mittig), \opt{t} (oben), \opt{b} (unten), \opt{l} (links) und
%   \opt{r} (rechts) sein.
%   \fi
%   \ifENGLISH
%   Like the reference point of \nxLcs{rput}, can be any comination of
%   \opt{c} (center), \opt{t} (top), \opt{b} (bottom), \opt{l} (left), and
%   \opt{r} (right).
%   \fi}
%
% \newcommand*{\linewidthexplanation}[2]{% 
% \ifGERMAN
% Die Linienbreite #1. Diese könnte ebenfalls über den
% \opt{linewidth} Parameter gesetzt werden. Mit diesem Parameter kann
% aber die Linienbreite aller #2 global eingestellt werden.
% \fi
% \ifENGLISH
% The linewidth of the #1. This could be defined also with the
% generic \opt{linewidth} option. But this parameter allows setting
% globally the linewidth of all #2.
% \fi
% }
%
% \newcommand*{\deprecatedmsg}[2][3.0]{%
% \ifGERMAN Dieser Parameter ist seit Version #1 veraltet, verwenden Sie stattdessen #2. \fi
% \ifENGLISH This parameter is deprecated since version #1, use #2 instead.\fi
% }
%
% \newcommand*{\addtostylemsg}[1]{%
% \ifGERMAN Der vorhandene \Lstyle{#1}-Stil wird lokal um die Parameter in
%   \prm{list} erweitert, \prm{list} muss mit geschweiften Klammern gekapselt
%   werden.
% \fi
% \ifENGLISH 
%   The \Lstyle{#1} style is extended by locally adding the
%   parameters contained in \prm{list}. The \prm{list} must be surrounded
%   by curly braces.
% \fi
% }
% \newcommand*{\newstylemsg}[1]{%
% \ifGERMAN Ähnlich wie \Lkeyword{addto#1}, nur wird der
%   \Lstyle{#1}-Stil mit den neuen Parametern überschrieben.
% \fi
% \ifENGLISH Similar to \Lkeyword{addto#1}, but an existing
%   \Lstyle{#1} style is overwritten with the new parameter set.
% \fi
% }
%
% \makeatletter
% \renewcommand\maketitle{^^A
% \thispagestyle{empty}^^A
% \begin{titlepage}
% \begin{pspicture}(1.6in,0.685in)(10,20.5)
%   \psframe[fillstyle=solid,linecolor=lightgray,fillcolor=lightgray,linestyle=solid](0,-5.75)(21.5,10)
%   \psframe[fillstyle=solid,linecolor=Orange!85!Red,fillcolor=Orange!85!Red,linestyle=solid](0,10)(21.5,10.5)
%   \psframe[fillstyle=solid,linecolor=Orange!85!Red,fillcolor=Orange!85!Red,linestyle=solid](0,21.1)(21.5,21.2)
%   \rput[lb](3,22){\Huge\sffamily\color{Orange!65!Red}\psscalebox{2}{\textbf{PSTricks}}}
%   \rput[lb](3,14.1){\parbox{15cm}{\sffamily\RaggedRight\bfseries\huge\@title}}
%   \rput[lb](3,7.6){\parbox{13cm}{\sffamily\@date}}
%   \rput[lb](3,-2.6){\parbox[b]{17cm}{\sffamily\RaggedRight 
%     ~\hfill\makebox[7cm][l]{\ifGERMAN Paketautor:\fi\ifENGLISH Package author:\fi}\\
%     ~\hfill\makebox[7cm][l]{^^A
%       \bfseries\tabular[t]{@{}l@{}}\@author\endtabular}}}
%  \rput[C](11,4){\bgImage}
%  \end{pspicture}^^A
% \end{titlepage}}
% \makeatother
% 
% \ifGERMAN
%   \title{\texttt{pst-optexp}\\ Optische Versuchsaufbauten\\[0.5ex] \small \fileversion}
%   \hypersetup{pdftitle={Optische Versuchsaufbauten}}
% \fi
% \ifENGLISH
%   \title{\texttt{pst-optexp}\\ Drawing optical experimental setups\\[0.5ex] \small \fileversion}
%   \hypersetup{pdftitle={Optical experimental setups}}
% \fi
% \author{Christoph Bersch}
% \date{\filedate}
% \def\bgImage{\psset{unit=1.3}
% \begin{pspicture}(-0.2,0.1)(8.2,5.3)
%   \pnode(0,3){M1}
%   \pnode(8,3){M2}
%   \pnode(8,0.5){In}
%   \pnode(6.5,0.5){Min}
%   \pnode(6.5,3){Pin}
%   \pnode(4.5,3){Min2}
%   \pnode(1.3, 0.5){Mout}
%   \pnode(1.3,3){Pout}
%   \pnode(3.5,3){Mout2}
%   \pnode(0,0.5){Out}
%   \definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}
%   \addtopsstyle{Beam}{linecolor=bl, linejoin=1}
%   \psset{mirrortype=extended, mirrordepth=0.15}
%   \newpsstyle{ExtendedMirror}{linestyle=none, hatchwidth=0.5\pslinewidth, hatchsep=1.2\pslinewidth,
%                 fillstyle=hlines}
%   \begin{optexp}
%   \mirror[mirrorwidth=4, mirrorradius=11.](M2)(M1)(M2)
%   \mirror[mirrorwidth=4, mirrorradius=10.4](M1)(M2)(M1)
%   \mirror(In)(Min)(Pin)
%   \optprism[n=1.85, addtoOptComp={linewidth=1.5\pslinewidth}](Min)(Pin)(Min2)
%   \mirror[compshift=-0.4](Pin)(Min2)(Pin)
%   \mirror[compshift=0.4](Pout)(Mout2)(Pout)
%   \optprism[n=1.85, linewidth=1.5\pslinewidth](Mout2)(Pout)(Mout)
%   \mirror(Pout)(Mout)(Out)
%   \multido{\i=0+1}{40}{^^A
%     \pstVerb{^^A
%       \i\space 650 400 sub 39 div mul 400 add 
%       tx@addDict begin wavelengthToRGB end }^^A
%     \drawbeam[n={-0.002 \i\space mul n add}](In){3-5}{2}{1}{6-7}
%   }^^A
%   \newpsstyle{Beam}{linecolor=red}
%   \backlayer{\psline[style=Beam,ArrowInside=->, linewidth=2\pslinewidth, arrowinset=0](In)(\oenodeIn{3})(\oenodeOut{4})}
%   \drawbeam[linewidth=2\pslinewidth, arrows=->, arrowinset=0, loadbeampoints, beaminsidefirst, n=1.9325]{7-8}(Out)  
% \end{optexp}
% \rput(4,4.5){^^A
%   \psframe[fillstyle=solid,fillcolor=gray!70](-0.1, -0.6)(0.1, 0.7)
%   \multido{\r=-0.5+0.1}{12}{^^A
%     \psline[linewidth=0.5\pslinewidth](-0.1,\r)(0.1,\r)
%   }^^A
% }
% \end{pspicture}}
%
% \maketitle
% 
% \clearpage
% \tableofcontents
% \clearpage
% 
% \ifGERMAN
%   \chapter{Einführung}
% \fi
% \ifENGLISH
%   \chapter{Introduction}
% \fi
% 
% \ifGERMAN
%   \section{Über das Paket}
%
%   \LPack{pst-optexp} ist ein PSTricks-Paket zum Skizzieren optischer
%   Versuchsaufbauten. Dafür werden viele unterschiedliche Freistrahl- und
%   Faserkomponenten bereitgestellt, deren Ausrichtung, Positionierung und
%   Beschriftung einfach und flexibel eingestellt werden kann. Die Komponenten
%   können dann mit Fasern oder Lichtstrahlen verbunden werden, wobei auch
%   realistische Strahlengänge mit Raytracing möglich sind.
% \fi 
% \ifENGLISH
%   \section{About the package}
%   The package \LPack{pst-optexp} is a collection of optical components that
%   facilitate easy sketching of optical experimental setups. A lot of different
%   free-ray and fiber components are provided, which alignment, positioning and
%   labelling can be achieved in very simple and flexible ways. The components
%   can be connected with fibers or beams, realistic raytraced beam paths are
%   also possible.
% \fi
%
% \ifGERMAN
%   \section{Anforderungen}
%   \LPack{pst-optexp} benötigt \LaTeX{} und aktuelle Versionen der
%   Pakete \LPack{pstricks} ($\geq 2.53$), \LPack{pst-plot} ($\geq
%   1.6.1$), \LPack{pst-node}, \LPack{pstricks-add}, \LPack{multido},
%   \LPack{pst-eucl}, \LPack{pst-intersect} ($\geq 0.4$) und
%   \LPack{environ}.
%
%   Alle PSTricks-Pakete machen regen Gebrauch von der Postscript-Sprache, so
%   dass der typische Arbeitsfluss \opt{latex}, \opt{dvips} und
%   ggf. \opt{ps2pdf} umfasst. Es gibt viele alternative Methoden um die
%   Dokumente zu
%   kompilieren.\fnurl{http://tug.org/PSTricks/main.cgi?file=pdf/pdfoutput}
% \fi
% \ifENGLISH
%   \section{Requirements}
%   \LPack{pst-optexp} requires \LaTeX{} and recent versions of
%   \LPack{pstricks} ($\geq 2.53$), \LPack{pst-plot} ($\geq 1.61$),
%   \LPack{pst-node}, \LPack{multido}, \LPack{pstricks-add},
%   \LPack{pst-eucl}, \LPack{pst-intersect} ($\geq 0.4$) and
%   \LPack{environ}.
%
%   All PSTricks package rely heavily on the Postscript language so that the
%   typical workflow involves \opt{latex}, \opt{dvips}, and \opt{ps2pdf}. Of
%   course there are several alternative ways to compile your
%   documents.\fnurl{http://tug.org/PSTricks/main.cgi?file=pdf/pdfoutput} 
% \fi
%
% \ifGERMAN
%   \section{Verbreitung und Installation}
%   Dieses Paket ist auf
%   CTAN\fnurl{http://mirror.ctan.org/help/Catalogue/entries/pst-optexp.html}
%   erhältlich und in \TeX Live and MiK\TeX{} enthalten.
% 
%   Das \LPack{pst-optexp}-Paket umfasst die zwei Hauptdateien
%   \texttt{pst-optexp.ins} und \texttt{pst-optexp.dtx}. Durch Aufrufen
%   von \texttt{tex pst-optexp.ins} werden die beiden folgenden
%   Dateien erzeugt:
%   \begin{itemize}
%   \item \texttt{pst-optexp.pro}: die Postscript Prologdatei
%   \item \texttt{pst-optexp.sty}: die \LaTeX{} Stildatei
%   \end{itemize}
%   Speichern Sie diese Dateien in einem Verzeichnis der Teil Ihres
%   lokalen \TeX-Baums ist.
% 
%   Vergessen Sie nicht \texttt{texhash} aufzurufen um den Baum zu
%   aktualisieren. MiK\TeX{}-Benutzer müssen die Dateinamen-Datenbank
%   (FNDB) aktualisieren.
% 
%   Detailliertere Information finden Sie in der Dokumentation Ihrer
%   \LaTeX-Distribution über die Installation in den lokalen
%   \TeX{}-Baum.
% \fi
% \ifENGLISH
%   \section{Distribution and installation}
%   This package is available on
%   CTAN\fnurl{http://mirror.ctan.org/help/Catalogue/entries/pst-optexp.html} and
%   is included in \TeX Live and MiK\TeX.
% 
%   The \LPack{pst-optexp} package consists of the two main files
%   \texttt{pst-optexp.ins} and \texttt{pst-optexp.dtx}. By running \texttt{tex
%   pst-optexp.ins} the following derived files are generated:
%   \begin{itemize}
%   \item \texttt{pst-optexp.pro}: the Postscript prolog file
%   \item \texttt{pst-optexp.sty}: the \LaTeX{} style file
%   \end{itemize}
%   Save the files in a directory which is part of your local \TeX{} tree.
% 
%   Do not forget to run \texttt{texhash} to update this tree. For MiK\TeX{}
%   users, do not forget to update the file name database (FNDB).
% 
%   For more detailed information see the documentation of your personal
%   \LaTeX{} distribution on installing packages to your local \TeX{}
%   system.
% \fi
%
% \ifGERMAN\section{Lizenz}\fi
% \ifENGLISH\section{License}\fi
% \ifGERMAN
% Es wird die Erlaubnis gewährt, dieses Dokument zu kopieren, zu verteilen
% und\slash oder zu modifizieren, unter den Bestimmungen der \LaTeX{} Project
% Public License, Version
% 1.3c.\fnurl{http://www.latex-project.org/lppl.txt}. Dieses
% Paket wird vom Autor betreut (author-maintained).
% \fi
% \ifENGLISH
% Permission is granted
% to copy, distribute and\slash or modify this software under the terms of the
% \LaTeX{} Project Public License, version
% 1.3c.\fnurl{http://www.latex-project.org/lppl.txt} This
% package is author-maintained.
% \fi
%
% \ifGERMAN
%   \section{Abwärtskompatibilität}
% \fi
% \ifENGLISH
%   \section{Backward compatibility}
% \fi 
% \ifGERMAN In Version 3.0 wurde dem Paket erheblich fortgeschrittenere
%   Funktionalität hinzugefügt, die es zu schwierig machte zur
%   Vorgängerversion 2.1 vollständig abwärtskompatibel zu
%   bleiben. Insbesondere war die Funktionsweise des \Lcs{drawbeam}
%   Makros grundlegend falsch konzipiert, so dass ein Wechsel zur neuen
%   Funktionalität so schnell wie möglich erfolgen sollte.
%
%   Eine genauere Zusammenstellung der nicht-kompatiblen Änderungen und Hinweise
%   zur Migration von älteren Dokumenten finden Sie in \prettyref{sec:bwd-comp}.
% \fi
% \ifENGLISH
% Version 3.0 introduced a lot of advanced features which made it too difficult
% to maintain full backward compatibility with version 2.1. Especially the
% \Lcs{drawbeam} macro was broken by design, so that it was best to drop the old
% flaw as early as possible.
%
% You find a more detailled list of changes and information for migration of old
% documents in \prettyref{sec:bwd-comp}.
% \fi
%
% \section{Notation}\label{sec:notation}
% \ifGERMAN
% Die meisten Parametertypen, die im Laufe des Dokuments verwendet werden, sind
% selbsterklärend, andere bedürfen einer genaueren Erläuterung (z.B. der
% Unterschied zwischen \prm{num} und \prm{psnum}). \prettyref{tab:paramref}
% erklärt die geläufigsten Typen.
% \fi
% \ifENGLISH
% Often the parameter types are self-explanatory, but in some cases a clear
% distinction is needed, e.g. between \prm{num} and
% \prm{psnum}. \prettyref{tab:paramref} explains some commonly used types.
% \fi
%
% \begin{table}\centering
% \begin{tabularx}{0.9\linewidth}{>{\itshape}lX} \toprule
%   Name & \ifENGLISH description\fi\ifGERMAN Beschreibung\fi\\ \midrule
%   num & \ifENGLISH float number\fi\ifGERMAN Gleitkommazahl\fi \\ 
%   psnum & \ifENGLISH Postscript code which evaluates to a number\fi
%           \ifGERMAN Postscript-Kode der zu einer Zahl auswertet\fi\\
%   int & \ifENGLISH integer number\fi\ifGERMAN Ganzzahl\fi\\ 
%   dimen & \ifENGLISH dimension\fi\ifGERMAN Länge\fi\\
%   psstyle & \ifENGLISH custom graphics parameter configuration defined with \Lcs*{newpsstyle}\fi
%             \ifGERMAN Benutzerdefinierte Parameterkonfiguration definiert mit \Lcs*{newpsstyle}\fi\\
%   refpoint & \refpointexplanation\\ \bottomrule
% \end{tabularx}
% \ifGERMAN
% \caption{Parametertypen die in den Parameterdefinitionen verwendet werden.}
% \fi
% \ifENGLISH
% \caption{Parameter types used in the parameter reference.}
% \fi
% \label{tab:paramref}
% \end{table}
% 
% \ifGERMAN
%   \section{Danksagung}
% \fi
% \ifENGLISH
%   \section{Acknowledgements}
% \fi
% \ifGERMAN
% Ich danke allen Aktiven auf der PSTricks-Mailingliste für ihre Hilfe,
% insbesondere Herbert Voß. Mein Dank gilt ebenfalls unterschiedlichen
% Paketautoren, von denen ich Code kopiert und viel gelernt habe: David
% Carlisle, Florent Chervet, Enrico Gregorio, Rolf Niepraschk und Heiko
% Oberdiek. Christine Römer hat mich mit ihrem Artikel in der
% DTK\footnote{Pakete in Deutsch dokumentieren. in Die TeXnische
% Komödie. Heft 2/2011, S. 28-35.} überzeugt, ebenfalls eine deutsche
% Dokumentation bereitzustellen. Der Dokumentationsstil ist eine
% Mischung aus der \opt{pst-doc} Klasse (Herbert Voß) und dem
% \opt{ltxdockit} Paket für die \opt{biblatex} Dokumentation (Philipp
% Lehmann).
% \fi
% \ifENGLISH
% I thank all the people of the PSTricks mailinglist for the continuous
% help, especially Herbert Voß. Thanks also to various package authors
% from which I learned and adopted code for this package: David
% Carlisle, Florent Chervet, Enrico Gregorio, Rolf Niepraschk and Heiko
% Oberdiek. Christine Römer convinced me with her article in the german
% DTK\footnote{Pakete in Deutsch dokumentieren. in Die TeXnische
% Komödie. Heft 2/2011, S. 28-35.} to provide a german translation of
% the documentation. The documentation style is a mixture of the
% \opt{pst-doc} class (Herbert Voß) and the \opt{ltxdockit} package for
% the \opt{biblatex} documentation (Philipp Lehman).
% \fi
%
% \ifGERMAN
% \chapter{Grundlegende Ideen}
% \fi
% \ifENGLISH
%   \chapter{Basic ideas}
% \fi\label{chap:basics}
%
% \ifGERMAN Dieses Kapitel zeigt die grundlegenden Ideen und Konzepte, die in
% diesem Paket stecken. Anhand von elementaren Beispielen werden die
% Grundfunktionen wie Ausrichtung, Positionierung (\ref{sec:intro-comp}) und
% Beschriftung (\ref{sec:intro-label}) von Komponenten beschrieben. Anschließen
% wird deren Verbindung mit Strahlen (\ref{sec:intro-beam}) oder Fasern
% (\ref{sec:intro-fiber}) vorgestellt. 
%
% In \prettyref{sec:step-by-step} wird Schritt für Schritt die angedachte
% Vorgehensweise für das Erstellen von umfassenden Experimentskizzen
% erläutert. Eine vollständige Referenz aller Makros und deren Parameter finden
% Sie in \prettyref{chap:generalparam}--\ref{chap:custom}.
%
% Ein Versuchsaufbau besteht aus Komponenten, die anhand ihrer Referenzknoten
% positioniert, verschoben und gedreht werden können und optional eine
% Beschriftung erhalten. Anschließen werden die Komponenten mit Lichtstrahlen
% oder Fasern verbunden.
% \fi
% \ifENGLISH
% This chapter shows the basic ideas and concepts of this package. Starting with
% simple examples, basic functionality such as alignment, positioning
% (\ref{sec:intro-comp}) and labelling (\ref{sec:intro-label}) of components is
% presented. Following, the connection of components with beam rays
% (\ref{sec:intro-beam}) or fiber (\ref{sec:intro-fiber}) is demonstrated.
%
% In \prettyref{sec:step-by-step} several propositions for preparing large
% experimental sketches are illustrated step by step. For a complete reference
% of all macros and their parameters, see
% \prettyref{chap:generalparam}--\ref{chap:custom}.
%
% A drawing consists of components, which can be positioned, shifted and rotated
% based on their reference nodes, and may have an optional label. Then, the
% components are connected with beam rays or fibers.
% \fi
%
% \ifGERMAN\section{Die Komponenten}\fi
% \ifENGLISH\section{The components}\fi
% \label{sec:intro-comp}
%
% \ifGERMAN Eine Komponente wird anhand der Knoten, die bei ihrere Definition
% angegeben werden -- den Referenzknoten -- platziert. Im folgenden Beispiel
% wird eine Linse mittig auf die Verbindungslinie zwischen den Knoten
% \prm{A} und \prm{B} gesetzt: 
% \fi
% \ifENGLISH
% A component is positioned according to the nodes which are used for its
% definition---the reference nodes. In the following examples, the lens is
% placed centered between nodes \prm{A} and \prm{B}:
% \fi
%\iffalse
%<*ignore>
%\fi
\begin{LTXexample}[linerange={1-3,6-6}]
\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
  \pnodes(0,1){A}(3,1){B}
  \lens(A)(B)
  \psset{style=Refline}\color{Refline}
  \psdot(A)\uput[90](A){A}\psdot(B)\uput[90](B){B}
\end{pspicture}
\end{LTXexample}
%\iffalse
%</ignore>
%\fi 
%
% \ifGERMAN
% Diese Positionierung kann anhand von unterschiedlichen Parametern, wie
% z.B. \Lkeyword{abspos} beinflusst werden (siehe dazu
% \prettyref{sec:positioning} und \prettyref{sec:rotshift}). Im
% folgenden Beispiel wird die Linse \opt{0.5} Einheiten vom Knoten
% \prm{A} entfernt platziert, die Box sitzt am Ende der Referenzlinie
% $\overline{AB}$.
% \fi
% \ifENGLISH
% This position can be changed with a number of parameters, such as
% \Lkeyword{abspos} (see \prettyref{sec:positioning} and
% \prettyref{sec:rotshift}). In the next example, the lens is positioned
% \opt{0.5} units apart from node \prm{A}, the box is placed at the end
% of the reference line $\overline{AB}$.
% \fi
%\iffalse
%<*ignore>
%\fi
\begin{LTXexample}[morekeywords={[21]{abspos, position}}, linerange={1-4,7-7}]
\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
  \pnode(0,1){A}\pnode(1.5,1){B}
  \lens[abspos=0.5](A)(B)
  \optbox[position=end](A)(B)
  \psset{style=Refline}\color{Refline}
  \psdot(A)\uput[90](A){A}\psdot(B)\uput[135](B){B}
\end{pspicture}
\end{LTXexample}
%\iffalse
%</ignore>
%\fi 
%
% \ifGERMAN Die Komponenten lassen sich allgemein in zwei Kategorien
% unterteilen: Faser- und Freistrahlkomponenten. Diese unterscheiden sich in
% erster Linie bezüglich ihrer Verbindungsmöglichkeiten: Freistrahlkomponenten
% können sowohl mit Lichtstrahlen als auch mit Fasern verbunden werden,
% wohingegen Faserkomponenten nur Faserverbindungen erlauben.
% \fi
% \ifENGLISH
% The components can be divided in two categories: free-ray and fiber
% components. These differ only in their connection possibilities: Free-ray
% components can have fiber or free-ray connections, whereas fiber components
% support fiber connections only.
% \fi
%
% \ifGERMAN\section{Beschriftungen}\fi
% \ifENGLISH\section{Labels}\fi
% \label{sec:intro-label}
%
% \ifGERMAN Jede Komponente kann optional eine Beschriftung erhalten, die
% relativ zur Komponente platziert wird.
% \fi
% \ifENGLISH Every component can have an optional label, which is positioned
% relative to the component.
% \fi
%\iffalse
%<*ignore>
%\fi
\begin{LTXexample}[morekeywords={[21]{labelangle, labelref, labeloffset}}, linerange={1-5,8-8}]
\begin{pspicture}[showgrid](0,-0.3)(3,3.3)
  \pnode(0,2.5){A}\pnode(2,2.5){B}\pnode(2,1.5){C}
  \mirror[labelangle=-45](A)(B)(C){M}
  \optbox[position=start, labeloffset=0, labelref=relative](C)(B){box}
  \drawbeam(A){1}{2}
  \psset{style=Refline}\color{Refline}
  \psdot(A)\uput[90](A){A}\psdot(B)\uput[-135](B){B}\psdot(C)\uput[45](C){C}
\end{pspicture}
\end{LTXexample}
%\iffalse
%</ignore>
%\fi 
%
% \ifGERMAN\section{Freistrahl-Verbindungen}\fi
% \ifENGLISH\section{Free-ray connections}\fi
% \label{sec:intro-beam}
%
% \ifGERMAN
% Freistrahlkomponenten können mit Lichtstrahlen verbunden werden, deren Weg mit
% Raytracing berechnet werden kann. Da es sich um ein Paket zum
% \emph{Skizzieren} experimenteller Aufbauten handelt, werden hier trotz der
% realistischen Berechnungen viele Möglichkeiten offen gehalten den Strahlengang
% zu manipulieren.
%
% Im einfachsten Fall wird eine einzelne Linie gezeichnet, deren optischer Weg
% über den Brechungsindex \Lkeyword{n} und das Snelliussche Brechungsgesetz
% bestimmt wird.
%
% Das Beispiel zeigt zwei Strahlen, die mit unterschiedlichen Anfangsbedingungen
% auf die Linse treffen, der rote Strahl startet mit einem Abstand von \opt{0.2}
% von der optischen Achse (\Lkeyword{beampos}) und wird entsprechend von der
% Linse abgelenkt.
% \fi
% \ifENGLISH
% Free-ray components can be connected with beam rays, which path can be
% calculated by raytracing. Besides the realistic tracing possibilities, there
% are many ways to manipulate the beam paths because you are dealing with a
% package for \emph{sketching} experimental setups.
%
% In the simplest case a single line is drawn, which optical path is determined
% by the refractive index \Lkeyword{n} and Snell's law.
%
% The example shows two beams which hit the lens with different initial
% conditions. The red beam starts at a distance of \opt{0.2} from the optical
% axis (\Lkeyword{beampos}) and is deflected by the lens accordingly.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-5,8-8}]
\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
  \pnode(0,1){A}\pnode(3,1){B}
  \lens[n=2, lensradius=2 2, lensheight=1.5](A)(B)
  \drawbeam(A){1}(B)
  \drawbeam[beampos=0.4, linecolor=red](A){1}(B)
  \psset{style=Refline}\color{Refline}
  \psdot(A)\uput[-90](A){A}\psdot(B)\uput[90](B){B}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Die Strahlen können mit beliebigen Strichlierungen und Pfeilen
% dekoriert werden.
% \fi
% \ifENGLISH The beams can be decorated with arbitrary dashs and arrows.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-4,7-7}]
\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
  \pnode(0,1){A}\pnode(3,1){B}
  \lens[n=2, lens=2 2 1.5](A)(B)
  \drawbeam[beamangle=10, ArrowInside=->, arrows=-|, beaminside=false](A){1}(B)
  \psset{style=Refline}\color{Refline}
  \psdot(A)\uput[90](A){A}\psdot(B)\uput[-90](B){B}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Ebenfalls können ausgedehnte Strahlen gezeichnet werden deren
% Randstrahlen mit \Lkeyword*{linestyle} etc. und deren Füllung über
% \Lkeyword*{fillstyle} geändert werden können.
% \fi
% \ifENGLISH You can also draw wide beams. The marginal rays can be changed with
% \Lkeyword*{linestyle} etc. and the filling with \Lkeyword*{fillstyle} etc.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-5,8-8}]
\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
  \pnode(0.5,1){A}\pnode(3,1){B}
  \optbox[position=start, optboxsize=0.5 1](A)(B)
  \lens[n=2](A)(B)
  \drawwidebeam[beamwidth=0.2, fillstyle=solid, fillcolor=green!40]{1-2}(B)
  \psset{style=Refline}\color{Refline}
  \psdot(A)\uput[45](A){A}\psdot(B)\uput[135](B){B}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Die Strahlen können auch hinter die Komponenten gelegt werden. Dafür
% müssen alle beteiligten Komponenten und Strahlen in eine
% \Lenv{optexp}-Umgebung gepackt werden (vergleiche das folgende Beispiel mit
% dem vorangegangenen).
% \fi
% \ifENGLISH The beams can also lay behind the components. For this you must
% enclose all respective components and rays in a \Lenv{optexp} environment
% (compare the previous example with the following one).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}[showgrid](0,-0.3)(3,2.3)
  \pnode(1.5,1){A}\pnode(3,1){B}
  \begin{optexp}
    \optbox[position=start](A)(B)
    \lens[n=2](A)(B)
    \drawwidebeam[beamwidth=0.2, fillstyle=solid, fillcolor=green!40]{1}{2}(B)
  \end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\section{Faserverbindungen}\fi
% \ifENGLISH\section{Fiber connections}\fi
% \label{sec:intro-fiber}
%
% \ifGERMAN
% Eine andere Möglichkeit, Komponenten zu verbinden, sind Fasern
% (\Lcs{drawfiber}). Hiermit bestehen weitreichende Möglichkeiten die Fasern
% automatisch an die Komponentenausrichtung anzupassen.
% \fi
% \ifENGLISH
% Fibers (\Lcs{drawfiber}) are another possibility of connecting
% components. Here, you have several way of automatically adapting the fiber
% connection to the component alignment.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}[showgrid](0,-0.3)(3,3.3)
  \pnode(1,2.5){A}\pnode(2.5,1){B}
  \psset{optboxsize=1 0.6}
  \optbox[position=start](A)(B|A)
  \optbox[position=end](B|A)(B)
  \drawfiber{1}{2}
  \drawfiber[linecolor=blue, ncurv=1.2]{1}{2}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Üblicherweise werden Fasern mit einer \Lcs*{nccurve}-Verbindung
% gezeichnet, jede andere Knotenverbindung ist aber ebenfalls möglich
% (\Lkeyword{fiberstyle}).
% \fi
% \ifENGLISH Usually, the fibers are drawn as \Lcs*{nccurve} connections, other
% node connections are possible as well (\Lkeyword{fiberstyle}).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}[showgrid](0,-0.3)(3,3.3)
  \pnode(1,2.5){A}\pnode(2.5,1){B}
  \psset{optboxsize=1 0.6}
  \optbox[position=start](A)(B|A)
  \optbox[position=end](B|A)(B)
  \drawfiber[fiberstyle=angle, linearc=0.5]{1}{2}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \newpage
% \ifGERMAN\section{Schritt-für-Schritt-Beispiele}\fi
% \ifENGLISH\section{Step-by-step examples}\fi
% \label{sec:step-by-step}
%
% \ifGERMAN
% \subsection{Freistrahlaufbau}
% In diesem ersten Beispiel werden alle Komponenten auf eine Verbindungslinie
% verteilt und mit einem Strahl verbunden.
%
% Zuerst werden Anfangsknoten \prm{A} und Endknoten \prm{B} definiert. Die erste
% \Lcomp{optbox} wird an den Anfang platziert, die Wellenplatte und der
% Polarisator werden innerhalb der Verbindungslinie positioniert. Der Parameter
% \Lkeyword{position} erwartet Werte zwischen \opt{0} und \opt{1}, die relativ
% zur Länge der Verbindungslinie sind, oder \opt{start}/\opt{end}. Der Detektor
% wird immer an das Ende der Linie gesetzt.
%
% Zuletzt werden alle Komponenten mit einem einfachen Lichtstrahl verbunden.
% \fi
% \ifENGLISH
% In this first example, all components are distributed on a single line and
% connected with a beam.
%
% First we define the start node \prm{A} and the stop node \prm{B}. The first
% \Lcomp{optbox} is positioned at the start, the wave plate and the polarizer are
% positioned between the nodes. The parameter \Lkeyword{position} expects a
% value between \opt{0} and \opt{1} which is relative to the length of the
% reference line, or \opt{start}/\opt{end}. The detector is always positioned at
% the end of its reference line.
%
% Finally, all components are connected with a simple beam ray.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-7,10-10}]
\begin{pspicture}[showgrid](4,2)
  \pnode(1,1){A}\pnode(3,1){B}
  \optbox[position=start, optboxwidth=1.2, labeloffset=0](A)(B){Laser}
  \optretplate[position=0.3](A)(B){$\nicefrac{\lambda}{2}$}
  \optplate[position=0.7](A)(B){pol}
  \optdetector[dettype=diode](A)(B){PD}
  \drawbeam{1}{2}{3}{4}
  \psset{style=Refline, dotscale=1.5}\psdot(A)\psdot(B)
  \uput[45](A){\color{Refline}A}\uput[135](B){\color{Refline}B}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\subsection{Galilei-Fernrohr}\fi
% \ifENGLISH\subsection{Galilean telescope}\fi
%
% \ifGERMAN 
% Im Folgenden wird ein sehr einfacher Aufbau mit einer konkaven und
% einer konvexen Linse schrittweise erläutert.
%
% Zuerst werden die Referenzknoten \prm{A} und \prm{B} definiert, die für die
% Ausrichtung der Komponenten verwendet werden. Zur besseren Übersicht werden
% beide Knoten gekennzeichnet, desweiteren dient ein Koordinatengitter der
% Orientierung.
%
% Die erste Linse soll konkav gekrümmte Grenzflächen haben. Mit
% \Lkeyword{lensradius} werden die Radien der linken und rechten Fläche auf
% negative Werte gesetzt, was eine konkave Krümmung ergibt. Die Linse wird mit
% \Lkeyword{abspos} eine Einheit vom \prm{A}-Knoten entfernt positioniert.
% \fi
% \ifENGLISH
% This example describes a simple setup with a concave and a convex lens and the
% raytracing through them.
%
% First, we define the reference nodes \prm{A} and \prm{B} which are used for
% alignment of the components. For better overview, these nodes are highlighted
% and a grid is drawn.
%
% The first lens should have concave interfaces. With \Lkeyword{lensradius} the
% interface radii are set to negative values, which correspond to concave
% curvatures. With \Lkeyword{abspos} the lens is positioned one unit from
% \prm{A} node.
% \fi
% \iffalse
%<*ignore>
% \fi
\begingroup
\catcode`\*=13
\def*{}%
\begin{LTXexample}[style=example, linerange={1-4,6-6}]
*\ON*\begin{pspicture}[showgrid](0,-0.3)(5,2.3)
  \pnode(0,1){A}\pnode(3.5,1){B}*\OFF*
  \lens[lensradius=-0.7,
          abspos=1](A)(B){concave}*\ON*
  \psset{style=Refline}\psdot(A)\psdot(B)
\end{pspicture}*\OFF*
\end{LTXexample}
\endgroup
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Die zweite Linse bekommt eine konvexe Krümmung (\Lkeyword{lensradius}
% ist positiv) und wird \opt{2.6} Einheiten von \prm{A}
% positioniert. Die Linsenhöhe wird mit \Lkeyword{lensheight}
% eingestellt.
% \fi
% \ifENGLISH
% The second lens has a convex curvature (\Lkeyword{lensradius} is positive) and
% is positioned \opt{2.6} units apart from \prm{A}. Parameter
% \Lkeyword{lensheight} sets the total height of the lens.
% \fi
% \iffalse
%<*ignore>
% \fi
\begingroup
\catcode`\*=13
\def*{}%
\begin{LTXexample}[style=example, linerange={1-6,9-9}]
*\ON*\begin{pspicture}[showgrid](0,-0.3)(5,2.3)
  \pnode(0,1){A}\pnode(3.5,1){B}
  \lens[lensradius=-0.7, 
          abspos=1](A)(B){concave}*\OFF*
  \lens[lensradius=2.3, lensheight=1.3, 
          abspos=2.6](A)(B){convex}*\ON*
  \psset{style=Refline}\psdot(A)\psdot(B)
  \uput[45](A){\color{Refline}A}\uput[135](B){\color{Refline}B}
\end{pspicture}*\OFF*
\end{LTXexample}
\endgroup
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Die Lichtstrahlen sollen auf einer CCD-Kamera enden, die mit einer
% \Lcomp{optbox} gezeichnet wird. Mit \Lkeyword{position}\opt{=end} wird die Box
% ans Ende der Referenzlinie von \prm{A} nach \prm{B} gesetzt, die
% Beschriftung wird mit \Lkeyword{labeloffset} in die Mitte der Komponente
% gelegt.
% \fi
% \ifENGLISH
% The beam rays are supposed to end at the CCD camera which is drawn as a
% \Lcomp{optbox}. With \Lkeyword{position}\opt{=end} the box is positioned at
% the end of the reference line from \prm{A} to \prm{B}. The label is put at
% the center of the component with \Lkeyword{labeloffset}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begingroup
\catcode`\*=13
\def*{}%
\begin{LTXexample}[style=example, linerange={1-7,10-10}]
*\ON*\begin{pspicture}[showgrid](0,-0.3)(5,2.3)
  \pnode(0,1){A}\pnode(3.5,1){B}
  \lens[lensradius=-0.7,
          abspos=1](A)(B){concave}
  \lens[lensradius=2.3, lensheight=1.3, 
          abspos=2.6](A)(B){convex}*\OFF*
  \optbox[position=end, labeloffset=0](A)(B){CCD}*\ON*
  \psset{style=Refline}\psdot(A)\psdot(B)
  \uput[45](A){\color{Refline}A}\uput[135](B){\color{Refline}B}
\end{pspicture}*\OFF*
\end{LTXexample}
\endgroup
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Zum Schluß wird ein aufgeweiteter Strahl mit einer Strahlbreite von \opt{0.2}
% und ohne anfängliche Divergenz durch die Komponenten geschickt. Der
% Strahlengang wird mittels Raytracing berechnet. Die Linsenparameter in diesem
% Beispiel wurden so gewählt das bei kollimiertem Eingangsstrahl der
% Ausgangsstrahl ebenfalls kollimiert ist.
% \fi
% \ifENGLISH
% Finally, a wide beam with an initial beam width of \opt{0.2} without
% divergence is sent through the components. The beam path is calculated by
% raytracing. The lens parameters in this example were set such, that for a
% collimated input beam also the output beam is collimated.
% \fi
% \iffalse
%<*ignore>
% \fi
\begingroup
\catcode`\*=13
\def*{}%
\begin{LTXexample}[style=example]
*\ON*\begin{pspicture}(5,2)
  \pnode(0,1){A}\pnode(3.5,1){B}
  \lens[lensradius=-0.7, 
          abspos=1](A)(B){concave}
  \lens[lensradius=2.3, lensheight=1.3, 
          abspos=2.6](A)(B){convex}
  \optbox[position=end, labeloffset=0](A)(B){CCD}*\OFF*
  \drawwidebeam[beamwidth=0.2](A){1}{2}{3}*\ON*
\end{pspicture}*\OFF*
\end{LTXexample}
\endgroup
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Das Aussehen des Lichtstrahls wird über den \Lstyle{Beam}-Stil
% eingestellt, und kann z.B. mit einer halbtransparenten Füllung
% versehen werden.
% \fi
% \ifENGLISH
% The appearance of the beam can be changed via the \Lstyle{Beam} style, and may
% have e.g. a semitransparent fill pattern.
% \fi
% \iffalse
%<*ignore>
% \fi
\begingroup
\catcode`\*=13
\def*{}%
\begin{LTXexample}[style=example, label=ex:galileo, caption={caption}]
*\ON*\begin{pspicture}(5,2)
  \pnode(0,1){A}\pnode(3.5,1){B}
  \lens[lensradius=-0.7, 
          abspos=1](A)(B){concave}
  \lens[lensradius=2.3, lensheight=1.3, 
          abspos=2.6](A)(B){convex}
  \optbox[position=end, labeloffset=0](A)(B){CCD}*\OFF*
  \addtopsstyle{Beam}{fillstyle=solid, 
    fillcolor=green, opacity=0.2}
  *\ON*\drawwidebeam[beamwidth=0.2](A){1}{2}{3}
\end{pspicture}*\OFF*
\end{LTXexample}
\endgroup
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\subsection{Faseraufbau}\fi
% \ifENGLISH\subsection{Fiber setup}\fi
% \label{sec:fiber-setup}
%
% \ifGERMAN
% Dieses Beispiel zeigt, wie ein faseroptischer Aufbau mit automatisch
% gezeichneten Faserverbindungen konstruiert werden kann.
%
% Auch hier werden die Referenzknoten zur besseren Orientierung
% eingezeichnet. Im Gegensatz zum vorhergehenden Beispiel benötigen wir
% mehr Referenzknoten, da die Faserkomponenten direkt mit diesen
% verbunden werden.
%
% Der Laser wird wieder an den Anfang gesetzt. Der Abstand
% der Beschriftung wird mit dem Parameter \Lkeyword{label} eingestellt,
% mit dem alle Beschriftungsparameter gesammelt eingestellt werden
% können. Da eine \Lcomp{optbox} sowohl als Freistrahl- als auch als
% Faserkomponente verwendet werden kann, wird in der Standardeinstellung
% keine Faser gezeichnet, was mit \Lkeyword{fiber} geändert werden
% kann. Die Breite dieser und aller folgenden \Lcomp{optbox} wird auf
% \opt{0.7} geändert.
% \fi
% \ifENGLISH
% This example shows how to setup a fiber drawing with automatic fiber
% connections.
%
% Again, the reference nodes are shown for better orientation. In contrast to
% the previous example, here, we need more reference nodes because the
% components are connected directly with them.
%
% The laser is set at the start. The label offset is set with the
% \Lkeyword{label} parameter, which would allow setting all label parameters at
% once. A \Lcomp{optbox} is originally a free-ray component, so that for it the
% fiber connection must be enabled with \Lkeyword{fiber}. The width of all
% \Lcomp{optbox} is changed to \opt{0.7}.
% \fi
% \iffalse
%<*ignore>
% \fi
% \begingroup
% \catcode`\*=13
% \def*{}%
\begin{LTXexample}[style=example, linerange={1-4,6-6}]
*\ON*\begin{pspicture}[showgrid](4.7,2)
  \pnodes(0.7,1){A}(1,1){B}(2.8,1){C}(4,1.5){D}(4,0.5){E}*\OFF*
  \psset{optboxwidth=0.7, labelstyle=\scriptsize}
  \optbox[position=start, label=0, fiber](A)(B){LD}*\ON*
  \psset{style=Refline}\psdot(A)\psdot(B)\psdot(C)\psdot(D)\psdot(E)
\end{pspicture}*\OFF*
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Als nächstes wird ein Mach-Zehnder-Modulator ohne Beschriftung gezeichnet, der
% automatisch mit Fasern mit seinen Referenzknoten verbunden wird.
% \fi
% \ifENGLISH The Mach--Zehner modulator is drawn without label and connected
% automatically with fibers to its reference nodes.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[style=example, linerange={1-5,7-7}]
*\ON*\begin{pspicture}[showgrid](4.7,2)
  \pnodes(0.7,1){A}(1,1){B}(2.8,1){C}(4,1.5){D}(4,0.5){E}
  \psset{optboxwidth=0.7, labelstyle=\scriptsize}
  \optbox[position=start, label=0, fiber](A)(B){LD}*\OFF*
  \optmzm(B)(C)*\ON*
  \psset{style=Refline}\psdot(A)\psdot(B)\psdot(C)\psdot(D)\psdot(E)
\end{pspicture}*\OFF*
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Danach wird ein Faserkoppler mit einem Eingang und zwei Ausgängen
% gezeichnet. Der Koppler wird zwischen dem Eingangsknoten und dem
% Mittelpunkt der beiden Ausgangsknoten ausgerichtet. 
% \fi
% \ifENGLISH Then, we draw a fiber coupler with one input and two output
% fibers. The coupler is positioned between the input node and the center of the
% two output nodes.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[style=example, linerange={1-6,8-8}]
*\ON*\begin{pspicture}[showgrid](4.7,2)
  \pnodes(0.7,1){A}(1,1){B}(2.8,1){C}(4,1.5){D}(4,0.5){E}
  \psset{optboxwidth=0.7, labelstyle=\scriptsize}
  \optbox[position=start, label=0, fiber](A)(B){LD}
  \optmzm(B)(C)*\OFF*
  \wdmsplitter(C)(D)(E){50\%}*\ON*
  \psset{style=Refline}\psdot(A)\psdot(B)\psdot(C)\psdot(D)\psdot(E)
\end{pspicture}*\OFF*
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN 
% An die Enden des Kopplers wird ein optischer Spektrumanalysator (OSA)
% und eine Leistungsmessgerät (PD) gesetzt. Der \Lcomp{optdetector} wird
% nach Voreinstellung ans Ende der Referenzlinie gesetzt
% (\Lkeyword{position}\opt{=end}). Diese beiden Komponenten werden ohne
% weitere Einstellungen ohne Faserverbindungen gezeichnet. Das passt, da
% ihre jeweiligen Endpunkte mit den Ausgängen des Kopplers
% zusammenfallen.
%
% Die Schreibweise \opt{(A|E)} nimmt die $x$-Koordinate von \prm{A} und die
% $y$-Koordinate von \prm{E}.
% \fi
% \ifENGLISH
% At the ends of the coupler we put an optical spectrum analyzer (OSA)
% and a power meter (PD). The \Lcomp{optdetector} is set by default at the
% end of the reference line, it has \Lkeyword{position} preset to
% \opt{end}. These two components are drawn without fibers, because
% their end nodes coincide with the two outputs of the coupler.
%
% The notation \opt{(A|E)} uses the $x$-coordinate of \prm{A} and the
% $y$-coordinate of \prm{E}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[style=example, caption={caption}, label={ex:fiber-setup}, linerange={1-8,10-10}]
*\ON*\begin{pspicture}[showgrid](4.7,2)
  \pnodes(0.7,1){A}(1,1){B}(2.8,1){C}(4,1.5){D}(4,0.5){E}
  \psset{optboxwidth=0.7, labelstyle=\scriptsize}
  \optbox[position=start, label=0, fiber](A)(B){LD}
  \optmzm(B)(C)
  \wdmsplitter[abspos=0.3, label=0.4](C)(D)(E){50\%}*\OFF*
  \optbox[position=end, label=0](A|D)(D){OSA}
  \optdetector(A|E)(E){PD}*\ON*
  \psset{style=Refline}\psdot(A)\psdot(B)\psdot(C)\psdot(D)\psdot(E)
\end{pspicture}*\OFF*
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\subsection{Faseraufbau (Alternative)}\fi
% \ifENGLISH\subsection{Fiber setup (alternative)}\fi
%
% \ifGERMAN
% Dieses Beispiel ist vom Ergebnis her identisch mit dem vorangegangenen
% (\prettyref{ex:fiber-setup}), wird aber anders angegangen.
%
% Hier verwenden wir nicht die automatischen Faserverbindungen sondern zeichnen,
% wie bei Freistrahlaufbauten, zuerst die Komponenten und verbinden diese zum
% Schluß explizit mit Fasern (\Lcs{drawfiber}). Daher benötigen wir weniger
% Referenzknoten, die Faserverbindungen werden mit \Lkeyword{fiber}\opt{=none}
% global unterdrückt.
%
% Welche Herangehensweise verwendet wird ist meistens Geschmackssache, bei
% Ringstrukturen wie z.B. Faserlasern kann das nachträgliche Verbinden mit
% \Lcs{drawfiber} von Vorteil sein.
% \fi
%
% \ifENGLISH 
% This example has the same result as the previous one
% (\prettyref{ex:fiber-setup}), but is constructed differently.
%
% This time we do not use the automatic fiber connections, but draw all
% components first and connect them afterwards with fibers
% (\Lcs{drawfiber}). This requires less reference nodes, the fiber connections
% are suppressed globally with \Lkeyword{fiber}\opt{=none}.
%
% The choice of the procedure depends on personal preferences, for loop setups,
% like for fiber lasers, it looks better if the fibers are drawn after the
% components with \Lcs{drawfiber}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[caption={caption}, label={ex:fiber-setup-alt}, linerange={1-10,13-13}]
\begin{pspicture}[showgrid](4.9,2)
  \pnode(0.7,1){A}\pnode(4,1){B}
  \psset{optboxwidth=0.7, labelstyle=\scriptsize, fiber=none}
  \optbox[position=start, labeloffset=0](A)(B){LD}
  \optmzm[abspos=1.1](A)(B)
  \wdmsplitter[abspos=2.25, label=0.4](A)(B)(B){50\%}
  \optbox[position=end,label=0, compshift=0.5](A)(B){OSA}
  \optdetector[compshift=-0.5](A)(B){PD}
  \drawfiber{1-4}
  \drawfiber{3}{5}
  \psset{style=Refline}\psdot(A)\psdot(B)
  \color{Refline}\uput[45](A){A}\uput[135](B){B}
\end{pspicture}
\end{LTXexample}
% \endgroup
% \iffalse
%</ignore>
% \fi 
% 
% \ifGERMAN
% \newpage
% \subsection{Michelson-Interferometer}
% \fi
% \ifENGLISH
% \subsection{Michelson-Interferometer}
% \fi
%
% \ifGERMAN
% In diesem Beispiel werden neben Linsen auch reflektierende Elemente
% (Spiegel) eingesetzt sowie Elemente, die sowohl transmittieren als
% auch reflektieren (Strahlteiler).
% \fi
% \ifENGLISH
% In this example we use lenses, reflective elements (mirrors) and components
% which can be either transmittive or reflective (beamsplitter).
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begingroup
\catcode`\*=13
\def*{}%
\begin{LTXexample}[style=example, hsep=8mm, numbers=left, numberstyle=\footnotesize, caption={caption}, label=ex:michelson]
\begin{pspicture}(3.2,5)
  \pnodes(0,3){A}(1,3){BS}(3,3){M1}(1,5){M2}(1,1){PD}*\label{l:ex2-nodes}*
  \psset{mirrortype=extended, mirrordepth=0.2}*\label{l:ex2-set}*
  \begin{optexp}*\label{l:ex2-begin}*
    \beamsplitter[bsstyle=plate, compname=BS](A)(BS)(PD)*\label{l:ex2-bs}*
    \mirror[compname=M1](BS)(M1)(BS)*\label{l:ex2-m1}*
    \mirror[compname=M2, variable](BS)(M2)(BS)*\label{l:ex2-m2}*
    \lens[compname=L](BS)(PD)*\label{l:ex2-l}*
    \optdetector[compname=Det, dettype=diode](BS)(PD)*\label{l:ex2-det}*
    \addtopsstyle{Beam}{beamwidth=0.2, fillstyle=solid, fillcolor=green!20!white}*\label{l:ex2-style}*
    \drawwidebeam(A){BS}{M1}{BS}{M2}{BS}{L}{Det}*\label{l:ex2-beam}*
  \end{optexp}
\end{pspicture}
\end{LTXexample}
\endgroup
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Wir beginnen wieder, indem wir die Referenzknoten definieren
% (\prettyref{l:ex2-nodes}) und ein paar
% grundlegende Einstellungen setzen (\prettyref{l:ex2-set}).
%
% Dann werden der Reihe nach alle Komponenten platziert
% (\prettyref{l:ex2-bs}--\ref{l:ex2-det}). Die reflektierenden benötigen
% drei Referenzknoten: den Eingangsknoten, den Knoten an dem die
% reflektierende Grenzfläche ist und den Ausgangsknoten. Anschließend
% wird noch das Aussehen des Lichtstrahls festgelegt
% (\prettyref{l:ex2-style}) und der Strahl gezeichnet
% (\prettyref{l:ex2-beam}).
%
% Diese Mal haben wir den Komponenten Namen gegeben (\Lkeyword{compname}) die
% beim Raytracing anstelle der IDs -- der automatisch vergebenen Nummern --
% verwendet werden können. Dies kann die Nachverfolgung des Strahlengangs
% erleichtern.
% 
% Alle Komponenten und Strahlen wurden zusätzlich in eine
% \Lenv{optexp}-Umgebung gekapselt. Innerhalb dieser werden alle
% Lichtstrahlen hinter die Komponenten gelegt, sodass diese nicht
% verdeckt werden.
% \fi
% \ifENGLISH
% We start with definition of the reference nodes
% (\prettyref{l:ex2-nodes}) and setting some basic
% parameters (\prettyref{l:ex2-set}).
%
% Following, all components are positioned
% (\prettyref{l:ex2-bs}--\ref{l:ex2-det}). The reflective ones need three
% reference nodes, the input node, the node where the reflective interface is
% situated, and the output node. Then, the appearance of the beam is set
% (\prettyref{l:ex2-style}), and the beam is drawn (\prettyref{l:ex2-beam}).
%
% In this example, all components have a name (\Lkeyword{compname}), which can
% be used instead of the numerical IDs---automatically assigned, unique
% numbers---for the raytracing. This can simplify follwing the beam path.
%
% All components and beams are enclosed in a \Lenv{optexp} environment. Inside
% of this, all beams are drawn behind the components.
% \fi
%
%
% \ifGERMAN\chapter{Allgemeine Komponentenparameter}\fi
% \ifENGLISH\chapter{General component parameters}\fi
% \label{chap:generalparam}
% 
% \ifGERMAN Dieses Kapitel enthält alle Informationen zu allgemeinen Parametern
% und Konzepten. Das beinhaltet das Setzen von Beschriftungen
% (\ref{sec:labels}), Positionierung (\ref{sec:positioning}), Drehen und
% Verschieben von Komponenten (\ref{sec:rotshift}) und Anpassen der Aussehens
% (\ref{sec:styles} und \ref{sec:appearance}).
% \fi
% \ifENGLISH This chapter introduces generic parameters and concepts such as
% labels (\ref{sec:labels}), positioning (\ref{sec:positioning}), rotating and
% shifting of components (\ref{sec:rotshift}) and changing the appearance of
% components (\ref{sec:styles} and \ref{sec:appearance}).
% \fi
%
% \ifGERMAN\section{Beschriftungen}\fi
% \ifENGLISH\section{Labels}\fi
% \label{sec:labels}
%
% \ifGERMAN Alle Komponenten können mit einer Beschriftung versehen werden,
% deren Position und Ausrichtung genau angepasst werden kann. Die Beschriftung
% ist für jede Komponente optional. Sollten die vielfältigen Parameter nicht
% ausreichend sein, können Sie den Beschriftungsknoten -- in einigen Beispielen
% mit einem roten Punkt gekennzeichnet -- auch direkt verwenden (siehe auch
% \prettyref{sec:labelnode}). 
% \fi
% \ifENGLISH All components may have a label which position and alignment can be
% adjusted at will. The label is optional for every component. If the various
% parameters are not sufficient, you can access the label node---marked as red
% dot in some examples---directly (see also \prettyref{sec:labelnode}).
% \fi 
%
% \begin{optionlist}
% \numitem[0.8]{labeloffset}
% \ifGERMAN Der Abstand des Referenzknotens für die Beschriftung (roter
% Punkt) zur Komponentenmitte (blaues Kreuz).
% \fi
% \ifENGLISH The offset of the label reference node (red dot) from the
% component center (blue cross).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2,6-6}, morekeywords={[21]{labeloffset}}]
\begin{pspicture}(3,1.8)
  \optbox[beam, labeloffset=1](0,1.5)(3,0.8){label}
  \psdot[style=CenterNode](\oenodeCenter{})
  \psdot[linecolor=red](\oenodeLabel{})
  \ncline[arrows=<->, style=Refline, arrowinset=0, arrowscale=1.5]{\oenodeCenter{}}{\oenodeLabel{}}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \valitem{labelstyle}{macros}
% \ifGERMAN Der Schriftstil der Beschriftungen.\fi
% \ifENGLISH The text style that is used to typeset the label.\fi
% 
% \valitem[c]{labelalign}{refpoint}
% \ifGERMAN Definiert die Ausrichtung der Beschriftung bezüglich des
% Beschriftungsknotens.
% \fi
% \ifENGLISH Defines the alignment of the label relative to the label node.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-3,6-6}, morekeywords={[21]{labeloffset, labelalign}}]
\begin{pspicture}(3,1.8)
  \psset{beam, labeloffset=1}
  \optbox[labelalign=bl](0,1.5)(3,0.8){label}
  \psdot[style=CenterNode](\oenodeCenter{})
  \psdot[linecolor=red](\oenodeLabel{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \numitem[0]{labelangle}
% \ifGERMAN
% Der Rotationswinkel des Beschriftungsknotens um die Mitte. Der Nullpunkt hängt
% sowohl von der jeweiligen Komponenten und dem gewählten Referenzsystem ab
% (siehe \Lkeyword{labelref}).
% \fi
% \ifENGLISH
% The rotation angle of the label node around the component center. The origin
% depends both on the component and the choosen reference system (see
% \Lkeyword{labelref}).
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2,4-6,27-27}, morekeywords={[21]{labelangle}}]
\begin{pspicture}(-0.3,0)(2,3.7)
  \psset{labeloffset=1, optboxwidth=1, arrowscale=1.5, arrowinset=0}
  \begin{optexp}
  \optbox[position=end, labelangle=90](1,1)(1,2){Box}
  \beamsplitter[labelangle=-90](1,2)(1,1)(2,1){BS}
  \drawbeam[arrows=->]{1}{2}(2,1)
  \frontlayer{%
    \psdot[style=CenterNode](\oenodeCenter{1})
    \psdot[style=CenterNode](\oenodeCenter{2})
    \psdot[linecolor=red](\oenodeLabel{1})
    \psdot[linecolor=red](\oenodeLabel{2})
  }
  \backlayer{%
    \bgroup
    \psset{style=Refline}
    \psline(\oenodeCenter{2})([offset=-1]\oenodeCenter{2})
    \psline(\oenodeCenter{2})([Xnodesep=-1]\oenodeCenter{2})
    \psarc[arrows=<-](\oenodeCenter{2}){0.7}{180}{270}
    \uput{0.9}[-135](\oenodeCenter{2}){\small $-90$\textdegree}
    \psline(\oenodeCenter{1})([Xnodesep=1]\oenodeCenter{1})
    \psline(\oenodeCenter{1})([offset=1]\oenodeCenter{1})
    \psarc[arrows=->](\oenodeCenter{1}){0.7}{0}{90}
    \uput{0.9}[45](\oenodeCenter{1}){\small $90$\textdegree}
    \egroup
  }
  \end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \choitem[relgrav]{labelref}{relative, relgrav, global, absolute}
% \ifGERMAN
% Wählt das Bezugssystem für \Lkeyword{labelangle} und die Orientierung der
% Beschriftung.
% \fi
% \ifENGLISH
% Set the reference coordinate system for the \Lkeyword{labelangle} and the
% orientation of the label text.
% \fi
%
%   \begin{valuelist}
%   \item[relative] 
%     \ifGERMAN Die Beschriftung ist parallel zu der Referenzlinie der
%     Komponente und der Winkel wird immer auf den Bereich zwischen $-90$° und
%     $+90$° zurückgerechnet.
%     \fi
%     \ifENGLISH The label is parallel to the component reference line and the
%     actual angle is always projected to the range between $-90$° and $+90$°.
%     \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{labelref}}]
\begin{pspicture}(0,-2.2)(2,2.2)
  \psset{position=end, optboxsize=1 0.6, labeloffset=0, labelref=relative}
  \multido{\i=0+45}{8}{%
    \optbox(0,0)(1;\i){\i}
  }
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%   \item[relgrav]
%     \ifGERMAN Die Beschriftung ist immer horizontal, lediglich der
%     Beschriftungsknoten wird zusammen mit der Komponente gedreht.
%     \fi
%     \ifENGLISH The label itself is always horizontal, only the label node is
%     rotated together with the component.
%     \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{labelref}}]
\begin{pspicture}(0,-2.2)(2,2.2)
  \psset{position=end, optboxsize=1 0.6, labelref=relgrav}
  \multido{\i=0+72}{5}{%
    \optbox(0,0)(1;\i){\i}
  }
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%   \item[global, absolute]
%   \ifGERMAN Die Beschriftung ist unabhängig von der Komponentenausrichtung.\fi
%   \ifENGLISH The label is independent of the component alignment.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{labelref}}]
\begin{pspicture}(0,-2.2)(2,2.2)
  \psset{position=end, optboxsize=1 0.6, labelref=global}
  \multido{\i=0+72}{5}{%
    \optbox(0,0)(1;\i){\i}
  }
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{valuelist}
% 
% \optitem{label}{\prm{offset}[ \prm{angle}[ \prm{refpoint}[ \prm{labelref}]]]}
% \ifGERMAN
% Diese Option erlaubt die kompakte Definition mehrerer
% Beschriftungsparameter. Es können bis zu vier Leerzeichen-getrennte
% Argumente übergeben werden (\Lkeyword{labeloffset},
% \Lkeyword{labelangle}, \Lkeyword{labelalign} und
% \Lkeyword{labelref}). Mit einem Punkt kann eine Option übersprungen
% werden.
% \fi
% \ifENGLISH
% Allows compact definition of several label parameters. It takes up to
% four space-separated arguments (\Lkeyword{labeloffset},
% \Lkeyword{labelangle}, \Lkeyword{labelalign}, and
% \Lkeyword{labelref}). Unchanged intermediate arguments can be
% skipped with a dot.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{label}}]
\begin{pspicture}(0,0)(4,3)
  \psset{endbox, beam}
  \optbox[label=0.7](1.5,2.5)(2.5,2.5){box}
  \optbox[label=1 -45](1.5,1)(2.5,1){$-45$}
  \optbox[label=0 . . relative]%
         (0.6,0.6)(0.6,1.6){relative}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \choitem{innerlabel}{true}
% \ifGERMAN Das ist ein Alias für \opt{label=0 .\ c relative}\fi
% \ifENGLISH This is an alias for \opt{label=0 .\ c relative}\fi
% \end{optionlist}
%
%
%
% \ifGERMAN\section{Positionierung}\fi
% \ifENGLISH\section{Positioning}\fi
% \label{sec:positioning}
%
% \ifGERMAN
% Alle Komponenten außer den Freistrahl-Dreipolen können zwischen ihren
% beiden Referenzknoten \Lcs{oenodeRefA} und \Lcs{oenodeRefB}
% positioniert werden.
% \fi
% \ifENGLISH
% All components except for the free-ray tripoles can be positioned between
% their two reference nodes \Lcs{oenodeRefA} and \Lcs{oenodeRefB}.
% \fi
% \begin{optionlist}
%   \choitem{position}{\prm{num},start,end}
%   \ifGERMAN 
%   Ist der Wert eine Zahl, so wird damit die relative Position der Mitte eines
%   Objektes (blaues Kreuz) bezüglich seiner beiden Referenzknoten (schwarze
%   Punkte) gesetzt. Das ist äquivalent zum \Lkeyword*{npos} Parameter von
%   \Lcs*{ncput}, d.h. eine Zahl im Intervall $[0,1]$ (siehe \LPack{pst-node}
%   Dokumentation\fnurl{http://mirror.ctan.org/help/Catalogue/entries/pst-node.html}).
%   \fi
%   \ifENGLISH Controls the relative position of an object center (blue cross)
%   between its two reference points (black dots), if the value is a number. In
%   this case it is equivalent to the \Lkeyword*{npos} parameter of
%   \Lcs*{ncput}, i.e. a number in the range $[0,1]$ (see \LPack{pst-node}
%   documentation\fnurl{http://mirror.ctan.org/help/Catalogue/entries/pst-node.html}).
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{position}}, linerange={1-2,5-5}]
\begin{pspicture}(3,1.5)
  \lens[beam, position=0.8](0,1)(3,1){L}
  \psdot(\oenodeRefA{})\psdot(\oenodeRefB{})
  \psdot[style=CenterNode](\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN 
% Der Wert \opt{start} setzt ein Objekt an den Anfang, \opt{end} ans Ende der
% Referenzlinie, so dass die entsprechende Grenzfläche auf dem Referenzknoten
% (schwarzer Punkt) liegt, und nicht die Mitte des Objektes (blaues Kreuz), wie
% es mit \opt{position=1} bzw. \opt{position=0} der Fall wäre. Unter Verwendung
% von Zahlen wäre dieses Verhalten deutlich schwieriger und weniger flexibel zu
% erreichen, da die Größe und Form des Objektes berücksichtigt werden muss.
% \fi
% \ifENGLISH
% The values \opt{start} and \opt{end} place an object at the start or end of
% the reference line, respectively. The respective object interface is placed on
% the respective reference node (black dot) instead of the object center (blue
% cross) which would be the case for \opt{position=0} or
% \opt{position=1}. Achieving this with numerical values would me more difficult
% and unflexible, because the object size and shape must be taken into account.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{position}}, linerange={1-4,8-8}]
\begin{pspicture}(3,2)
  \pnodes(0.5,1){A}(2.5,1){B}\psdot(A)\psdot(B)
  \optbox[optboxsize=0.5 0.5, position=start](A)(B)
  \lens[position=end](A)(B)
  \psline[style=Refline](A)(B)
  \psdot[style=CenterNode](\oenodeCenter{1})
  \psdot[style=CenterNode](\oenodeCenter{2})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Hier ist im Vergleich dazu die Positionierung mit
% \opt{position=0}/\opt{1}.
% \fi
% \ifENGLISH Here is for comparison the positioning with
% \opt{position=0}/\opt{1}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{position}}, linerange={1-4,8-8}]
\begin{pspicture}(3,2)
  \pnodes(0.5,1){A}(2.5,1){B}\psdot(A)\psdot(B)
  \optbox[optboxsize=0.5 0.5, position=0](A)(B)
  \lens[position=1](A)(B)
  \psline[style=Refline](A)(B)
  \psdot[style=CenterNode](\oenodeCenter{1})
  \psdot[style=CenterNode](\oenodeCenter{2})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \choitem{abspos}{\prm{num},start,end}
% \ifGERMAN
% Eine Zahl setzt die absolute Position eines Objektes auf der
% Referenzlinie. Die Werte \opt{start} und \opt{end} werden identisch wie bei
% \Lkeyword{position} behandelt.
% \fi
% \ifENGLISH
% Controls the absolute position of an object on the reference line. The values
% \opt{start} and \opt{end} are handled identically to \Lkeyword{position}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{abspos}}, linerange={1-2,5-5}]
\begin{pspicture}(3,1.5) 
  \lens[beam, abspos=1](0,1)(3,1){L}
  \psdot(\oenodeRefA{})\psdot(\oenodeRefB{})
  \psdot[style=CenterNode](\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem{endbox}
% \ifGERMAN Dieser Parameter sollte nicht mehr verwendet werden, er ist
% äquivalent zu \Lkeyword{position}\opt{=end}.
% \fi
% \ifENGLISH This parameter should not be used any more, it is
% equivalent to \Lkeyword{position}\opt{=end}.
% \fi
% \end{optionlist}
% 
%
%
% \ifGERMAN\section{Drehen und Verschieben}\fi
% \ifENGLISH\section{Rotating and shifting}\fi
% \label{sec:rotshift}
%
% \ifGERMAN
% Alle Komponenten können versetzt und um verschiedene Bezugspunkte
% gedreht werden. 
%
% Beachten Sie, dass mit den Komponenten auch die Grenzflächenknoten
% (\prettyref{sec:ifcnode}, in den folgenden Beispielen mit blauen Kreuzen
% markiert) transformiert werden, wodurch Verbindungen beinflußt werden. Die
% transformierten Referenzknoten sind als eigene Knoten verfügbar
% (\prettyref{sec:refnode}).
% \fi
% \ifENGLISH 
% All components can be shifted and rotated around different reference nodes.
%
% Please note, that together with the components also their interface nodes
% (\prettyref{sec:ifcnode}, marked as blue crosses in the following examples)
% are transformed, which may impact the connections. The transformed reference
% nodes are accessible as new nodes (\prettyref{sec:refnode}).
% \fi
% 
% \begin{optionlist}
% \psnumitem[0]{angle}
% \ifGERMAN Dreht eine Komponente um den Winkel \prm{num} (in Grad). Die
% Ausgangsposition ist grau gestrichelt eingezeichnet.
% \fi
% \ifENGLISH Rotate a component by an angle \prm{num} (in degree). The original
% position is drawn gray dashed.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2,4-4,10-10}, morekeywords={[21]{angle}}]
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(2.7,1){B}
  \optbox[addtoOptComp={style=Refline, linestyle=dashed}](A)(B)
  \optbox[angle=20, innerlabel](A)(B){box}
  \psline[style=Refline](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psdot[style=CenterNode](\oenodeIn{})
  \psdot[style=CenterNode](\oenodeOut{})
\end{pspicture}
\end{LTXexample}
%\iffalse
%</ignore>
%\fi
%
% \valitem[c]{rotateref}{refpoint}
% \ifGERMAN
% Setzt den Bezugspunkt für die Drehung der Komponente. Bitte lesen Sie
% \prettyref{sec:rotrefnode} für eine genauere Beschreibung und entnehmen Sie
% \prettyref{sec:overview-extnode} die möglichen Bezugspunkte für alle
% Komponenten. Die Ausgangsposition ist grau gestrichelt eingezeichnet.
% \fi
% \ifENGLISH
% Set the reference point for the rotation of the component. Please see
% \prettyref{sec:rotrefnode} for a detailed explanation and
% \prettyref{sec:overview-extnode} for a list of the possible reference nodes of
% all components. The original position is drawn gray dashed.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2,4-4,10-10}, morekeywords={[21]{angle,rotateref}}]
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(2.7,1){B}
  \optbox[addtoOptComp={style=Refline, linestyle=dashed}](A)(B)
  \optbox[angle=20, rotateref=bl, innerlabel](A)(B){box}
  \psline[style=Refline](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psdot[style=CenterNode](\oenodeIn{})
  \psdot[style=CenterNode](\oenodeOut{})
\end{pspicture}
\end{LTXexample}
%\iffalse
%</ignore>
%\fi
%
% \numitem[0]{compshift} 
% \ifGERMAN Verschiebt eine Komponente vertikal bezüglich ihrer Referenzlinie
% (siehe \prettyref{sec:refnode}). Reflektive Komponenten werden entlang der
% reflektiven Grenzfläche verschoben.
% \fi
% \ifENGLISH
% Shift a component perpendicular to its reference line (see
% \prettyref{sec:refnode}). For reflective components it is shifted along the
% reflective interface.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-3,10-10}, morekeywords={[21]{compshift}}]
\begin{pspicture}(4,2)
  \pnodes(0.4, 0.5){A}(3.6,0.5){B}
  \lens[lens=2 2 2, compshift=0.5](A)(B)
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psdot[style=CenterNode](\oenodeIn{})
  \psdot[style=CenterNode](\oenodeOut{})
  \psline[linecolor=DOrange, arrows=|->, arrowscale=1.5, arrowinset=0](\oenodeCenter{}|A)(\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[linerange={1-3,9-9}, morekeywords={[21]{compshift}}]
\begin{pspicture}(4,2) 
  \pnodes(0.4,1.2){A}(3,0.2){B}
  \mirror[compshift=0.5](A)(B|A)(B)
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{}|\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[0](\oenodeRefB{}){RefB}
  \psdot[style=CenterNode](\oenodeIn{})
  \psline[linecolor=DOrange, arrows=|->, arrowscale=1.5, arrowinset=0](B|A)(\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[0]{compoffset}
% \ifGERMAN Verschiebt eine Komponente vertikal bezüglich ihrer
% Referenzlinie (siehe \prettyref{sec:refnode}). Reflektierende
% Komponenten werden entlang der reflektiven Grenzfläche verschoben. Die
% Verschiebung erfolgt also senkrecht zu einer Verschiebung mit
% \Lkeyword{compshift}. Ein Anwendungsbeispiel ist
% \prettyref{ex:autocorrelation}.
% \fi
% \ifENGLISH
% Shift a component perpendicular to its reference line (see
% \prettyref{sec:refnode}). For reflective components it is shifted
% along the reflective interface. The displacement is vertical to a
% displacement with \Lkeyword{compshift}. For an example see
% \prettyref{ex:autocorrelation}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-3,10-10}, morekeywords={[21]{compoffset}}]
\begin{pspicture}(4,2)
  \pnodes(0.4, 1){A}(3.6, 1){B}
  \lens[lens=2 2 2, compoffset=0.5](A)(B)
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psdot[style=CenterNode](\oenodeIn{})
  \psdot[style=CenterNode](\oenodeOut{})
  \psline[linecolor=DOrange, arrows=|->, arrowscale=1.5, arrowinset=0]([Xnodesep=-0.5]\oenodeCenter{})(\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[linerange={1-3,9-9}, morekeywords={[21]{compoffset}}]
\begin{pspicture}(4,2) 
  \pnodes(0.4,1.2){A}(3,0.2){B}
  \mirror[compoffset=0.5](A)(B|A)(B)
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{}|\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[0](\oenodeRefB{}){RefB}
  \psdot[style=CenterNode](\oenodeIn{})
  \psline[linecolor=DOrange, arrows=|->, arrowscale=1.5, arrowinset=0](B|A)(\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \choitem{innercompalign}{rel, relative, abs, absolute}
% \ifGERMAN Ist dieser Parameter auf \opt{absolute} gesetzt, so wird das
% «Innere» einer Komponente nicht mitgedreht. Diese Option wird derzeit
% von \Lcomp{optfilter}, \Lcomp{elecsynthesizer} und \Lcomp{optdipole} verwendet.
% \fi
% \ifENGLISH If this parameter is set to \opt{absolute}, the «inner»
% component part is not rotated with the component. At the moment, this
% option is used by \Lcomp{optfilter}, \Lcomp{elecsynthesizer}, and \Lcomp{optdipole}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
\psset[optexp]{labelangle=-90}
\elecsynthesizer[innercompalign=rel](0.5,1.2)(0.5,2){rel}
\elecsynthesizer[innercompalign=abs](2.5,1.2)(2.5,2){abs}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
%
% \ifGERMAN\section{Verwendung von Stilen}\fi
% \ifENGLISH\section{Using psstyles}\fi\label{sec:styles}
%
% \ifGERMAN
% Stile sind benutzerdefinierte Grafik-Konfigurationen für
% PSTricks-Objekte. Das \LPack{pst-optexp}-Paket macht umfangreichen
% Gebrauch von Stilen um einzelne, logische Bereiche von Komponenten
% flexibel gestalten zu können, was über das optionale Argument meistens
% nicht möglich ist. 
%
% Vorhandene Stile können mit \Lcs*{addtopsstyle} erweitert und mit
% \Lcs*{newpsstyle} überschrieben werden.
%
% Als Beispiel nehmen wir einen \opt{extended} Spiegel und möchten nur
% den «extended»-Teil verändern. Hierfür wird der Stil
% \Lstyle{ExtendedMirror} bereitgestellt:
% \fi
% \ifENGLISH
% Psstyles are custom graphics parameter configurations for PSTricks
% objects. The \LPack{pst-optexp} package makes extensive use of styles
% to facilitate flexible design of single, logical parts of
% components. This is in general not possible with the optional
% argument.
%
% Existing styles can be extended with \Lcs*{addtopsstyle} and
% overwritten with \Lcs*{newpsstyle}.
%
% As example we consider an \opt{extended} mirror and want to change
% only the «extended» part which is controlable with the
% \Lstyle{ExtendedMirror} style:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \addtopsstyle{ExtendedMirror}{hatchcolor=red}
  \mirror[mirrortype=extended, beam](0,0)(2,1.5)(0,2)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \ifGERMAN 
% Die veränderbaren Unterbereiche einer Komponente sind in der
% jeweiligen Referenz zu finden.
% \fi
% \ifENGLISH 
% The changeable parts of each component are listed in the respective
% reference.
% \fi
%
%
%
% \ifGERMAN\section{Aussehen der Komponenten}\fi
% \ifENGLISH\section{Component appearance}\fi
% \label{sec:appearance}
%
% \begin{stylelist}
% \styleitem{OptComp} 
% \ifGERMAN
% Bestimmt das grundlegende Aussehen aller optischen Komponenten. Die
% üblichen Parameter, wie z.B. \opt{linestyle}, würden auch die
% Verbindungen beeinflussen, die mit der Komponente zusammen gezeichnet
% werden (\Lkeyword{beam}, \Lkeyword{fiber} usw.). Mit
% \Lkeyword{newOptComp} und \Lkeyword{addtoOptComp} kann der Stil für
% einzelne Komponenten oder zusammen mit \Lcs*{newpsobject} im optionalen
% Argument verwendet werden.
% \fi
% \ifENGLISH
% Affects the basic appearence of all optical components. Using standard
% graphics parameters like e.g.\ \opt{linestyle} would change also the
% connections that are drawn together with the component
% (\Lkeyword{beam}, \Lkeyword{fiber} etc.). Use the key
% \Lkeyword{newOptComp} and \Lkeyword{addtoOptComp} to change the style
% for single components or for use with \Lcs*{newpsobject} via the
% optional argument.
% \fi
% \iffalse
%<*ignore>
% \fi
\ifGERMAN
\begin{LTXexample}[morekeywords={[21]{addtoOptComp}}]
\begin{pspicture}(2.5,4)
  \psset{beam}
  % falsch, die Strahlbreite wird auch geaendert
  \mirror[linewidth=3\pslinewidth](0,3)(2,3)(2,2)
  % korrektes Ergebnis
  \addtopsstyle{OptComp}{linewidth=3\pslinewidth}
  \mirror(0,1)(2,1)(2,0)
\end{pspicture}
\end{LTXexample}
\fi\ifENGLISH
\begin{LTXexample}[morekeywords={[21]{addtoOptComp}}]
\begin{pspicture}(2.5,4)
  \psset{beam}
  % wrong, also beam width is changed
  \mirror[linewidth=3\pslinewidth](0,3)(2,3)(2,2)
  % correct result
  \addtopsstyle{OptComp}{linewidth=3\pslinewidth}
  \mirror(0,1)(2,1)(2,0)
\end{pspicture}
\end{LTXexample}
\fi
% \iffalse
%</ignore>
% \fi
%
% \styleitem[linestyle=dashed,dash=1.5pt 1pt]{OptionalStyle} 
% \ifGERMAN
% Der Stil wird zusätzlich zu \Lstyle{OptComp} auf Komponenten angewendet,
% die als \Lkeyword{optional} markiert sind.
% \fi
% \ifENGLISH
% This style is applied to components marked as \Lkeyword{optional} in addition
% to \Lstyle{OptComp}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{optional}}]
\begin{pspicture}(3,1.5)
\lens[optional, beam](0,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN
% \Lstyle{OptionalStyle} wird nach \Lstyle{OptComp} angewendet, so dass
% einzelne Einstellungen überschrieben werden können.
% \fi
% \ifENGLISH
% \Lstyle{OptionalStyle} is applied after \Lstyle{OptComp} so that it
% can overwrite the general settings.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\ifGERMAN
\begin{LTXexample}[morekeywords={[21]{OptComp, OptionalStyle, optional}}]
\begin{pspicture}(3,1.5)
\addtopsstyle{OptComp}{linewidth=3\pslinewidth, linecolor=red}
\newpsstyle{OptionalStyle}{linecolor=blue}
\lens(0,1)(2,1)
% Linienfarbe wird ueberschrieben, die Linienbreite nicht.
\lens[optional](0,1)(3,1)
\end{pspicture}
\end{LTXexample}
\fi\ifENGLISH
\begin{LTXexample}[morekeywords={[21]{OptComp, OptionalStyle, optional}}]
\begin{pspicture}(3,1.5)
\addtopsstyle{OptComp}{linewidth=3\pslinewidth, linecolor=red}
\newpsstyle{OptionalStyle}{linecolor=blue}
\lens(0,1)(2,1)
% linecolor overwritten, linewidth kept
\lens[optional](0,1)(3,1)
\end{pspicture}
\end{LTXexample}
\fi
% \iffalse
%</ignore>
% \fi
%
% \styleitem[linewidth=0.8\cs{pslinewidth}, arrowinset=0, arrowscale=0.8, arrows=<->]{VariableStyle} 
% \ifGERMAN Der Stil der Pfeile für verstellbare Komponenten (\Lcomp{mirror} und
% \Lcomp{optgrating}).
% \fi
% \ifENGLISH The style of the arrows of variable components (\Lcomp{mirror} and
% \Lcomp{optgrating}).
% \fi
% \end{stylelist}
%
% \begin{optionlist}
% \valitem{addtoOptComp}{list} 
% \addtostylemsg{OptComp}
%
% \valitem{newOptComp}{list}
% \newstylemsg{OptComp}
%
% \iffalse
%<*ignore>
% \fi
\ifGERMAN
\begin{LTXexample}[morekeywords={[21]{addtoOptComp,newOptComp}}]
\begin{pspicture}(3,1.5)
  \psset{beam}
  \newpsstyle{OptComp}{linewidth=3\pslinewidth}
  \mirror[addtoOptComp={linestyle=dotted}](0.5,0)(0.5,1)(1.5,1)
  % Ueberschreibt linewidth-Einstellungen
  \mirror[newOptComp={linestyle=dotted}](1.5,1)(2.5,1)(2.5,0)
\end{pspicture}
\end{LTXexample}
\fi
\ifENGLISH
\begin{LTXexample}[morekeywords={[21]{addtoOptComp,newOptComp}}]
\begin{pspicture}(3,1.5)
  \psset{beam}
  \newpsstyle{OptComp}{linewidth=3\pslinewidth}
  \mirror[addtoOptComp={linestyle=dotted}](0.5,0)(0.5,1)(1.5,1)
  % overwrites the linewidth settings
  \mirror[newOptComp={linestyle=dotted}](1.5,1)(2.5,1)(2.5,0)
\end{pspicture}
\end{LTXexample}
\fi
% \iffalse
%</ignore>
% \fi
%
% \boolitem[false]{optional}
% \ifGERMAN
% Markiert eine Komponente als optional indem der Stil
% \Lstyle{OptionalStyle} angewendet wird.
% \fi
% \ifENGLISH
% Mark an object as optional by applying the \Lstyle{OptionalStyle} style.
% \fi
% \end{optionlist}
% 
% \ifGERMAN\chapter{Freistrahlkomponenten}\fi
% \ifENGLISH\chapter{Free-ray components}\fi
% \label{chap:freeraycomp}
%
% \ifGERMAN In diesem Kapitel werden alle Freistrahlkomponenten und deren
% Parameter beschrieben. Freistrahlkomponenten können, im Gegensatz zu
% Faserkomponenten, transmittive und reflektive Grenzflächen haben, die für
% Raytracing von Lichtstrahlen verwendet werden können. Es gibt zwei
% unterschiedliche Komponententypen: manche benötigen nur zwei Knoten um
% positioniert zu werden (\compref{lens}--\compref{polarization}), wohingegen
% z.B. Spiegel drei Knoten benötigen um korrekt ausgerichtet zu werden
% (\compref{mirror}--\compref{pentaprism}).
% \fi
% \ifENGLISH This chapter describes all free-ray components and their
% options. Free-ray components differ from fiber components in that they provide
% transmittive or reflective interfaces which can be used to raytrace
% beams. They are divided in two types: some components like lenses need only
% two nodes for positioning (\compref{lens}--\compref{polarization}), whereas
% e.g. mirrors require three nodes to determine the orientation
% (\compref{mirror}--\compref{pentaprism}).
% \fi
%
% \ifGERMAN\section{Linse}\fi
% \ifENGLISH\section{Lens}\fi
% \label{sec:lens}
%
% \begin{ltxsyntax}
% \dipoledesc{lens}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \lens[beam](0,1)(3,1){L}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifENGLISH A lens is defined by its height and the radii of the input and
% output interfaces.
% \fi
% \ifGERMAN Eine Linse wird durch ihre Höhe und die beiden Radien der Eingangs-
% und Ausgangsflächen definiert.
% \fi
% 
% \begin{optionlist}
% \numitem[1]{lensheight} 
% \ifGERMAN Setzt die Höhe der Linse.\fi
% \ifENGLISH Set the height of the lens.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{lensheight}}]
\begin{pspicture}(3,1.5)
  \lens[beam](0,1)(3,1){L1}
  \lens[lensheight=0.5](2,1)(3,1){L2}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \numitem[1]{lensradiusleft} 
% \ifGERMAN
% Setzt den Radius der linken Linsengrenzfläche. Ein positiver Wert \prm{num}
% ist für eine konvexe, ein negativer für eine konkave Krümmung. Null ergibt
% eine ebene Fläche.
% \fi
% \ifENGLISH
% Set the left radius of the lens. A positive \prm{num} is for convex, a
% negative one for concave curvatures. Use zero for a plain surface.
% \fi
% 
% \numitem[1]{lensradiusright} 
% \ifGERMAN
% Das Gleiche wie \Lkeyword{lensradiusleft}, nur für die rechte Grenzfläche.
% \fi
% \ifENGLISH
% Same as \Lkeyword{lensradiusleft} but for the right surface.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{lensradiusleft, lensradiusright}}]
\begin{pspicture}(3,1.5)
  \psset{lensradiusright=0, beam}
  \lens[lensradiusleft=1](0,1)(1.5,1){$R > 0$}
  \lens[lensradiusleft=-1](1.5,1)(3,1){$R < 0$}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \optitem{lensradius}{\prm{left}[ \prm{right}]}
% \ifGERMAN
% Setzt die linke und rechte Linsenkrümmung. Wird nur ein Wert angegeben, so
% wird dieser für beide Krümmungen verwendet.
% \fi
% \ifENGLISH
% Set the left and right lens curvatures. If only a single value is given, it is
% used for both curvatures.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{lensradius}}]
\begin{pspicture}(3,1.5)
  \lens[lensradius=-2, beam](0,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[0]{lenswidth}
% \ifGERMAN
% Üblicherweise werden nur die Höhe und die beiden Radien für die
% Konstruktion der Linse verwendet, die Mittenbreite wird automatisch
% berechnet. Wenn \Lkeyword{lenswidth} auf einen Wert größer Null gesetzt wird,
% wird diese Breite verwendet. Das ist nur sinnvoll, wenn dicke Linsen
% gezeichnet werden sollen, da es andernfalls für zu kleine Werte zu unschönen
% Ergebnissen führt.
% \fi
% \ifENGLISH
% Usually only the height and the two radii are used to construct the lens,
% the width is calculated automatically. For \Lkeyword{lenswidth} greater
% than zero, this width is used instead. This is only useful if you want to draw
% thick lenses and it can give ugly results if the value is choosen too
% small.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{lenswidth}}]
\begin{pspicture}(3,2)
  \lens[lenswidth=0.5, beam](0,1)(2,1){thick lens}
  \lens[lenswidth=0.1, beam](2,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \optitem{lens}{\prm{radiusleft}[ \prm{radiusright}[ \prm{height}[ \prm{width}]]]}
% \ifGERMAN
% Eine Option zum gleichzeitigen Setzen mehrerer Linsenparameter. Werte
% mittendrin können mit einem Punkt übersprungen und Werte am Ende können
% weggelassen werden (z.B. \opt{lens=. 1 1}).
% \fi
% \ifENGLISH
% A convenience option to specify all lens parameters with a single
% option. Intermediate values can be skipped with a dot, values at the end can
% be omitted (e.g. \opt{lens=.\ 1 1}).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \lens[lens=1](0,1)(1,1){L1}
  \lens[lensradius=-2 1, beam](0,1)(3,1){L2}
  \lens[lens=2 -0.7 1.2](2,1)(3,1){L3}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[false]{thicklens}
% \ifENGLISH 
% This option was necessary until version 2.1 in order to draw a thick lens of
% width \Lkeyword{lenswidth} instead of using the calculated lens width. This
% option is superfluous since version 3.0 because setting \Lkeyword{lenswidth}
% to a positive value automatically draws a thick lens.
% \fi
% \ifGERMAN 
% Diese Option was bis Version 2.1 notwendig um dicke Linsen der Breite
% \Lkeyword{lenswidth} zu zeichnen, anstatt die berechnete Breite zu
% verwenden. Seit Version 3.0 ist diese Option überflüssig, da dicke Linsen
% gezeichnet werden, sobald \Lkeyword{lenswidth} auf einen positiven Wert
% gesetzt wird.
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Asphärische Linse}\fi
% \ifENGLISH\section{Aspheric lens}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{asphericlens}
% \end{ltxsyntax}
%
% \ifGERMAN Eine asphärische Linse besitzt eine Oberfläche, deren Form durch die Gleichung
% \begin{equation*}
% z(y) = \frac{y^2}{R(1 + \sqrt{1 - (1+k)y^2/R^2})} + A_4y^4 + A_6y^6 + A_8y^8 + A_{10}y^{10}
% \end{equation*}
% gegeben ist. $z$ ist der Sagittalschnitt parallel zur optischen Achse,
% $y$ der Abstand zur optischen Achse und $R$ der
% Krümmungsradius. Desweiteren ist $k$ die konische Konstante und $A_4$,
% $A_6$, $A_8$ und $A_{10}$ die Asphärenkoeffizienten der 4. bis
% 10. Ordnung.
% \fi
% \begin{optionlist}
% \numitem[1]{asphereheight}
% \ifGERMAN Die Höhe der Linse.\fi
% \ifENGLISH The lens height.\fi
% 
% \numitem[0]{aspherewidth}
% \ifGERMAN 
% Die Breite der Linse. Wird nur verwendet, wenn der angegebene Wert
% über dem minimal berechneten liegt.
% \fi
% \ifENGLISH
% The lens center thickness. Is use only, if the given value is larger
% than the minimum calculated value.
% \fi
%
% \numitem[1]{asphereradiusleft}
% \ifGERMAN Der Krümmungsradius der linken, asphärischen Oberfläche.\fi
% \ifENGLISH Curvature radius of the left, aspheric surface.\fi
%
% \numitem[0]{asphereradiusright}
% \ifGERMAN
% Der Krümmungsradius der rechten Oberfläche. Ist dieser gleich Null,
% dann ist die Oberfläche plan.
% \fi
% \ifENGLISH
% Curvature radius of the right surface. IF the value is zero, the
% surface is plane.
% \fi
%
% \numitem{asphereconstant}
% \ifGERMAN Die konische Konstante $k$ der linken Oberfläche.\fi
% \ifENGLISH The conic constant $k$ of the left surface.\fi
%
% \optitem{aspherecoefficients}{\prm{$A_4$} [\prm{$A_6$} [\prm{$A_8$} [\prm{$A_{10}$}]]]}
% \ifGERMAN 
% Die Asphärenkoeffizienten $A_4$ bis $A_{10}$. Es können ein bis vier
% Zahlen angegeben werden.
% \fi
% \ifENGLISH
% The aspheric terms of fourth to tenth order. One to four values can be
% specified.
% \fi
% \end{optionlist}
%
% \ifGERMAN
% Als Beispiel nehmen wir die Parameter einer kommerziell erhältlichen
% asphärische
% Kondensorlinse\fnurl{http://www.thorlabs.de/thorproduct.cfm?partnumber=ACL25416U}:
% \fi
% \ifENGLISH
% As example we use the parameters of a commercially available condensor
% lens\fnurl{http://www.thorlabs.de/thorproduct.cfm?partnumber=ACL25416U}:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,-0.3)(5,2.3)
  \pnodes(0,1){A}(5,1){B}
  \asphericlens[%
    plotstyle=cspline,
    asphereheight=2.54,
    aspherewidth=1.4,
    asphereradiusleft=0.8818197,
    aspherecoefficients=8.682e-3 6.376e-3 2.4073e-2 -1.719e-2,
    asphereconstant=-0.9992,
    asphereradiusright=6.99995](A)(B)
  \multido{\r=-1+0.1}{21}{%
    \drawbeam[beampos=\r, linewidth=0.3\pslinewidth](A){}(B)}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Ein weiteres Beispiel zeigt anschaulich den Unterschied
% einer asphärischen Linsen zu einer sphärischen Linse mit gleichem
% Krümmungsradius:
% \fi
% \ifENGLISH 
% Another example illustrates the difference between an aspheric lens an
% a spheric lens with equal curvature:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[pos=t,linerange={2-11}]
\psset{unit=0.5cm}
\begin{pspicture*}(15,8)
  \pnodes(0,4){A}(15,4){B}
  \asphericlens[asphereheight=7.5, asphereradiusleft=3.12848, 
    asphereconstant=-1.991145, aspherecoefficients=4.98e-3](A)(B)
  \multido{\r=-3.2+0.8}{9}{%
    \drawbeam[beampos=\r, linewidth=0.5\pslinewidth](A){}(B)}
  \lens[lens=3.12848 0 6 5.49, abspos=6.13, style=Refline, linestyle=dashed](A)(B)
  \multido{\r=-2.8+0.8}{8}{%
    \drawbeam[beampos=\r, linewidth=0.5\pslinewidth, linecolor=red](A){}(B)}%
\end{pspicture*}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\section{Optisches Plättchen}\fi
% \ifENGLISH\section{Optical plate}\fi
%
%
% \begin{ltxsyntax}
% \dipoledesc{optplate}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optplate[beam](0,1)(3,1){filter}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \begin{optionlist}
%   \numitem[1]{plateheight} 
%   \ifGERMAN Die Höhe des Plättchens.\fi
%    \ifENGLISH The height of the plate.\fi
% 
%   \optitem[2\nxLcs{pslinewidth}]{platelinewidth}{\prm{num} or \prm{dimen}} 
%   \ifGERMAN \linewidthexplanation{des Plättchens}{Plättchen}\fi
%   \ifENGLISH \linewidthexplanation{plate}{plates}\fi
% \end{optionlist}
% 
% \ifGERMAN\section{Verzögerungsplättchen}\fi
% \ifENGLISH\section{Retardation plate}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{optretplate}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optretplate[beam](0,1)(3,1){$\nicefrac{\lambda}{2}$}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem*[1]{plateheight}
% \ifGERMAN Die Höhe des Plättchens.\fi
% \ifENGLISH The height of the plate.\fi
%
% \numitem[0.1]{platewidth}
% \ifGERMAN Die Breite des Plättchens.\fi
% \ifENGLISH The width of the plate.\fi
%
% \optitem{platesize}{\prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe des Plättchens, äquivalent zum Aufruf von
% \Lkeyword{platewidth} und \Lkeyword{plateheight}.
% \fi
% \ifENGLISH The width and height of the plate, is equivalent to calling both
% \Lkeyword{platewidth} and \Lkeyword{plateheight}.
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Lochblende}\fi
% \ifENGLISH\section{Pinhole}\fi
% 
% \begin{ltxsyntax}
% \dipoledesc{pinhole}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \pinhole[beam](0,1)(3,1){PH}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[1]{outerheight}
% \ifGERMAN Die Gesamthöhe der Lochblende.\fi
% \ifENGLISH The total height of the pinhole.\fi
%
% \numitem[0.1]{innerheight}
% \ifGERMAN Die Höhe des Lochs.\fi
% \ifENGLISH The height of the hole.\fi
%
% \optitem[2\nxLcs{pslinewidth}]{phlinewidth}{\prm{num} or \prm{dimen}}
% \ifGERMAN \linewidthexplanation{der Lochblende}{Lochblenden}\fi
% \ifENGLISH \linewidthexplanation{pinhole}{pinholes}\fi
% 
% \numitem[0]{phwidth} 
% \ifGERMAN 
% Die Lochblende wird plastischer gezeichnet, falls \Lkeyword{phwidth}
% ungleich Null ist. In diesem Fall wird \Lkeyword{phlinewidth} ignoriert. Bei
% einem negativen Wert wird die Form gespiegelt.
% \fi
% \ifENGLISH
% The pinhole is drawn in a more plastic style if \Lkeyword{phwidth} is
% not zero, in this case the \Lkeyword{phlinewidth} is ignored. For negative
% values the shape is mirrored.
% \fi 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{phwidth}}]
\begin{pspicture}(3,1.5)
  \pinhole[beam, phwidth=-0.1](0,1)(1.5,1){neg}
  \pinhole[beam, phwidth=0.2](1.5,1)(3,1){pos}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% 
%
% \ifGERMAN\section{Box}\fi
% \ifENGLISH\section{Box}\fi
% 
% \begin{ltxsyntax}
% \dipoledesc{optbox}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \optbox[beam](0,0)(3,2){box}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[1.4]{optboxwidth}
% \ifGERMAN Die Breite der Box.\fi
% \ifENGLISH The width of the box.\fi
%
% \numitem[0.8]{optboxheight}
% \ifGERMAN Die Höhe der Box.\fi
% \ifENGLISH The height of the box.\fi
%
% \optitem{optboxsize}{\prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe der Box, äquivalent zum Aufruf von
% \Lkeyword{optboxwidth} und \Lkeyword{optboxheight}.
% \fi
% \ifENGLISH The width and height of the box, is equivalent to calling both
% \Lkeyword{optboxwidth} and \Lkeyword{optboxheight}.
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Pfeilkomponente}\fi
% \ifENGLISH\section{Arrow component}\fi
% 
% \begin{ltxsyntax}
% \dipoledesc{optarrowcomp}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.7)
  \optarrowcomp[wire](0,1)(3,1){box}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \ifENGLISH A general purpose component, similar to \Lcomp{fiberdelayline},
% but much more flexible.
% \fi
% \ifGERMAN Eine Komponente für den allgemeinen, flexiblen Gebrauch
% ähnlich zu \Lcomp{fiberdelayline}, aber deutlich variabler.
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[1.4]{arrowcompwidth}
% \ifGERMAN Die Breite der Box.\fi
% \ifENGLISH The width of the box.\fi
%
% \numitem[0.8]{arrowcompheight}
% \ifGERMAN Die Höhe der Komponente.\fi
% \ifENGLISH The height of the Komponente.\fi
%
% \optitem{arrowcompsize}{\prm{size} or \prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe der Komponente, äquivalent zum Aufruf von
% \Lkeyword{arrowcompwidth} und \Lkeyword{arrowcompheight}.
% \fi
% \ifENGLISH The width and height of the component, is equivalent to calling both
% \Lkeyword{arrowcompwidth} and \Lkeyword{arrowcompheight}.
% \fi
%
% \numitem[70]{arrowcompangle}
% \ifGERMAN Der Winkel des Pfeils bezüglich der $x$-Achse.\fi
% \ifENGLISH The angle of the arrow with respect to the $x$-axis.\fi
%
% \choitem[rectangle]{arrowcompshape}{rectangle, circle}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]arrowcompshape}]
\begin{pspicture}(3,1)
  \optarrowcomp[arrowcompshape=circle, wire](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% \begin{stylelist}
% \styleitem[arrowinset=0, arrows=->]{ArrowCompStyle} 
% \ifGERMAN 
% Der Stil für den Pfeil. Das kann insbesonders nützlich sein um die
% Länge und Ausrichtung des Pfeils zu verändern.
% \fi
% \ifENGLISH 
% The style of the arrow. This can be especially useful to
% adapt the length and orientation of the arrow.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]ArrowCompStyle}]
\begin{pspicture}(3,1.5)
  \addtopsstyle{ArrowCompStyle}{xunit=-1, arrowscale=2}
  \optarrowcomp[fiber](0,1)(3,1){delay line}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
%
% \ifGERMAN\section{Balkenkomponente}\fi
% \ifENGLISH\section{Bar component}\fi
% 
% \begin{ltxsyntax}
% \dipoledesc{optbarcomp}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optbarcomp[fiber](0,1)(3,1){box}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \ifENGLISH A general purpose component, similar to \Lcomp{optfiberpolarizer},
% but much more flexible.
% \fi
% \ifGERMAN Eine Komponente für den allgemeinen, flexiblen Gebrauch
% ähnlich zu \Lcomp{optfiberpolarizer}, aber deutlich variabler.
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[1.4]{barcompwidth}
% \ifGERMAN Die Breite der Box.\fi
% \ifENGLISH The width of the box.\fi
%
% \numitem[0.8]{barcompheight}
% \ifGERMAN Die Höhe der Box.\fi
% \ifENGLISH The height of the box.\fi
%
% \optitem{barcompsize}{\prm{size} or \prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe der Box, äquivalent zum Aufruf von
% \Lkeyword{barcompwidth} und \Lkeyword{barcompheight}.
% \fi
% \ifENGLISH The width and height of the box, is equivalent to calling both
% \Lkeyword{barcompwidth} and \Lkeyword{barcompheight}.
% \fi
%
% \numitem[70]{barcompangle}
% \ifGERMAN Der Winkel des Balkens bezüglich der $x$-Achse.\fi
% \ifENGLISH The angle of the bar with respect to the $x$-axis.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]barcompangle}]
\begin{pspicture}(3,1)
  \optbarcomp[barcompangle=90, fiber](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[rectangle]{barcompshape}{rectangle, circle}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]barcompshape}]
\begin{pspicture}(3,1)
  \optbarcomp[barcompshape=circle, fiber](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% \begin{stylelist}
%   \styleitem{BarCompStyle}
%   \ifENGLISH The style of the bar.\fi
%   \ifGERMAN Der Stil für den Balken.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]BarCompStyle}]
\begin{pspicture}(3,1)
  \newpsstyle{BarCompStyle}{unit=0.7, arrows=->}
  \optbarcomp[barcompshape=circle, barcompangle=45, fiber](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
%
% \ifGERMAN\section{Optische Quelle}\fi
% \ifENGLISH\section{Optical source}\fi
% 
% \begin{ltxsyntax}
% \dipoledesc{optsource}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \optsource(1.5,1)(3,1){Laser}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH 
% An optical source predefines some properties of any outgoing beam, if
% it is the first component in a beam path. The definable beam
% properties are \Lkeyword{beamangle}, \Lkeyword{beamwidth},
% \Lkeyword{beamdiv} and \Lkeyword{beamalign}. The properties defined by
% the optical source cannot be overwritten by the beam properties. If a
% property wasn't explicitely defined for a source, it is taken from the
% beam properties.
%
% The default settings for the component position are
% \Lkeyword{position}\opt{=start}.
% \fi
% \ifGERMAN
% Eine optische Quelle gibt ein paar Eigenschaften für alle von ihr
% ausgehenden Strahlen vor, falls es die erste Komponente in einem
% Strahlengang ist. Die verwendbaren Eigenschaften sind
% \Lkeyword{beamangle}, \Lkeyword{beamwidth}, \Lkeyword{beamdiv} und
% \Lkeyword{beamalign}. Alle Eigenschaften, die von einer optischen
% Quelle definiert werden, können nicht später durch Strahlparameter
% überschrieben werden. Wird ein Parameter nicht explizit von der Quelle
% definiert, so werden die Parameter von dem Strahl-Stil verwendet.
%
% Die Voreinstellung für die Positionierung ist
% \Lkeyword{position}\opt{=start}.
% \fi
% \end{ltxsyntax}
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(5,2)
  \pnodes(1.5,1){A}(5,1){B}
  \optsource[innerlabel, beamdiv=10, beamangle=10](A)(B){Laser}
  \lens[lens=2 2 2](A)(B)
  \optplane(B)
  \drawwidebeam{-}
  \drawbeam[linecolor=red]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \begin{optionlist}
% \numitem[1.4]{sourcewidth}
% \ifGERMAN Die Breite der Box.\fi
% \ifENGLISH The width of the box.\fi
%
% \numitem[0.8]{sourceheight}
% \ifGERMAN Die Höhe der Box.\fi
% \ifENGLISH The height of the box.\fi
%
% \optitem{sourcesize}{\prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe der Box, äquivalent zum Aufruf von
% \Lkeyword{sourcewidth} und \Lkeyword{sourceheight}.
% \fi
% \ifENGLISH The width and height of the box, is equivalent to calling both
% \Lkeyword{sourcewidth} and \Lkeyword{sourceheight}.
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Kristall}\fi
% \ifENGLISH\section{Crystal}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{crystal}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.3)
  \crystal[beam](0,1)(3,1){Crystal}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[1.4]{crystalwidth}
% \ifGERMAN Die Breite des Kristalls.\fi
% \ifENGLISH The width of the crystal.\fi
%
% \numitem[0.6]{crystalheight}
% \ifGERMAN Die Höhe des Kristalls.\fi
% \ifENGLISH The height of the crystal.\fi
%
% \optitem{crystalsize}{\prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe des Kristalls, äquivalent zum Aufruf von
% \Lkeyword{crystalwidth} und \Lkeyword{crystalheight}.
% \fi
% \ifENGLISH The width and height of the crystal, is equivalent to calling both
% \Lkeyword{crystalwidth} and \Lkeyword{crystalheight}.
% \fi
%
% \numitem[0.3]{caxislength}
% \ifGERMAN Die zusätzliche Länge des Pfeils für die $c$-Achse, wird weggelassen
% falls die Länge \opt{0} ist und gespiegelt falls der Wert negativ ist. Die
% Gesamtlänge ist \Lkeyword{caxislength} plus \Lkeyword{crystalheight}.
% \fi
% \ifENGLISH The additional length of the $c$-axis, is dropped when set to
% \opt{0} and is mirrored if the values is negative. The total length is
% \Lkeyword{caxislength} plus \Lkeyword{crystalheight}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{caxislength}}]
\begin{pspicture}(0,0.4)(3,1.5)
  \psset{crystalsize=0.5 0.8, label=-45 . l}
  \crystal[position=0.2, caxislength=0.5](0,1)(3,1){pos}
  \crystal[beam, caxislength=0](0,1)(3,1){0}
  \crystal[position=0.8, caxislength=-0.5](0,1)(3,1){neg}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[false]{caxisinv}
% \ifGERMAN 
% Invertiert die Richtung der $c$-Achse, ist äquivalent zu einem
% Vorzeichenwechsel von \Lkeyword{caxislength}.
% \fi
% \ifENGLISH 
% Invert the direction of the $c$-axis, this is equivalent to changing the sign
% of \Lkeyword{caxislength}.
% \fi
%
% \boolitem[false]{voltage}
% \ifGERMAN Zeichnet einen Spannungsanschluss und ein Erdungszeichen.\fi
% \ifENGLISH Draw a voltage connection and a ground symbol.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{voltage}}]
\begin{pspicture}(0,0.4)(3,1.5)
  \crystal[voltage, beam](0,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[false]{lamp}
% \ifGERMAN Zeichnet eine Lampe neben den Kristall.\fi
% \ifENGLISH Draw a lamp near the crystal.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{lamp}}]
\begin{pspicture}(0,0.4)(3,1.7)
  \crystal[lamp, beam](0,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem[linewidth=0.7\cs{pslinewidth}, linestyle=dashed, dash=2pt 2pt, arrowinset=0, arrows=->]{CrystalCaxis}
% \ifGERMAN Der Stil für die $c$-Achse inklusive der Pfeilart.\fi
% \ifENGLISH The style of the $c$-axis including the arrow type.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{CrysalCaxis}}]
\begin{pspicture}(0,0.5)(3,1.6)
  \newpsstyle{CrystalCaxis}{linecolor=red, arrows=->>}
  \crystal[beam](0,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \styleitem[linewidth=0.6\cs{pslinewidth}]{CrystalLamp}
% \ifGERMAN Der Stil für die Hintergrundlampe.\fi
% \ifENGLISH The style of the crystal background lamp.\fi
% \end{stylelist}
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{voltage, lamp}}]
\begin{pspicture}(3,1.7)
  \crystal[fillstyle=solid, fillcolor=yellow!90!black, 
             label=1.2 -45, voltage, 
             lamp, beam](0,1)(3,1){SBN:Ce}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN\section{Optische Diode}\fi
% \ifENGLISH\section{Optical diode}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{optdiode}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{optdiode}}] 
\begin{pspicture}(3,2)
  \optdiode[beam](0,1)(3,1){Diode}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifENGLISH The optical diode has a default setting of
% \Lkeyword{allowbeaminside}\opt{=false}.
% \fi
% \ifGERMAN Die optische Diode hat die Voreinstellung
% \Lkeyword{allowbeaminside}\opt{=false}.
% \fi
%
% \begin{optionlist}
% \numitem[0.8]{optdiodesize}
% \ifGERMAN 
% Die Seitenlänge der optischen Diode.
% \fi
% \ifENGLISH
% The side length of the optical diode.
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Doveprisma}\fi
% \ifENGLISH\section{Dove prism}\fi
% 
% \begin{ltxsyntax}
% \dipoledesc{doveprism}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{doveprism}}] 
\begin{pspicture}(3,1.5)
  \doveprism[beam](0,1)(3,1){Dove}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \optitem[0.6]{doveprismsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN
% Wenn eine Zahl angegeben ist, dann ist das die Höhe des Prismas, die
% Gesamtbreite beträgt das dreifache. Zwei Zahlen geben Breite und Höhe des
% Doveprisma an. Die Winkel an der Eingangs- und Ausgangsfläche betragen immer
% 45\textdegree.
% \fi
% \ifENGLISH
% A single number defines the height of the prism, the total width is set to
% three times the height. Two number define the width and height of the dove
% prism. The angles at the input and output faces are always 45\textdegree.
% \fi
% \end{optionlist}
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{doveprism}}] 
\begin{pspicture}(4,1.5)
  \optplane(0,1)
  \doveprism[doveprismsize=1.2](0,1)(4,1)
  \optplane(4,1)
  \drawbeam[raytrace=false, linecolor=black]{-}
  \drawbeam[n=1.5, linecolor=red]{-}
  \drawbeam[n=*sqrt(5), linecolor=green, linestyle=dashed]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN\section{Glan-Thompson-Prisma}\fi
% \ifENGLISH\section{Glan--Thompson prism}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{glanthompson}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{glanthompson}}]
\begin{pspicture}(3,1.5)
  \glanthompson[beam](0,1)(3,1){Glan-Thompson}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[1.0]{glanthompsonwidth}
% \ifGERMAN Die Breite des Prisma.\fi
% \ifENGLISH The width of the prism.\fi
%
% \numitem[0.5]{glanthompsonheight}
% \ifGERMAN Die Höhe des Prisma.\fi
% \ifENGLISH The height of the prism.\fi
%
% \optitem{glanthompsonsize}{\prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe des Prisma, äquivalent zum Aufruf von
% \Lkeyword{glanthompsonwidth} und \Lkeyword{glanthompsonheight}.
% \fi
% \ifENGLISH The width and height of the prism, is equivalent to calling both
% \Lkeyword{glanthompsonwidth} and \Lkeyword{glanthompsonheight}.
% \fi
%
% \numitem[0]{glanthompsongap}
% \ifGERMAN 
% Der Abstand der beiden Teilprismen in $x$-Richtung, die Linienbreiten
% werden nicht berücksichtigt. Die Gesamtbreite ist von diesem Wert
% unabhängig, aber der Winkel der reflektierenden Fläche wird davon beeinflusst.
% \fi
% \ifENGLISH The separation of the two prisms in $x$-direction. The
% total width does not depend on this value, but the angle of the
% reflective plane is affected.
% \fi
% 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1)
  \glanthompson[glanthompsongap=0.1, beam](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN Von der Implementierung entspricht das Glan-Thompson-Prisma
% für \Lkeyword{glanthompsongap}\opt{=0} einem Strahlteiler, der nur
% zwei Knoten zur Positionierung benötigt und nicht quadratisch ist.
%
% Beachten Sie, dass das Prisma für \Lkeyword{glanthompsongap}\opt{>\,0}
% nicht von beiden Seiten gleich verwendet werden kann, da in der
% derzeitigen Implementierung nur eine uneindeutige Grenzfläche
% (reflektierend oder transmittierend) zugelassen ist. In dem folgenden
% Beispiel sieht man, dass der rote Strahl an der falsche Fläche
% reflektiert wird.
% \fi
% \ifENGLISH
% The implementation of the Glan--Thompson prism for
% \Lkeyword{glanthompsongap}\opt{=0} is equivalent to a beamsplitter
% which is positioned with two nodes only and which is not quadratic.
%
% Please note, that the Prism cannot be used properly from both sides
% for \Lkeyword{glanthompsongap}\opt{>\,0} because the current
% implementation allows only a single ambiguous interface (reflective or
% transmittive). In the following example you see, that the red beam is
% reflected at the wrong interface.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,1){A}(4,1){B}
  \glanthompson[glanthompsongap=0.2, glanthompsonsize=2 1](A)(B)
  \optplane[angle=90](2,0)\optplane[angle=90](2,2)
  \addtopsstyle{Beam}{ArrowInside=->, arrowscale=1.5}
  \drawbeam[beampos=0.1](A){1-2}
  \drawbeam[beampos=0.1, linecolor=red](B){1}{3}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN \prettyref{ex:glan-thompson} enthält ein weiterführendes
% Beispiel mit einem Glan-Thompson-Prisma.\fi
% \ifENGLISH \prettyref{ex:glan-thompson} shows a further setup with a
% Glan--Thompson prism.\fi
%
% \ifGERMAN\section{Polarisation}\fi
% \ifENGLISH\section{Polarization}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{polarization}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{polarization}}] 
\begin{pspicture}(3,1)
  \polarization[beam](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \begin{optionlist}
% \numitem[0.6]{polsize}
% \ifGERMAN Die Größe des Polarisationszeichens, der Kreis für \opt{perp} und
% \opt{polmisc} ist halb so groß.
% \fi
% \ifENGLISH The size of the polarization symbol, the circle for \opt{perp} and
% \opt{polmisc} is half of this.
% \fi
%
% \choitem[parallel]{poltype}{parallel, perp, misc, lcirc, rcirc}
% \ifGERMAN Dieser Parameter wählt die Polarizationsart aus.\fi
% \ifENGLISH This parameter choses the polarization type.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{poltype}}] 
\begin{pspicture}(0,-0.3)(3,4.3)
  \psset[optexp]{beam}
  \begin{optexp}
  \polarization[poltype=parallel, abspos=0.5](0,4)(3,4)
  \polarization[poltype=perp, abspos=1](0,3)(3,3)
  \polarization[poltype=misc, abspos=1.5](0,2)(3,2)
  \polarization[poltype=lcirc, abspos=2](0,1)(3,1)
  \polarization[poltype=rcirc, abspos=2.5](0,0)(3,0)
  \end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem[arrowscale=0.8, linewidth=0.7\cs{pslinewidth}, dotsize=3\cs{pslinewidth}]{Polarization}
% \ifGERMAN Bestimmt das Aussehen der Polarisationssymbole.\fi
% \ifENGLISH Affects the style of the polarisation symbols.\fi
% \end{stylelist}
% 
% \ifGERMAN\section{Keil}\fi
% \ifENGLISH\section{Wedge}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{optwedge}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \optwedge[beam](0,1)(3,1){Wedge}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \begin{optionlist}
% \numitem[0.8]{wedgeheight}
% \ifGERMAN Höhe des Keils.\fi
% \ifENGLISH The height of the wedge.\fi
%
% \numitem[10]{wedgeangleright}
% \ifGERMAN Der obere Winkel der rechten Grenzfläche bezogen auf die Vertikale.\fi
% \ifENGLISH The upper angle of the right interface with respect to a vertical line.\fi
%
% \numitem[0]{wedgeangleleft}
% \ifGERMAN Der obere Winkel der linken Grenzfläche bezogen auf die Vertikale.\fi
% \ifENGLISH The upper angle of the left interface with respect to a vertical line.\fi
%
% \optitem{wedgeangles}{\prm{left}[ \prm{right}]}
% \ifGERMAN
% Erlaubt beide Winkel gleichzeitig zu setzen. Wird nur ein Wert
% angegeben, dann wird dieser für beide Winkel verwendet.
% \fi
% \ifENGLISH
% Allows setting both angles at once. If only a single value is given,
% it is used for both angles.
% \fi
% \numitem[0]{wedgewidth}
% \ifGERMAN Ist der Wert größer als die berechnete Grundbreite, dann wird der Keil auf die angegebene Breite vergrößert.\fi
% \ifENGLISH If this value is larger than the calculated base width, then the wedge's width is increase to this value.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(2,1)
  \optwedge[wedgeangles=10 0, wedgewidth=0.4](0,0.5)(2,0.5)
  \drawwidebeam[beamwidth=0.5](0,0.5){}(2,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \end{optionlist}
%
% \ifGERMAN\section{Axikon}\fi
% \ifENGLISH\section{Axicon}\fi
%
% \begin{ltxsyntax}
% \dipoledesc{axicon}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \axicon[label=1](0,1)(3,1){Axicon}
  \drawwidebeam[beamwidth=0.5](0,1){}(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \begin{optionlist}
% \numitem[1.5]{axiconheight}
% \ifGERMAN Die Höhe des Axikons.\fi
% \ifENGLISH The height of the axicon.\fi
%
% \numitem[0.4]{axiconwidth}
% \ifGERMAN Die Breite des Axikons.\fi
% \ifENGLISH The width of the axicon.\fi
%
% \numitem[10]{axiconangle}
% \ifGERMAN Der obere Winkel der rechten Grenzfläche bezogen auf die Vertikale.\fi
% \ifENGLISH The upper angle of the right interface with respect to a vertical line.\fi
%
% \end{optionlist}
%
% \ifGERMAN\section{Spiegel}\fi
% \ifENGLISH\section{Mirror}\fi
% 
% \begin{ltxsyntax}
% \tripoledesc{mirror}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \mirror[beam](0,0)(1.8,1.5)(0,2){M}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[1]{mirrorwidth}
% \ifGERMAN Die Breite des Spiegels.\fi
% \ifENGLISH The width of the mirror.\fi
% 
% \optitem[2\nxLcs{pslinewidth}]{mirrorlinewidth}{\prm{num} or \prm{dimen}} 
% \ifGERMAN \linewidthexplanation{des Spiegels}{Spiegel}\fi
% \ifENGLISH \linewidthexplanation{mirror}{mirrors}\fi
%
% \optitem[0]{mirrorradius}{\prm{radius}[ 0]} 
% \ifGERMAN
% Diese Parameter setzt die Krümmung des Spiegels. Null ergibt einen
% ebenen, ein negativer Radius einen konvexen und ein positiver Radius
% einen konkaven Spiegel.
% \fi
% \ifENGLISH
% This parameter defines the curvature of the mirror. A value of \opt{0}
% is for a plain mirror, a negative radius for a convex mirror and a
% positive radius gives you a concave mirror.
% \fi
% 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrorradius}}]
\begin{pspicture}(3,3)
  \psset[optexp]{labeloffset=0.5}
  \mirror[mirrorradius=1](0,0)(1,2)(1.8,1){convex}
  \mirror[mirrorradius=-1](1,2)(1.8,1)(2.5,3){concave}
  \drawbeam(0,0){-}(2.5,3)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Wird kein zweiter Wert angegeben, so ist die Krümmung der
% zweiten Fläche eines \opt{extended} oder \opt{semitrans} Spiegels die
% Gleiche wie bei der Hauptgrenzfläche (siehe vorheriges Beispiel). Wird
% die Null als zweiter Wert angegeben (andere Werte werden nicht
% unterstützt), so ist die zweite Fläche flach:
% \fi
% \ifENGLISH If no second value is specified, the curvature of the
% second interface of an \opt{extended} or \opt{semitrans} mirror is the
% same as that of the main interface (see previous example). If zero is
% given as second value (other values are not supported), the second
% interface is plain.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrorradius}}]
\begin{pspicture}(3,3)
  \mirror[mirrorradius=1 0, mirrortype=semitrans](0,0)(1,2)(1.8,1){convex}
  \mirror[mirrorradius=-1 0, mirrortype=extended](1,2)(1.8,1)(2.5,3){concave}
  \drawbeam(0,0){-}(2.5,3)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Die Angabe von \Lkeyword{mirrordepth} bezieht sich immer auf
% die Mindesttiefe des Spiegels.
% \fi
% \ifENGLISH The value of \Lkeyword{mirrordepth} always refers to the
% minimum depth of the mirror.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrorradius, mirrordepth}}]
\begin{pspicture}(3,3)
  \psset[optexp]{mirrordepth=0.2}
  \mirror[mirrorradius=1 0, mirrortype=semitrans](0,0)(1,2)(1.8,1){convex}
  \mirror[mirrorradius=-1 0, mirrortype=extended](1,2)(1.8,1)(2.5,3){concave}
  \drawbeam(0,0){-}(2.5,3)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \choitem[plain]{mirrortype}{plain, piezo, extended, semitrans}
% \ifGERMAN
% Diese Parameter wählt die Spiegelart aus. Das Aussehen wird mit
% \Lstyle{PiezoMirror}, \Lstyle{ExtendedMirror} und \Lstyle{SemitransMirror}
% gesteuert.
% \fi
% \ifENGLISH
% The \nxLkeyword{mirrortype} selects between different types of mirrors. The
% style is controlled with \Lstyle{PiezoMirror}, \Lstyle{ExtendedMirror}, and
% \Lstyle{SemitransMirror}.
% \fi
% 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrortype}}]
\begin{pspicture}(3,2)
  \mirror[mirrortype=extended,
            beam](0,0)(1.8,1.5)(0,2){ext}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Beachten Sie, dass der Anschlussdraht für den Piezospiegel nicht
% gezeichnet wird, falls \Lkeyword{extnode} verwendet wird.
% \fi
% \ifENGLISH Note, that the default piece of wire is omitted when using
% \Lkeyword{extnode} with a piezo mirror.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrortype}}]
\begin{pspicture}(3,2)
\mirror[mirrortype=piezo,
          beam](0,0)(1.8,1.5)(0,2){piezo}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Ein halbdurchlässiger Spiegel (\opt{semitrans}) hat, im Gegensatz zu
% den anderen Spiegeltypen, zwei Grenzflächen, deren Abstand und Position vom
% Wert und Vorzeichen von \Lkeyword{mirrordepth} abhängt.
% \fi
% \ifENGLISH A semi-transparent mirror (\opt{semitrans}) has two interfaces, in
% contrast to the other mirror types. Their distance and position depends on the
% value and sign of \Lkeyword{mirrordepth}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrortype, mirrordepth}}]
\psset{unit=1.5}
\begin{pspicture}(2,2)
  \mirror[mirrortype=semitrans](0,1)(1,1)(1,0)
  \drawbeam(0,1){}(1,0)
  \drawbeam[linecolor=red](2,1){}(1,2)
  \drawbeam[beampos=0.05, linecolor=blue](0,1){}(2,1)
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[morekeywords={[21]{mirrortype, mirrordepth}}]
\psset{unit=1.5}
\begin{pspicture}(2,2)
  \mirror[mirrortype=semitrans, mirrordepth=-0.15](0,1)(1,1)(1,0)
  \drawbeam(0,1){}(1,0)
  \drawbeam[linecolor=red](2,1){}(1,2)
  \drawbeam[beampos=0.05, linecolor=blue](0,1){}(2,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Eine negative Spiegeltiefe \Lkeyword{mirrordepth} ist
% äquivalent zu einer positiven Tiefe kombiniert mit
% \Lkeyword{angle}\opt{=180}.
% \fi
% \ifENGLISH A negative \Lkeyword{mirrordepth} is equivalent to a
% positive depth combined with \Lkeyword{angle}\opt{=180}. 
% \fi
% 
% \boolitem[false]{variable}
% \ifGERMAN
% Zeichnet einen verstellbaren Spiegel, der mit zwei zusätzlichen gekrümmten
% Pfeilen an beiden Seiten angedeutet wird. Das Aussehen, inklusive der Pfeile,
% wird von \Lstyle{VariableStyle} vorgegeben.
% \fi
% \ifENGLISH
% Draw an adjustable mirror which has two additional curved arrows on both
% sides. The appearance including the arrow types is determined by
% \Lstyle{VariableStyle}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{variable}}]
\begin{pspicture}(3,2)
  \mirror[beam, variable](0,0)(1.8,1.5)(0,2){var}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[0.1]{mirrordepth} 
% \ifGERMAN Die Gesamttiefe eines breiten Spiegels.\fi
% \ifENGLISH The total depth of an extended mirror.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrortype, mirrordepth}}]
\begin{pspicture}(3,2)
  \mirror[mirrortype=extended, mirrordepth=0.2,
            beam](0,0)(1.8,1.5)(0,2)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem[linestyle=none, hatchwidth=0.5\cs{pslinewidth}, hatchsep=1.4\cs{pslinewidth}, fillstyle=hlines]{ExtendedMirror} 
% \ifGERMAN Der Stil für den \opt{extended} Spiegel.\fi
% \ifENGLISH The style for the \opt{extended} mirror.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrortype, ExtendedMirror}}]
\begin{pspicture}(3,2)
  \newpsstyle{ExtendedMirror}{fillstyle=solid, 
                                fillcolor=Gold,
                                linestyle=none}
  \mirror[mirrortype=extended,
            beam](0,0)(1.8,1.5)(0,2){ext}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \styleitem[fillstyle=solid, fillcolor=black!30]{PiezoMirror} 
% \ifGERMAN 
% Der Stil für den \opt{piezo} Spiegel. Dieser kann auch dazu verwendet
% werden, die Größe des Piezos zu verändern, wie in dem folgenden Beispiel zu sehen ist.
% \fi
% \ifENGLISH
% This style defines the appearance of the \opt{piezo} mirror. This can also
% be used to change the size of piezo part, as the example shows.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{mirrortype, PiezoMirror}}]
\begin{pspicture}(3,2)
  \addtopsstyle{PiezoMirror}{xunit=2}
  \mirror[mirrortype=piezo,
            beam](0,0)(1.8,1.5)(0,2){piezo}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \styleitem[linestyle=none, fillstyle=solid, fillcolor=black!30]{SemitransMirror} 
% \ifGERMAN 
% Der Stil für den \opt{semitrans} Spiegel.
% \fi
% \ifENGLISH
% This style defines the appearance of the \opt{semitrans} mirror.
% \fi
% \end{stylelist}
% 
% \ifGERMAN\section{Parabolspiegel}\fi
% \ifENGLISH\section{Parabolic mirror}\fi
%
% \begin{ltxsyntax}
%   \dipoledesc{parabolicmirror}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \parabolicmirror(0,1)(2,1){PM}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \begin{optionlist}
%   \numitem[1]{parmirrorwidth}
%   \ifGERMAN Die Breite des Parabolspiegels.\fi
%   \ifENGLISH The width of the parabolic mirror.\fi
%
%   \numitem[1]{parmirrorheight}
%   \ifGERMAN Die Höhe des Parabolspiegels.\fi
%   \ifENGLISH The height of the parabolic mirror.\fi
% \end{optionlist}
% 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,-2)(3,2)
  \parabolicmirror[parmirrorheight=4, parmirrorwidth=2](0,0)(3,0)
  \addtopsstyle{Beam}{beamalign=abs, linewidth=0.2\pslinewidth, beaminsidelast, stopinsidecount=1}
  \multido{\r=-1.55+0.1}{33}{%
    \drawbeam[beampos=\r](0,0){1}}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}
\begin{pspicture}(0,-1)(3,1)
  \optplane(0,0)
  \parabolicmirror[parmirrorheight=2, parmirrorwidth=1.5](0,0)(3,0)
  \addtopsstyle{Beam}{arrows=->, beamalign=abs}
  \drawbeam[beampos=0.5, linecolor=red]{1}{2}{1}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\section{Off-axis-Parabolspiegel}\fi
% \ifENGLISH\section{Off-axis parabolic mirror}\fi
%
% \begin{ltxsyntax}
%   \xLtripole{oapmirror}%
%   \compitem{oapmirror}[options](in)(center)(focus){label}%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2.5)
  \oapmirror(3,2)(1,2)(2,0){OAP}
  \drawwidebeam[beamwidth=0.5](3,2){1}(2,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \begin{optionlist}
%   \optitem[1]{oapmirroraperture}{\prm{num} or \prm{inner} \prm{outer}}
%   \ifGERMAN 
%   Apertur des Spiegels bezogen auf die Eingangsrichtung. Wird eine
%   Zahl angegeben, dann gibt diese die gesamte Apertur an, die vertikal
%   und symmetrisch zur Verbindung zwischen \prm{in} und \prm{center}
%   gemessen wird. Bei zwei Zahlen geben diese die innere und äußere
%   Apertur an.
%   \fi
%   \ifENGLISH 
%   Mirror aperture with respect to the input direction. If a single
%   number is given, it specifies the whole aperture, measured
%   perpendicularly and symmetric to the connection from \prm{in} to
%   \prm{center}. Two numbers give the inner and the outer apertures.
% \fi
% \end{optionlist}
% 
% \ifGERMAN \newpage
% Die Konstruktion des Spiegels anhand der vorgegebenen Punkte geschieht
% wie folgt: Die Gerade von Knoten \prm{in} zu \prm{center} liegt
% parallel zur optischen Achse, \prm{focus} gibt den Fokuspunkt der
% Parabel an. Die Apertur des Spiegels wird mittels des Parameters
% \Lkeyword{oapmirroraperture} angegeben, gemessen senkrecht zum
% einfallenden Strahl.
%
% Die unterschiedlichen Parameter und die zugrundeliegende ganze Parabel
% sind in der folgenden Skizze dargestellt:
% \fi
% \ifENGLISH 
% The mirror construction using the given nodes is done as follows: the
% line from node \prm{in} to \prm{center} is parallel to the optical
% axis, \prm{focus} specifies the focal point of the parabola. The
% mirror aperture is given by the parameter
% \Lkeyword{oapmirroraperture}, measured perpendicular to the incoming
% beam.
%
% The different parameters and the whole original parabola are shown in
% the following illustration:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\ifENGLISH
\begin{LTXexample}[linerange={1-2,4-6,15-15}]
\begin{pspicture}(6,5)
\pnodes(5.5,3){In}(1.5,3){Center}(1.5,1.5){Focus}
\oapmirror[oapmirroraperture=3 2, linestyle=dashed, style=Refline](In)(Center)(Focus)
\oapmirror[oapmirroraperture=1.5, linewidth=3\pslinewidth, plotpoints=200](In)(Center)(Focus){OAP}
\multido{\r=-0.5+0.5}{3}{%
  \drawbeam[beampos=\r](In){}(Focus)}
\psset{style=Refline}\color{Refline}
\psdot(In)\uput[0](In){In}\psdot(Center)\uput[180](Center){\rput[r](0,0){Center}}\psdot(Focus)\uput[-90](Focus){Focus}
\pnodes([Xnodesep=1]Center){TmpA}([Xnodesep=1,offset=0.75]Center){TmpB}
\psline[arrowscale=1.5, arrows=<->](TmpA)(TmpB)\rput[l]([Xnodesep=0.3]TmpB){outer aperture}
\pnode([Xnodesep=1,offset=-0.75]Center){TmpB}
\psline[arrowscale=1.5, arrows=<->](TmpA)(TmpB)\rput[l]([Xnodesep=0.3]TmpB){inner aperture}
\pnode(In|Focus){Tmp}
\psline[linestyle=dotted]([Xnodesep=-1.5]Focus)(Tmp)\rput[r]([offset=-0.5]Tmp){optical axis}
\end{pspicture}
\end{LTXexample}
\fi\ifGERMAN
\begin{LTXexample}[linerange={1-2,4-6,15-15}]
\begin{pspicture}(6,5)
\pnodes(5.5,3){In}(1.5,3){Center}(1.5,1.5){Focus}
\oapmirror[oapmirroraperture=3 2, linestyle=dashed, style=Refline](In)(Center)(Focus)
\oapmirror[oapmirroraperture=1.5, linewidth=3\pslinewidth, plotpoints=200](In)(Center)(Focus){OAP}
\multido{\r=-0.5+0.5}{3}{%
  \drawbeam[beampos=\r](In){}(Focus)}
\psset{style=Refline}\color{Refline}
\psdot(In)\uput[0](In){In}\psdot(Center)\uput[180](Center){\rput[r](0,0){Center}}\psdot(Focus)\uput[-90](Focus){Focus}
\pnodes([Xnodesep=1]Center){TmpA}([Xnodesep=1,offset=0.75]Center){TmpB}
\psline[arrowscale=1.5, arrows=<->](TmpA)(TmpB)\rput[l]([Xnodesep=0.3]TmpB){aeussere Apertur}
\pnode([Xnodesep=1,offset=-0.75]Center){TmpB}
\psline[arrowscale=1.5, arrows=<->](TmpA)(TmpB)\rput[l]([Xnodesep=0.3]TmpB){innere Apertur}
\pnode(In|Focus){Tmp}
\psline[linestyle=dotted]([Xnodesep=-1.5]Focus)(In|Focus)\rput[r]([offset=-0.5]Tmp){optische Achse}
\end{pspicture}
\end{LTXexample}
\fi
% \iffalse
%</ignore>
% \fi
%
%
% \ifGERMAN\section{Strahlteiler}\fi
% \ifENGLISH\section{Beamsplitter}\fi
%
% \begin{ltxsyntax}
% \tripoledesc{beamsplitter}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \beamsplitter[beam](0,1)(2,1)(2,0){BS}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[0.8]{bssize}
% \ifGERMAN Die Größe des Strahlteilers.\fi
% \ifENGLISH The beamsplitter size.\fi
%  
% \choitem[cube]{bsstyle}{cube, plate} 
% \ifGERMAN
% Wählt zwischen zwei Strahlteilertypen: einem Strahlteilerwürfel (\opt{cube})
% und einem halbdurchlässigen Spiegel (\opt{plate}). Dieser halbdurchlässige
% Spiegel ist äquivalent zu \Lcomp{mirror} mit
% \Lkeyword{mirrortype}\opt{=semitrans} für \Lkeyword{mirrordepth}\opt{=0}.
% \fi
% \ifENGLISH
% Selects between two types of beamsplitters: the beamsplitter cube (\opt{cube})
% and the semitransparent mirror (\opt{plate}).  This semitransparent mirror ist
% equivalent to \Lcomp{mirror} with \Lkeyword{mirrortype}\opt{=semitrans} and
% \Lkeyword{mirrordepth}\opt{=0}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{bsstyle}}]
\begin{pspicture}(3,2)
  \beamsplitter[bsstyle=plate, beam](0,1)(2,1)(2,0){BS}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Optisches Gitter}\fi
% \ifENGLISH\section{Optical grating}\fi
% 
% \begin{ltxsyntax}
% \tripoledesc{optgrating}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \optgrating[beam](0,2)(1.8,1.5)(0,0){G}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \begin{optionlist}
% \numitem[1]{gratingwidth} 
% \ifGERMAN Die Breite des Gitters.\fi
% \ifENGLISH The width of the grating.\fi
% 
% \numitem[0.15]{gratingheight} 
% \ifGERMAN Die Gesamthöhe des Gitters.\fi
% \ifENGLISH The total height of the grating.\fi
% 
% \numitem[0.075]{gratingdepth}
% \ifGERMAN 
% Die absolute Modulationstiefe der Gitterstruktur. Die Gesamthöhe wird
% an diesen Wert angepasst falls sie kleiner als die Modulationtiefe ist, 
% andernfalls wird sie nicht beinflusst.
% \fi
% \ifENGLISH
% The modulation depth of the grating structure. The total height is
% adapted to this value if it is smaller than the modulation
% depth. Otherwise the total height is not affected.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{gratingdepth}}]
\begin{pspicture}(3,2)
  \optgrating[gratingdepth=0.05, 
                beam](0,2)(1.8,1.5)(0,0){G}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \intitem[10]{gratingcount} 
% \ifGERMAN Die Anzahl der Gitterlinien.\fi
% \ifENGLISH The number of grating grooves.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{gratingcount}}]
\begin{pspicture}(3,2)
  \optgrating[gratingcount=3, 
                beam](0,2)(1.8,1.5)(0,0){G}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \choitem[blazed]{gratingtype}{blazed, binary} 
% \ifGERMAN 
% Wählt zwischen einem binären Gitter (\opt{binary}) und einem Blazegitter
% (\opt{blazed}).
% \fi
% \ifENGLISH
% Select between a \opt{binary} and a \opt{blazed} grating.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{gratingtype}}]
\begin{pspicture}(3,2)
  \optgrating[gratingtype=binary, 
                beam](0,2)(1.8,1.5)(0,0){G}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[top]{gratingalign}{t, top, c, center} 
% \ifGERMAN 
% Wählt, ob die Reflektionsebene auf den Gitterspitzen (\opt{top}), oder
% in der Mitte des Gitters (\opt{center}) liegt. Wählt man \opt{center}
% aus, macht es Sinn die \Lenv{optexp}-Umgebung oder eine
% halbtransparente Strahlfüllung zu verwenden.
% \fi
% \ifENGLISH
% Selects if the reflection plane resides on \opt{top} of the grating or
% in its \opt{center}. If you choose \opt{center}, you should use the
% \Lenv{optexp} environment or a semitransparent beam filling. 
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{gratingalign}}]
\begin{pspicture}(3,2)
\pnodes(0.5,0){A}(0.5,1.5){B}(2,1.5){C}(2,0){D}
\psset{unit=1.5, labeloffset=0.4}
\begin{optexp}
  \optgrating[gratingalign=top](A)(B)(C){top}
  \optgrating[gratingalign=center](B)(C)(D){center}
  \drawwidebeam[fillstyle=solid, fillcolor=green!50, beamwidth=0.5](A){-}(D)
\end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \boolitem[false]{reverse} 
% \ifGERMAN
%   Invertiert die Steigung des Blazegitters.
% \fi
% \ifENGLISH
%   Reverse the slope of the grooves of the \opt{blazed} grating.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{reverse}}]
\begin{pspicture}(3,2)
  \optgrating[reverse, beam](0,2)(1.8,1.5)(0,0){grating}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \optitem[0.7\nxLcs{pslinewidth}]{gratinglinewidth}{\prm{num} or \prm{dimen}} 
% \ifGERMAN \linewidthexplanation{des Gitters}{Gitter}\fi
% \ifENGLISH \linewidthexplanation{grating}{gratings}\fi
% \end{optionlist}
%
% \ifGERMAN\section{Transmissionsgitter}\fi
% \ifENGLISH\section{Transmission grating}\fi
% 
% \begin{ltxsyntax}
% \tripoledesc{transmissiongrating}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \transmissiongrating[beam](0,1)(1.5,1)(3,0.5){TG}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifGERMAN 
% Das Transmissiongitter unterstützt alle Optionen von
% \Lcomp{optgrating}. Der Strahlengang wird so berechnet, dass der
% Strahl an einer Ebene senkrecht zum dargestellten Gitter reflektiert
% wird. Diese Ebene ist im folgenden Beispiel dargestellt:
% \fi
% \ifENGLISH
% The transmission grating supports all options of
% \Lcomp{optgrating}. The beam path is calculated such, that the beam is
% reflected at an interface which is perpendicular to the drawn
% grating. This virtual interface is shown in the following example:
% \fi
%
% \hspace*{\fill}%
% \begin{pspicture}(3,3)
%  \transmissiongrating[beam, label=0 . . relative](0,1)(1.5,1)(3,0.5){\psline[linewidth=0.7\pslinewidth, linestyle=dashed](0,-1)(0,1)}
%   \ifENGLISH
%     \rput[lB](0,2.4){\parbox{3cm}{virtual reflection interface}}
%   \fi
%   \ifGERMAN
%     \rput[lB](0,2.4){\parbox{3cm}{Virtuelle \\ Reflexionsebene}}
%   \fi
% \end{pspicture}
% \hspace*{\fill}%
% \begin{pspicture}(3.5,3)
%   \pnodes(0,1.3){A}(2,1.3){B}(1,0.3){C}
%   \optgrating[reverse, gratingcount=9](A)(B)(C)
%   \optplane[angle=45](C)
%   \addtopsstyle{Beam}{ArrowInside=->, ArrowInsidePos=0.8, arrowinset=0, arrowscale=1.5}
%   \drawbeam[linecolor=black](A){1}
%   \addtopsstyle{Beam}{loadbeam, savebeam=false}
%   \drawbeam[linecolor=green]{1-2}
%   \drawbeam[linecolor=red, beamangle=15]{1-2}
%   \drawbeam[linecolor=blue, beamangle=-15]{1-2}
%   \ifENGLISH
%     \rput[lB](0,2.4){\parbox{5cm}{reflection grating\\\Lcomp{optgrating}}}
%   \fi
%   \ifGERMAN
%     \rput[lB](0,2.4){\parbox{5cm}{Reflexionsgitter\\\Lcomp{optgrating}}}
%   \fi
% \end{pspicture}
% \hspace*{\fill}%
% \begin{pspicture}(4,3)
%   \pnodes(0,1.3){A}(2,1.3){B}(4,1){C}
%   \transmissiongrating[reverse, gratingcount=9](A)(B)(C)
%   \optplane[angle=-30](C)
%   \addtopsstyle{Beam}{ArrowInside=->, ArrowInsidePos=0.8, arrowinset=0, arrowscale=1.5}
%   \drawbeam[linecolor=black](A){1}
%   \addtopsstyle{Beam}{loadbeam, savebeam=false}
%   \drawbeam[linecolor=green]{1-2}
%   \drawbeam[linecolor=red, beamangle=5]{1-2}
%   \drawbeam[linecolor=blue, beamangle=-5]{1-2}
%   \ifENGLISH
%     \rput[lB](0,2.4){\parbox{5cm}{transmission grating\\\Lcomp{transmissiongrating}}}
%   \fi
%   \ifGERMAN
%     \rput[lB](0,2.4){\parbox{5cm}{Transmissionsgitter\\\Lcomp{transmissiongrating}}}
%   \fi
% \end{pspicture}
% \hspace*{\fill}%
% 
% \ifENGLISH If this is not what you want, you may e.g. rotate the
% component further with \Lkeyword{angle}, and then adjust also the
% \Lkeyword{beamangle}.
% \fi 
% \ifGERMAN Ist dieses Verhalten nicht gewünscht, so kann man z.B. die
% Komponente mit \Lkeyword{angle} weiter drehen, und den Strahlwinkel
% mit \Lkeyword{beamangle} entsprechend korrigieren.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.4)
  \pnodes(0,1){A}(1,1){B}(3,0.6){C}
  \transmissiongrating[angle=-10, reverse](A)(B)(C){TG}
  \addtopsstyle{Beam}{ArrowInside=->, ArrowInsidePos=0.8, arrowinset=0, arrowscale=1.5}
  \drawbeam[linecolor=black](A){1}
  \drawbeam[linecolor=green, loadbeam, beamangle=20]{1}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\section{Akustooptischer Modulator}\fi
% \ifENGLISH\section{Acousto-optic modulator}\fi
%
% \begin{ltxsyntax}
%   \xLtripole{optaom}\compitem{optaom}[options](in)(trans)(diff){label}
% \end{ltxsyntax}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-3,7-7}]
\begin{pspicture}(3,2)
  \pnodes(0,1.5){A}(3,0.5){B}(3,1.5){C}
  \optaom[beam](A)(B)(C){AOM}
  \psdots(A)(B)(C)
  \color{Refline}
  \uput[-90](A){A}\uput[-90](B){B}\uput[-90](C){C}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN 
% Dieses Makro stellt einen akustooptischen Modulator dar. Dieser kann,
% ähnlich einem \Lcomp{beamsplitter} entweder transmittierend oder
% reflektierend sein. Beachten Sie, dass die Knoten nicht so angeordnet
% sind, wie bei den üblichen Tripolen wie z. B. dem
% \Lcomp{optgrating}. Der mittlere Knoten gibt die Richtung eines
% transmittierten, und der dritte Knoten die Richtung der ersten
% Beugungsordnung an.
%
% Diese erste Umsetzung des AOM in Version 4.8 ist
% noch etwas experimentell, da ich nicht genügend Testfälle hatte um
% alle Eventualitäten zu prüfen. Es könnten sich also noch Änderungen
% ergeben, die nicht abwärts kompatibel sind. 
% \fi
% \ifENGLISH
% This macro draw an acousto-optic modulator, which either be
% transmittive or reflective, like a \Lcomp{beamsplitter}. Please note,
% that the nodes do not correspond to those of a usual tripole like an
% \Lcomp{optgrating}. The second node is in the direction of the
% transmitted beam, the third node gives the direction of the first
% diffraction order.
%
% This first implementation in version 4.8 is still experimental,
% because I didn't have enough test cases to check all possible
% cases. Therefore, future versions may have changes, which are not
% backwards compatible.
% \fi
%
% \begin{optionlist}
% \numitem[1]{aomheight}
% \ifGERMAN Die Höhe des Modulators.\fi
% \ifENGLISH The height of the modulator.\fi
%
% \numitem[1.5]{aomwidth}
% \ifGERMAN Die Breite des Modulators.\fi
% \ifENGLISH The width of the modulator.\fi
%
% \optitem{aomsize}{\prm{width} \prm{height}}
% \ifGERMAN Die Breite und Höhe des Modulators, äquivalent zum Aufruf von
% \Lkeyword{aomwidth} und \Lkeyword{aomheight}.
% \fi
% \ifENGLISH The width and height of the modulator, is equivalent to calling both
% \Lkeyword{aomwidth} and \Lkeyword{aomheight}.
% \fi
%
% \intitem[9]{aomgratingcount}
% \ifGERMAN 
% Gibt die Anzahl der Gitterlinien an. Werden weitere Änderungen des
% Gitters oder des Modulators allgemein gewünscht, dann muss der Parameter
% \Lkeyword{aomcomp} verwendet werden.
% \fi
% \ifENGLISH 
% Changes the number of grating lines. For other changes of the grating
% you must use the \Lkeyword{aomcomp} parameter to redefine the whole grating.
% \fi
%
% \choitem[symmetric]{aomalign}{symmetric, straight}
% \ifGERMAN 
% Die Ausrichtung eines \Lcomp{optaom} bezüglich der drei Referenzknoten
% kann mit diesem Parameter eingestellt werden. Die symmetrische
% (\opt{symmetric}) Ausrichtung ist im folgenden Beispiel zu sehen:
% \fi
% \ifENGLISH 
% The alignment of an \Lcomp{optaom} with respect to the three reference
% nodes can be set with this option. The \opt{symmetric} alignment is
% shown in the following example:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-6,11-11}]
\begin{pspicture}(3,2)
  \pnodes(0,1.5){A}(3,0.5){B}(3,1.5){C}
  \optaom[aomalign=symmetric](A)(B)(C){symmetric}
  \addtopsstyle{Beam}{fillstyle=solid, linestyle=none, beamwidth=0.1}
  \drawwidebeam[fillcolor=red!50](A){}(C)
  \drawwidebeam[fillcolor=red](A){}(B)
  \color{Refline}
  \psdot(A)\uput[-90](A){A}
  \psdot(B)\uput[-90](B){B}
  \psdot(C)\uput[90](C){C}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% In der geraden (\opt{straight}) Ausrichtung sieht der Strahlengang wie
% folgt aus:
% \fi
% \ifENGLISH
% For \opt{straight} alignment the sketch looks like
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-6,11-11}]
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(3,1){B}(3,1.5){C}
  \optaom[aomalign=straight](A)(B)(C){straight}
  \addtopsstyle{Beam}{fillstyle=solid, linestyle=none, beamwidth=0.1}
  \drawwidebeam[fillcolor=red!50](A){}(C)
  \drawwidebeam[fillcolor=red](A){}(B)
  \color{Refline}
  \psdot(A)\uput[-90](A){A}
  \psdot(B)\uput[-90](B){B}
  \psdot(C)\uput[90](C){C}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[parallel]{aomreflalign}{perp, parallel}
% \ifGERMAN 
% Die Ausrichtung der reflektiven Grenzfläche kann entweder
% \opt{parallel} oder senkrecht (\opt{perp}) zur Komponente
% liegen. Diese Option ist lediglich aus technischer Sicht notwendig,
% die Richtung des reflektierten Strahls wird dadurch nicht
% verändert.
% \fi
% \ifENGLISH 
% The reflective interface can be oriented either \opt{parallel} or
% \opt{perp}endicular to the component. This option was necessary in
% first place for technical reasons, the direction of the reflected ray
% is not affected by this option.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-5,10-10}]
\begin{pspicture}(3,2)
  \pnodes(0,1.5){A}(3,0.5){B}(3,1.5){C}
  \optaom[aomreflalign=parallel](A)(B)(C){parallel}
  \addtopsstyle{Beam}{fillstyle=solid, linestyle=none, beamwidth=0.2}
  \drawwidebeam[fillcolor=red!50](A){}(C)
  \color{Refline}
  \psdot(A)\uput[-90](A){A}
  \psdot(B)\uput[-90](B){B}
  \psdot(C)\uput[90](C){C}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[linerange={1-5,10-10}]
\begin{pspicture}(3,2)
  \pnodes(0,1.5){A}(3,0.5){B}(3,1.5){C}
  \optaom[aomreflalign=perp](A)(B)(C){perp}
  \addtopsstyle{Beam}{fillstyle=solid, linestyle=none, beamwidth=0.2}
  \drawwidebeam[fillcolor=red!50](A){}(C)
  \color{Refline}
  \psdot(A)\uput[-90](A){A}
  \psdot(B)\uput[-90](B){B}
  \psdot(C)\uput[90](C){C}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Das folgende Beispiel zeigt einen Fall, der mit
% \Lkeyword{aomreflalign}\opt{=parallel} nicht funktioniert, da der
% Einfallswinkel so flach ist, dass die Schnittpunkte mit der
% reflektierenden Grenzfläche außerhalb der Komponente liegen:
% \fi
% \ifENGLISH
% The following example show a use case, which doesn't work properly
% with \Lkeyword{aomreflalign}\opt{=parallel}, because the incident
% angle is so shallow, that the intersection points with the interface
% lay outside of the component.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \pnodes(0,1.1){A}(3,0.8){B}(3,1.1){C}
  \optaom[aomreflalign=parallel](A)(B)(C){parallel}
  \addtopsstyle{Beam}{fillstyle=solid, linestyle=none, beamwidth=0.2}
  \drawwidebeam[fillcolor=red!50](A){}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[default]{aomcomp}{default, \prm{macro}}
% \ifGERMAN Tauscht die Gitterlinien durch eine beliebige Zeichung aus.\fi
% \ifENGLISH Changes the grating lines to an arbitrary drawing.\fi
%
% \intitem[2]{diffractionorders}
% \ifGERMAN 
% Die Anzahl der Beugungsordnungen (positive und negative), die mit
% \Lkeyword{beamdiffractionorder} ausgewählt werden können, also
% $-$\prm{num},$-$\prm{num}$+1$,\ldots ,\prm{num}.
%
% Gleichzeitig werden entsprechende Knoten
% \lstinline!\oenode{DO-1}{<comp>}!, \lstinline!\oenode{DO0}{<comp>}!,
% \lstinline!\oenode{DO1}{<comp>}! usw. definiert.
% \fi
% \ifENGLISH
% The number or diffraction orders (positive and negative) which can be
% selected with \Lkeyword{beamdiffractionorder},
% i.e. $-$\prm{num},$-$\prm{num}$+1$,\ldots ,\prm{num}.
%
% At the same time the nodes \lstinline!\oenode{DO-1}{<comp>}!,
% \lstinline!\oenode{DO0}{<comp>}!, \lstinline!\oenode{DO1}{<comp>}!
% etc. are defined.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,0.6)(4.3,3.6)
  \pnodes(0,2.5){A}(4,2){B}(4,2.5){C}
  \optaom[aomsize=1 2, aomreflalign=perp, diffractionorders=3](A)(B)(C)
  \addtopsstyle{Beam}{beamwidth=0.2, linestyle=none, fillstyle=solid}
  \drawwidebeam[fillcolor=red!40](A){}(C)
  \drawwidebeam[fillcolor=red](A){}(B)
  \multido{\i=-3+1}{7}{%
    \psdot(\oenode{DO\i}{})\uput[0](\oenode{DO\i}{}){\i}}%
\end{pspicture}%
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \intitem[\{\}]{beamdiffractionorder}
% \ifGERMAN
% Die Beugungsordnung, die für einen reflektierten Strahl durch den AOM
% verwendet wird. Wenn der Wert leer ist, \opt{\{\}} dann wird die
% Option ignoriert.
%
% Mit Verwendung dieser Option wird unmittelbar das Verhalten der
% Grenzfläche festgelegt, hängt also nicht von der relativen Position
% von AOM und der folgenden Komponente ab. Für
% \Lkeyword{beamdiffractionorder}$\neq 0$ wird der Strahl reflektiert,
% für den Wert $0$ hingegen transmittiert. Der Parameter
% \Lkeyword{beammode} wird dann ignoriert.
%
% Es können nur die Beugungsordnungen verwendet werden, die für die
% entsprechende Komponente mit \Lkeyword{diffractionorders} definiert
% wurden. Wird eine nicht-definierte Ordnung verwendet, dann wird die
% nächstliegende verwendet und eine Postscript-Warnung (siehe
% \Lkeyword{pswarning}) ausgegeben.
% \fi
% \ifENGLISH
% The diffraction order, which is used for a reflected beam going
% through the aom. The option is ignored if its value is empty
% \opt{\{\}}.
%
% By using this option you automatically select the behaviour of the
% interface, which then doesn't depend on the relative position of AOM
% and the following component. For \Lkeyword{beamdiffractionorder}$\neq
% 0$ a beam gets reflected, for the value $0$ it gets transmitted. The
% parameter \Lkeyword{beammode} is ignored.
%
% You can select only those orders, where have been defined for the
% respective component with \Lkeyword{diffractionorders}. If an
% undefined order is selected, the closest one is choosen instead and a
% Postscript warning is issued (see \Lkeyword{pswarning}).
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[pos=t, linerange={1-7,12-12}]
\begin{pspicture}(0,-0.2)(4.4,3.8)
  \pnodes(0,2.5){A}(4,2){B}(4,2.5){C}
  \optaom[aomsize=1 2, aomreflalign=perp, diffractionorders=3](A)(B)(C)
  \optplane(B)
  \addtopsstyle{Beam}{beamwidth=0.2, linestyle=none, fillstyle=solid}
  \multido{\i=-3+1,\r=10+15}{7}{%
    \drawwidebeam[fillcolor=red!\r, beamdiffractionorder=\i](A){-}}
  \color{Refline}
  \uput[90](A){A}\psdot(A)
  \uput[0](B){B}\psdot(B)
  \uput[0](C){C}\psdot(C)
\end{pspicture}%
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Prisma}\fi
% \ifENGLISH\section{Prism}\fi
% 
% \begin{ltxsyntax}
% \tripoledesc{optprism}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \optprism[beam](0,1)(2,1)(3,0){Prism}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \ifGERMAN
% Das Prisma wird immer symmetrisch bezüglich der \prm{in} und \prm{out}
% Knoten ausgerichtet. Für asymmetrischen Strahlengang siehe
% \prettyref{chap:connecting}.
% \fi
% \ifENGLISH
% The prism is always placed symmetric between \prm{in} and \prm{out}
% nodes. For asymmetric beam traces see \prettyref{chap:connecting}.
% \fi
%
% \begin{optionlist}
% \numitem[1]{prismsize} 
% \ifGERMAN Die Höhe des Prismas.\fi
% \ifENGLISH The height of the prism.\fi
%
% \numitem[60]{prismangle}
% \ifGERMAN Der obere Winkel des Prismas.\fi
% \ifENGLISH The upper angle of the prism.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]prismangle}]
\begin{pspicture}(3,2)
  \optprism[prismangle=30, beam](0,1)(2,1)(3,0){Prism}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[transmittive]{prismtype}{transmittive, reflective}
% \ifGERMAN Ist dieser Parameter auf \opt{reflective} gesetzt, so wird
% die Grundfläche als zusätzliche, reflektierende Grenzfläche
% verwendet.
% \fi
% \ifENGLISH If this parameter is set to \opt{reflective}, the prism
% base is used as additional, reflective interface.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]prismtype}]
\begin{pspicture}(1.5,0.6)(5.1,2.2)
  \optprism[prismtype=reflective](0,1)(3,0.9)(6,1)
  \lens(1,2)(\oenodeIfc{2}{1})
  \lens(\oenodeIfc{2}{1})(5,2)
  \drawwidebeam[beamwidth=0.3, fillstyle=solid, fillcolor=green, opacity=0.3](1,2){2}{1}{3}(5,2)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[auto]{prismalign}{auto,center}
% \ifENGLISH Sets the vertical alignment of the prism with respect to the
% «reflection» node \prm{center}. For \opt{auto}, the prism is shifted such,
% that the interface nodes lay on the connection between the respective
% reference node and the «reflection» node. If the value is \opt{center}, the
% «reflection» node coincides with the component center. See the following
% examples for further explanation.
% \fi
% \ifGERMAN Wählt die vertikale Ausrichtung des Prisma bezüglich des
% «Reflektionsknoten» \prm{center}. Ist der Wert \opt{auto}, so wird das Prisma
% so verschoben, dass die Grenzflächenknoten auf der Verbindungslinie zwischen
% dem entsprechenden Referenzknoten und dem «Reflektionsknoten» liegen. Für
% \opt{center} fällt der «Reflektionsknoten» mit der Komponentenmitte
% zusammen. Siehe die folgende Beispiele zur weiteren Erklärung.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{pspicture}(0,-0.5)(14,3.2)
  \footnotesize
  \pnodes(0,1){A}(2,2){B}(4,1){C}
  \psdot(A)\uput[90](A){A}
  \psdot(B)\uput[90](B){B}
  \psdot(C)\uput[90](C){C}
  \optprism[prismsize=2](A)(B)(C)
  \psline[style=Refline, linestyle=dashed](A)(B)(C)
  \newpsstyle{IfcDot}{dotstyle=+, linecolor=red, linewidth=1.5\pslinewidth}
  \psdot[style=IfcDot](\oenodeCenter{})\uput{0.1}[-90](\oenodeCenter{}){\prm{center}}
  \psdot[style=IfcDot](\oenodeIn{})\uput{0.1}[150](\oenodeIn{}){\prm{in}}
  \psdot[style=IfcDot](\oenodeOut{})\uput{0.1}[30](\oenodeOut{}){\prm{out}}
  \rput[t](\oenodeCenter{}|0,0.2){%
    \begin{tabular}{@{}c@{}}\opt{prismalign=auto}\\\opt{prismtype=transmittive}\end{tabular}}

  \pnodes(5,1){A}(7,2){B}(9,1){C}
  \psdot(A)\uput[90](A){A}
  \psdot(B)\uput[90](B){B}
  \psdot(C)\uput[90](C){C}
  \optprism[prismsize=2, prismalign=center](A)(B)(C)
  \psline[style=Refline, linestyle=dashed](A)(B)(C)
  \newpsstyle{IfcDot}{dotstyle=+, linecolor=red, linewidth=1.5\pslinewidth}
  \psdot[style=IfcDot](\oenodeCenter{})\uput{0.1}[-90](\oenodeCenter{}){\prm{center}}
  \psdot[style=IfcDot](\oenodeIn{})\uput{0.1}[150](\oenodeIn{}){\prm{in}}
  \psdot[style=IfcDot](\oenodeOut{})\uput{0.1}[30](\oenodeOut{}){\prm{out}}
  \rput[t](\oenodeCenter{}|0,0.2){%
    \begin{tabular}{@{}c@{}}\opt{prismalign=center}\\\opt{prismtype=transmittive}\end{tabular}}

  \pnodes(10,2){A}(12,1){B}(14,2){C}
  \psdot(A)\uput[90](A){A}
  \psdot(B)\uput[-90](B){B}
  \psdot(C)\uput[90](C){C}
  \optprism[prismsize=2, prismtype=reflective](A)(B)(C)
  \psline[style=Refline, linestyle=dashed](A)(B)(C)
  \newpsstyle{IfcDot}{dotstyle=+, linecolor=red, linewidth=1.5\pslinewidth}
  \psdot[style=IfcDot](\oenodeCenter{})\uput{0.1}[90](\oenodeCenter{}){\prm{center}}
  \psdot[style=IfcDot](\oenodeIn{})\uput{0.1}[-160](\oenodeIn{}){\prm{in}}
  \psdot[style=IfcDot](\oenodeOut{})\uput{0.1}[-20](\oenodeOut{}){\prm{out}}
  \rput[t](\oenodeCenter{}|0,0.2){%
    \begin{tabular}{@{}c@{}}\opt{prismalign=auto}\\\opt{prismtype=reflective}\end{tabular}}
\end{pspicture}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Umkehrprisma}\fi
% \ifENGLISH\section{Right-angle prism}\fi
% 
% \begin{ltxsyntax}
% \tripoledesc{rightangleprism}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \psdot(1.8,1)
  \rightangleprism[beam](0,1.5)(1.8,1)(0,0.5){RA}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \ifGERMAN
% Das Umkehrprisma wird so ausgerichtet, dass der einfallende und der
% reflektierte Strahl parallel sind und der \prm{center} Knoten vertikal
% zentriert in dem Prisma liegt.
% \fi
% \ifENGLISH
% The right-angle prisms is align such that the incoming and reflected
% beam are parallel and the \prm{center} node is vertically centered in
% the prism.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3.5,2)
  \pnodes(0,2){A}(2.5,0.5){G}(0,1.5){B}
  \begin{optexp}
  \rightangleprism[beam, showifcnodes, showoptdots](A)(G)(B){RA}
  \end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \begin{optionlist}
% \numitem[1.5]{raprismsize}
% \ifGERMAN Die Länge der Eingangsfläche.\fi
% \ifENGLISH The length of the input plane.\fi
%
% \choitem[auto]{raprismalign}{auto, center}
% \ifGERMAN Schaltet die automatische Positionierung der Komponente
% vertikal zur Eingangsfläche ein oder aus:
% \fi
% \ifENGLISH Switch between automatic and fixed alignment of the
% component vertical to the entrance interface:
% \fi
%
% \begin{pspicture}(0,-0.5)(13,2)
%   \pnodes(0,1.6){A}(0,0.4){B}
%   \rightangleprism(A)(2,1)(B)\psdot(\oenodeCenter{})
%   \drawbeam(A){}(B)
%   \pnodes(3,1.2){A}(3,0.8){B}
%   \rightangleprism(A)(5,1)(B)\psdot(\oenodeCenter{})
%   \drawbeam(A){}(B)
%   \rput[t](3,0){\opt{raprismalign=auto}}
%   \psset{raprismalign=center}
%   \pnodes(7,1.6){A}(7,0.4){B}
%   \rightangleprism(A)(9,1)(B)\psdot(\oenodeCenter{})
%   \drawbeam(A){}(B)
%   \pnodes(10,1.2){A}(10,0.8){B}
%   \rightangleprism(A)(12,1)(B)\psdot(\oenodeCenter{})
%   \drawbeam(A){}(B)
%   \rput[t](10,0){\opt{raprismalign=center}}
% \end{pspicture}
%
% \end{optionlist}
% 
% \ifGERMAN\section{Pentaprisma}\fi
% \ifENGLISH\section{Penta prism}\fi
% 
% \begin{ltxsyntax}
% \tripoledesc{pentaprism}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \pentaprism[beam](0,1)(2,1)(2,0){PP}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
%   \numitem[0.7]{pentaprismsize} 
%   \ifGERMAN Die Länge der Eingangs- und Ausgangsfläche.\fi
%   \ifENGLISH The length of the input and output plane.\fi
% \end{optionlist}
% 
% 
% \ifGERMAN\chapter{Faserkomponenten}\fi
% \ifENGLISH\chapter{Fiber components}\fi
% \label{chap:fibercomp}
%
% \ifENGLISH This chapter describes all fiber components and their
% options. They differ from free-ray components in that they are
% connected by default with fibers to their reference nodes, and that
% they cannot be used for raytracing. Instead of automatic fiber
% connections the components can also be connected manually with fibers,
% see \prettyref{sec:drawfiber}.
%
% Most components require only two reference nodes and are handled like
% the free-ray dipoles. Some special components like couplers
% (\prettyref{sec:coupler}) and circulators
% (\prettyref{sec:optcirculator}) are treated differently.
% \fi
% \ifGERMAN In diesem Kapitel werden alle Faserkomponenten und deren
% Parameter beschrieben. Diese werden automatisch über Fasern mit ihren
% Referenzknoten verbunden und unterstützen kein Raytracing. Anstelle
% der automatischen Faserverbindungen können die Komponenten auch
% manuell mit Fasern verbunden werden, siehe \prettyref{sec:drawfiber}.
%
% Die meisten Komponenten benötigen nur zwei Referenzknoten und werden
% wie die Freistrahlzweipole behandelt. Manche spezielle Komponenten wie
% Koppler (\ref{sec:coupler}) und Zirkulatoren (\compref{optcirculator})
% werden anders ausgerichtet.
% \fi
%
% \begin{optionlist}
%   \boolitem{usefiberstyle} 
%   \ifGERMAN
%   Bei manchen Komponenten (z.B. \Lcomp{optfilter} oder \Lcomp{optmzm})
%   kann es vorteilhaft sein interne Faserteile hervorzuheben. Mit
%   diesem Parameter werden z.B. die durchlässigen Teile eines Filter
%   angezeigt und mit dem \Lstyle{Fiber}-Stil gezeichnet. In der
%   Dokumentation ist dieses Verhalten angeschaltet um die betroffenen
%   Bereiche hervorzuheben. Hat Vorrang vor der Option
%   \Lkeyword{usewirestyle}, sind beide Optionen gesetzt, dann wird eine
%   Faser gezeichnet.
%   \fi
%   \ifENGLISH
%   For some components (e.g. \Lcomp{optfilter} or \Lcomp{optmzm}) it
%   can be nice to highlight some internals. For example, if this option
%   is enabled the passing parts of the optical filter are drawn with
%   the \Lstyle{Fiber} style. In the documentation this parameter is
%   enabled to show the parts which are affected. Takes precedence over
%   \Lkeyword{usewirestyle}.
%   \fi
%   \boolitem{usewirestyle} 
%   \ifGERMAN
%   Kann verwendet werden, um interne Verbindungen als \Lstyle{Wire}
%   darzustellen. Setzt \Lkeyword{usefiberstyle} auf \opt{false}, daher
%   kann es sinnvoll sein, z.B. einen elektrischen Filter zu definieren:
%   \fi
%   \ifENGLISH
%   Can be used to draw internal connections als \Lstyle{Wire}. Sets
%   \Lkeyword{usefiberstyle} to \opt{false}, therefore it can be useful
%   to define e.g. an electrical filter:
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{lstlisting}
\newpsobject{elecfilter}{optfilter}{usewirestyle}
\end{lstlisting}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Optische Faser}\fi
% \ifENGLISH\section{Optical fiber}\fi
% 
% \begin{ltxsyntax}
% \fiberdipoledesc{optfiber}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optfiber[label=0.3](0,0.5)(3,0.5){SSMF}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \begin{optionlist}
% \intitem[3]{fiberloops} 
% \ifGERMAN Anzahl der Faserschleifen.\fi
% \ifENGLISH Number of the fiber loops.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fiberloops}]
\begin{pspicture}(3,1.5)
  \optfiber[fiberloops=2, label=0.3](0,0.5)(3,0.5){SSMF}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \numitem[0.4]{fiberloopradius}
% \ifGERMAN Radius der Faserschleifen.\fi
% \ifENGLISH Radius of the fiber loops.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fiberloopradius}]
\begin{pspicture}(3,1.5)
  \optfiber[fiberloopradius=0.2, label=0.3](0,0.5)(3,0.5){SSMF}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \numitem[0.2]{fiberloopsep}
% \ifGERMAN Abstand zwischen zwei aufeinanderfolgenden Faserschleifen.\fi
% \ifENGLISH Separation between two successive fiber loops.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fiberloopsep}]
\begin{pspicture}(3,1.5)
  \optfiber[fiberloopsep=0.6, label=0.3](0,0.5)(3,0.5){SSMF}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Optischer Verstärker}\fi
% \ifENGLISH\section{Optical amplifier}\fi
%
% \begin{ltxsyntax}
% \fiberdipoledesc{optamp}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optamp(0,1)(3,1){EDFA}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \optitem[0.8]{optampsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Eine einzelne Zahl gibt die Seitenlänge des Verstärkers an, zwei Zahlen die
% Breite und Höhe. Beachten Sie, dass \opt{optampsize=1} und \opt{optampsize=1
% 1} nicht dasselbe Ergebnis liefern. Alternativ kann das Verhältnis zwischen
% Höhe und Breite mit \opt{xunit} und \opt{yunit} geändert werden.
% \fi
% \ifENGLISH
% A single number gives the side length of the amplifier, two numbers the width
% and height. Note, that \opt{optampsize=1} and \opt{optampsize=1 1} do not give
% the same result. You may also change the relation of width and height with
% \opt{xunit} and \opt{yunit}.
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Mach-Zehnder-Modulator}\fi
% \ifENGLISH\section{Mach--Zehnder modulator}\fi
% 
% \begin{ltxsyntax}
% \fiberdipoledesc{optmzm}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optmzm(0,1)(3,1){MZM}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \optitem[0.8]{optmzmsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Eine einzelne Zahl gibt die Höhe des Modulators an, die Breite ist \opt{1.6} mal die
% Höhe. Zwei Zahlen geben Breite und Höhe des Modulators direkt an.
% \fi
% \ifENGLISH
% A single number gives the modulator height, the width is \opt{1.6} times the
% height. Two numbers define width and height directly.
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Polarisationssteller}\fi
% \ifENGLISH\section{Polarization controller}\fi
% 
% \begin{ltxsyntax}
% \fiberdipoledesc{polcontrol}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \polcontrol(0,1)(3,1){PC}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[0.15]{polcontrolsize} 
% \ifGERMAN Der Radius der Polarisationssteller-Kreise.\fi
% \ifENGLISH The radius of the polarization controller circles.\fi
%
% \choitem[linear]{polcontroltype}{linear, triangle}
% \ifGERMAN Der Typ des Polarisationsstellers.\fi
% \ifENGLISH The type of polarization controller.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]polcontroltype}]
\begin{pspicture}(3,1.5)
  \polcontrol[polcontroltype=triangle](0,1)(3,1){PC}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Isolator}\fi
% \ifENGLISH\section{Isolator}\fi
% 
% \begin{ltxsyntax}
% \fiberdipoledesc{optisolator}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optisolator(0,1)(3,1){isolator}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \optitem[0.6]{isolatorsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Eine einzelne Zahl gibt die Höhe des Isolators an, die Breite ist \opt{1.6} mal die
% Höhe. Zwei Zahlen geben Breite und Höhe des Isolators direkt an.
% \fi
% \ifENGLISH
% A single number gives the isolator height, the width is \opt{1.6} times the
% height. Two numbers define width and height directly.
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem[linewidth=2\cs{pslinewidth}, arrowinset=0]{IsolatorArrow} 
% \ifGERMAN 
% Der Stil für den Isolatorpfeil. Das kann insbesondere nützlich sein um
% die Länge des Pfeils zu verändern. 
% \fi
% \ifENGLISH 
% The style of the isolator arrow. This can be especially useful to
% adapt the length of the arrow.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]IsolatorArrow}]
\begin{pspicture}(3,1.5)
  \addtopsstyle{IsolatorArrow}{xunit=1.2}
  \optisolator(0,1)(3,1){isolator}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
% 
% \ifGERMAN\section{Optischer Schalter}\fi
% \ifENGLISH\section{Optical switch}\fi
% 
% \begin{ltxsyntax}
% \fiberdipoledesc{optswitch}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optswitch(0,1)(3,1){opened switch}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \optitem[0.8]{switchsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Wird nur eine Zahl angegeben, so ist das die Seitenlänge des
% Schalters, andernfalls können Breite und Höhe getrennt angegeben
% werden.
% \fi
% \ifENGLISH 
% A single number defines the side length of the switch, otherwise the
% height and width can be specified separately.
% \fi
%
% \choitem[opened]{switchstyle}{opened, closed} 
% \ifGERMAN Der Zustand des Schalters kann geschlossen (\opt{closed}) oder
% geöffnet (\opt{opened}) sein.
% \fi
% \ifENGLISH Indicate the switch as \opt{opened} or \opt{closed}.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]switchstyle}]
\begin{pspicture}(3,1.5)
  \optswitch[switchstyle=closed](0,1)(3,1){closed switch}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Faserverzögerungstrecke}\fi
% \ifENGLISH\section{Fiber delay-line}\fi
% 
% \begin{ltxsyntax}
% \fiberdipoledesc{fiberdelayline}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \fiberdelayline(0,1)(3,1){delay line}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \optitem[0.6]{fdlsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Eine einzelne Zahl gibt die Höhe der Komponente an, die Breite ist \opt{1.6}
% mal die Höhe. Zwei Zahlen geben Breite und Höhe der Komponente direkt an.
% \fi
% \ifENGLISH
% A single number gives the component height, the width is \opt{1.6} times the
% height. Two numbers define width and height directly.
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem[arrowinset=0, arrows=->]{FdlArrow} 
% \ifGERMAN 
% Siehe \Lstyle{ArrowCompStyle}.
% \fi
% \ifENGLISH 
% See \Lstyle{ArrowCompStyle}.
% \fi
% \end{stylelist}
% 
% \ifGERMAN\section{Polarisator}\fi
% \ifENGLISH\section{Polarizer}\fi
% 
% \begin{ltxsyntax}
% \fiberdipoledesc{optfiberpolarizer}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optfiberpolarizer(0,1)(3,1){polarizer}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \optitem[0.6]{fiberpolsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Eine einzelne Zahl gibt die Höhe der Komponente an, die Breite ist \opt{1.6}
% mal die Höhe. Zwei Zahlen geben Breite und Höhe der Komponente direkt an.
% \fi
% \ifENGLISH
% A single number gives the component height, the width is \opt{1.6} times the
% height. Two numbers define width and height directly.
% \fi
% \end{optionlist}
% 
%
% \ifGERMAN\section{Optischer Zirkulator}\fi
% \ifENGLISH\section{Optical circulator}\fi
%
% \label{sec:optcirculator}
% \begin{ltxsyntax}
% \xLfmultipole{optcirculator}%
% \compitem{optcirculator}(left)(right)(bottom){label}%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \addtopsstyle{Fiber}{arrows=->}
  \addtopsstyle{FiberOut1}{linecolor=blue}
  \addtopsstyle{FiberOut2}{linecolor=green!80!black}
  \optcirculator(0,1)(3,1)(1.5,0){Circulator}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \begin{optionlist}
% \numitem[0.8]{optcircsize}
% \ifGERMAN Der Durchmesser des Zirkulators.\fi
% \ifENGLISH The diameter of the circulator.\fi
%
% \numitem[-160]{optcircangleA}
% \ifGERMAN Der Startwinkel des internen Pfeils.\fi
% \ifENGLISH The starting angle of the internal arrow.\fi
%
% \numitem[-20]{optcircangleB}
% \ifGERMAN Der Endwinkel des internen Pfeils.\fi
% \ifENGLISH The ending angle of the internal arrow.\fi
%
% \optitem{optcircangle}{\prm{num} \prm{num}}
% \ifGERMAN Kurzschreibweise um beide Winkel gleichzeitig zu setzen.\fi
% \ifENGLISH Short notation to specifying both angles.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]optcircangle}]
\begin{pspicture}(3,1.5)
  \optcirculator[optcircangle=0 -90](0,1)(3,1)(1.5,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
% 
% \begin{stylelist}
% \styleitem[unit=0.7, arrows=->, arrowinset=0]{OptCircArrow}
% \ifGERMAN 
% Der Stil für den internen Pfeil. Damit wird sowohl die Richtung des Pfeils als
% auch die Größe des Bogens bestimmt.
% \fi
% \ifENGLISH The style of the internal arrow. It specifies the direction of the
% arrow and the size of the arc.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{optcircangle, OptCircArrow}}]
\begin{pspicture}(3,1.5)
  \newpsstyle{OptCircArrow}{unit=0.5, arrows=<-, arrowinset=0}
  \optcirculator[optcircangle=0 -90](0,1)(3,1)(1.5,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
%
% \ifENGLISH
% The circulator is positioned by default such that the input and output fibers
% are orthogonal to each other, like shown in the example:
% \fi
% \ifGERMAN
% Der Zirkulator wird so positioniert, dass Eingangs- und Ausgangsverbindung
% senkrecht zueinander stehen, wie das folgende Beispiel verdeutlicht:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \addtopsstyle{Fiber}{arrowscale=1.3, arrows=->, arrowinset=0}
  \optcirculator(0,0.5)(3,2)(1.5,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH The positioning parameters (\prettyref{sec:positioning}) refer to
% the reference nodes \prm{left} and \prm{right} as usual and are not related
% to the automatic position. This implies, that the default position is not
% equivalent to \Lkeyword{position}\opt{=0.5}.
% \fi
% \ifGERMAN Die Positionierungsparameter (\prettyref{sec:positioning}) beziehen
% sich wie üblich auf die Referenzknoten \prm{left} und \prm{right}, und nicht
% auf die automatisch bestimmte Position. Das bedeutet auch, dass die
% automatische Position i.a. nicht mit \Lkeyword{position}\opt{=0.5}
% übereinstimmt.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \addtopsstyle{Fiber}{arrowscale=1.3, arrows=->, arrowinset=0, ncurv=1.5}
  \optcirculator[position=0.5](0,0.5)(3,2)(1.5,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN\section{Faserkoppler}\fi
% \ifENGLISH\section{Fiber coupler}\fi
% \label{sec:coupler}
% 
% \ifGERMAN Es stehen drei Faserkoppler zur Verfügung, die alle die gleichen
% Formen und Parameter verwenden.
% \fi
% \ifENGLISH The package provides three fiber couplers which all share the same
% shapes and parameters.
% \fi
% \begin{ltxsyntax}
% \xLfmultipole{optcoupler}%
% \compitem{optcoupler}(tl)(bl)(tr)(br){label}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,-0.4)(3,1)
  \optcoupler(0,1)(0,0)(3,1)(3,0){optcoupler}  
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \xLfmultipole{wdmcoupler}%
% \compitem{wdmcoupler}(tl)(...)(bl)(r){label}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,-0.4)(3,1)
  \wdmcoupler(0,1)(0,0)(3,0.5){wdmcoupler}  
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \xLfmultipole{wdmsplitter}%
% \compitem{wdmsplitter}(l)(tr)(...)(br){label}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,-0.4)(3,1)
  \wdmsplitter(0,0.5)(3,1)(3,0){wdmsplitter}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \begin{optionlist}
% \optitem[0.2]{couplersize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Wird eine Zahl angegeben, so ist die Breite des Kopplers doppelt so groß, die
% Höhe entspricht \opt{0.8} mal dem Wert. Mit zwei Zahlen werden Breite und Höhe
% direkt angegeben.
% \fi
% \ifENGLISH
% For a single number the width is twice this value, the height \opt{0.8} times
% this value. Two numbers define width and height directly.
% \fi
%
% \numitem[0.05]{couplersep} 
% \ifGERMAN Der vertikale Abstand zwischen zwei Faserports.\fi
% \ifENGLISH The vertical distance between two fiber ports.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{couplersep}}]
\begin{pspicture}(0,-0.5)(3,1)
  \optcoupler[couplersep=0](0,1)(0,0)(3,1)(3,0){coupler}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH If this value is set to \{\}, the separation is calculated
% automatically according to the \Lkeyword{couplertype} and
% \Lkeyword{couplersize}.
% \fi
% \ifGERMAN Wird dieser Wert auf \{\} gesetzt, dann wird der Abstand
% automatisch berechnet, abhängig von \Lkeyword{couplertype} und
% \Lkeyword{couplersize}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{couplersep}}]
\begin{pspicture}(3,4.5)
  \psset{couplersep={}, couplersize=0.5, labeloffset=0.5}
  \optcoupler[couplertype=none]%
       (0,4.5)(0,3.5)(3,4.5)(3,3.5){none}
  \optcoupler[couplertype=rectangle]%
       (0,3)(0,2)(3,3)(3,2){rectangle}
  \optcoupler[couplertype=ellipse]%
       (0,1.5)(0,0.5)(3,1.5)(3,0.5){ellipse}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \choitem[ellipse]{couplertype}{none, ellipse, rectangle, cross}
% \ifGERMAN Wählt zwischen unterschiedlichen Kopplertypen.\fi
% \ifENGLISH Select between different coupler types.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{couplertype}}]
\begin{pspicture}(3,4.5)
  \psset{labeloffset=0.5}
  \optcoupler[couplertype=none]%
       (0,4.5)(0,3.5)(3,4.5)(3,3.5){none}
  \optcoupler[couplertype=rectangle]%
       (0,3)(0,2)(3,3)(3,2){rectangle}
  \optcoupler[couplertype=cross]%
       (0,1.5)(0,0.5)(3,1.5)(3,0.5){cross}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \choitem[center]{coupleralign}{t, top, b, bottom, c, center}
% \ifGERMAN Die Ausrichtung des Kopplers bezüglich der
% Referenzknoten. Beachten Sie, dass die Position der Komponentenmitte
% und damit der Beschriftung von dieser Einstellung abhängt (siehe
% \ref{sec:centernode}).
% \fi
% \ifENGLISH The alignment of the coupler with respect to the reference
% nodes. Note, that the exact position of the coupler center and
% accordingly that of the label depends on this setting (see
% \ref{sec:centernode}).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{coupleralign}}]
\begin{pspicture}(3,3)
  \psset{labeloffset=0.4}
  \optcoupler[coupleralign=top]%
               (0,3)(0,2)(3,3)(3,2){top}
  \optcoupler[coupleralign=bottom]%
               (0,1.5)(0,0.5)(3,1.5)(3,0.5){bottom}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem*[true]{variable}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{variable}}]
\begin{pspicture}(3,1)
  \optcoupler[variable](0,1)(0,0)(3,1)(3,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem[arrowinset=0, arrows=->]{VariableCoupler}
% \ifGERMAN
%   Der Stil des Pfeiles des verstellbaren Kopplers.
% \fi
% \ifENGLISH
% The style of the arrow of the variable coupler.
% \fi
% \end{stylelist}
%
% \ifGERMAN\subsection{Variable Knotenanzahl}\fi
% \ifENGLISH\subsection{Variable node count}\fi
% \ifGERMAN
% Jeder Koppler hat eine Variante, die nur zwei Knoten benötigt, einen Eingangs-
% und einen Ausgangsknoten. \Lcomp{optcoupler} verwendet jeden dieser Knoten
% zweimal, \Lcomp{wdmsplitter} verwendet den Knoten \prm{out} zweimal und
% \Lcomp{wdmcoupler} verwendet \prm{in} zweimal. Das kann sehr praktisch sein,
% wenn man für einen Koppler die automatischen Verbindungen nicht verwendet,
% sondern die Komponente manuell verbindet.
% \fi
% \ifENGLISH 
% Every coupler has a variant which needs only two nodes, one input and one
% output node. For \Lcomp{optcoupler}, both nodes are used twice,
% \Lcomp{wdmsplitter} uses node \prm{out} twice, and \Lcomp{wdmcoupler} uses node
% \prm{in} twice. This can be very useful if you do not use the automatic
% connections but connect the components manually.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,1){A}(4,1){B}
  \psset[optexp]{fiber=none}
  \wdmsplitter[position=0.2, coupleralign=b](A)(B)
  \wdmcoupler[position=0.8, coupleralign=t](A)(B)
  \drawfiber{(A)}{1}{2}{(B)}
  \drawfiber{1}{([offset=0.5, Xnodesep=1]\oenodeIfc{2}{1})}
  \drawfiber{([offset=-0.5, Xnodesep=-1]\oenodeIfc{2}{2})}{2}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Des Weiteren kann ein \Lcomp{wdmcoupler} mehr als zwei Eingangsknoten haben, ein
% \Lcomp{wdmsplitter} mehr als zwei Ausgangsknoten.\fi
% \ifENGLISH A \Lcomp{wdmcoupler} can have more than two input nodes, a \Lcomp{wdmsplitter}
% more than two output nodes.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,2){A}(0,1.2){B}(0,0.8){C}(0,0){D}(4,1){E}
  \wdmcoupler(A)(B)(C)(D)(E){coupler}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,1){A}(4,2){B}(4,1.2){C}(4,0.8){D}(4,0){E}
  \wdmsplitter(A)(B)(C)(D)(E){splitter}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Die Ausrichtung der Komponente wird anhand des Mittelpunkts aller Eingangs-
% (\Lcomp{wdmcoupler}) bzw. Ausgangsknoten (\Lcomp{wdmsplitter})
% berechnet, falls nicht \Lkeyword{coupleralign} verwendet wird.\fi
% \ifENGLISH The component's orientation is calculated from the median of all input nodes
% (\Lcomp{wdmcoupler}) or all output nodes (\Lcomp{wdmsplitter}), unless \Lkeyword{coupleralign}
% is used.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,2){A}(0,0.5){B}(0,0){C}(4,1){D}
  \wdmcoupler(A)(B)(C)(D){coupler}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,2){E}(0,0.5){F}(0,0){G}(4,2){H}
  \wdmcoupler[coupleralign=t](E)(F)(G)(H){coupler}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,1){A}(4,2){B}(4,0.5){C}(4,0){D}
  \wdmsplitter(A)(B)(C)(D){splitter}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \pnodes(0,0.5){E}(4,2){F}(4,1.5){G}(4,0){H}
  \wdmsplitter[coupleralign=b](E)(F)(G)(H){splitter}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \ifGERMAN\subsection{Eingangs- und Ausgangsknoten}\fi
% \ifENGLISH\subsection{Input and output nodes}\fi
% \label{sec:coupler-nodes}
%
% \ifGERMAN
% Die Definition der Eingangs- und Ausgangsknoten aus \prettyref{sec:ifcnode}
% ist für Koppler nicht anwendbar. Hier werden die Knoten einfach von \opt{1}
% (links oben) bis \opt{N} (rechts unten) durchnummeriert.
% \fi
% \ifENGLISH
% The definition of input and output nodes from \prettyref{sec:ifcnode} cannot
% be applied to couplers. Here, the nodes are simply numbered from \opt{1} (left
% top) to \opt{N} (right bottom).
% \fi
% \begin{center}
% \begin{pspicture}(11,2)
% \psset{couplersize=0.6, couplertype=rectangle, couplersep=0.25}
% \wdmsplitter(0,1.25)(3,2)(3,1.25)(3,0.5)
% \psdot(\oenodeIfc{1}{})\uput[120](\oenodeIfc{1}{}){1}
% \psdot(\oenodeIfc{2}{})\uput[90](\oenodeIfc{2}{}){2}
% \psdot(\oenodeIfc{3}{})\uput[180](\oenodeIfc{3}{}){3}
% \psdot(\oenodeIfc{N}{})\uput[-90](\oenodeIfc{N}{}){N}
% \wdmcoupler(4,2)(4,1.25)(4,0.5)(7,1.25)
% \psdot(\oenodeIfc{1}{})\uput[90](\oenodeIfc{1}{}){1}
% \psdot(\oenodeIfc{2}{})\uput[0](\oenodeIfc{2}{}){2}
% \psdot(\oenodeIfc{3}{})\uput[-90](\oenodeIfc{3}{}){3}
% \psdot(\oenodeIfc{N}{})\uput[60](\oenodeIfc{N}{}){N}
% \optcoupler(8,2)(8,0.5)(11,2)(11,0.5)
% \psdot(\oenodeIfc{1}{})\uput[90](\oenodeIfc{1}{}){1}
% \psdot(\oenodeIfc{2}{})\uput[-90](\oenodeIfc{2}{}){2}
% \psdot(\oenodeIfc{3}{})\uput[90](\oenodeIfc{3}{}){3}
% \psdot(\oenodeIfc{N}{})\uput[-90](\oenodeIfc{N}{}){N}
% \rput[b](1.5,0){\nxLcomp{wdmsplitter}}
% \rput[b](5.5,0){\nxLcomp{wdmcoupler}}
% \rput[b](9.5,0){\nxLcomp{optcoupler}}
% \end{pspicture}
% \end{center}
%
%
% \ifGERMAN\subsection{Referenzknoten}\fi
% \ifENGLISH\subsection{Reference nodes}\fi
% \label{sec:coupler-refnodes}
%
% \ifGERMAN
% Die Definition der Referenzknoten aus \prettyref{sec:refnode} ist für Koppler
% nicht anwendbar und hängt von \Lkeyword{coupleralign} ab.
% \fi
% \ifENGLISH
% The definition of reference nodes from \prettyref{sec:refnode} cannot be
% applied to couplers and depends on \Lkeyword{coupleralign}.
% \fi
% \begin{center}
% \begin{pspicture}(12,2)
% \psset{couplersize=0.5, couplertype=rectangle, couplersep=0.2}
% \optcoupler(0, 2)(0,0.7)(3,2)(3,0.7)
% \psdot(\oenodeRefA{})\uput[90](\oenodeRefA{}){RefA}
% \psdot(\oenodeRefB{})\uput[90](\oenodeRefB{}){RefB}
% \optcoupler[coupleralign=top](4.5, 2)(4.5,0.7)(7.5,2)(7.5,0.7)
% \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
% \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
% \optcoupler[coupleralign=bottom](9, 2)(9,0.7)(12,2)(12,0.7)
% \psdot(\oenodeRefA{})\uput[90](\oenodeRefA{}){RefA}
% \psdot(\oenodeRefB{})\uput[90](\oenodeRefB{}){RefB}
% \rput[b](1.5,0){\opt{coupleralign=none}}
% \rput[b](6,0){\opt{coupleralign=top}}
% \rput[b](10.5,0){\opt{coupleralign=bottom}}
% \end{pspicture}
% \end{center}
%
%
% \ifGERMAN\section{Faserbox}\fi
% \ifENGLISH\section{Fiber box}\fi
%
% \begin{ltxsyntax}
% \xLfmultipole{fiberbox}%
% \compitem{fiberbox}(in)(out){label}
% \compitem*{fiberbox}(tl)(bl)(tr)(br){label}
% \end{ltxsyntax}
% 
% \ifGERMAN 
% Eine \Lcomp{fiberbox} kann entweder mit zwei, oder mit vier Knoten
% positioniert werden. Die Wahl beeinflusst die Position der Komponente
% und der Komponentenknoten und die automatischen Faserverbindungen.
%
% Werden nur zwei Knoten verwendet, dann sind das die Referenzknoten und
% der Abstand zwischen zwei benachbarten Eingangs- oder Ausgangsknoten
% muss manuell angegeben werden (siehe \Lkeyword{fiberboxsepin} und
% \Lkeyword{fiberboxsepout}). Nur die Seiten der Komponente wird
% automatische mit Fasern verbunden, die nur einen einzigen Knoten hat
% (siehe \Lkeyword{fiberboxcount} und das folgende Beispiel).
% \fi
% \ifENGLISH 
% A \Lcomp{fiberbox} can be positioned either with two, or four nodes which
% affects the positioning of the component and the interface nodes, and the
% automatic fiber connections.
% 
% If only two nodes are used these are the reference nodes and the separation
% between the components input and output nodes must be specified manually (see
% \Lkeyword{fiberboxsepin} and \Lkeyword{fiberboxsepout}). Only the side of the
% component is connected automatically which has a single node only (see
% \Lkeyword{fiberboxcount} and the following example).
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2,5-5}]
\begin{pspicture}(3,2)
  \fiberbox[fiberboxcount=1x2, showifcnodes](0,1)(3,1)
  \psdot(\oenodeRefA{})\uput[90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[90](\oenodeRefB{}){RefB}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN 
% Werden vier Knoten verwendet, dann wird die Lage der Komponentenknoten
% und deren Abstand automatisch bestimmt. Die Komponente wird zwischen
% der Mitte der beiden Eingangsknoten und der Mitte der beiden
% Ausgangsknoten positioniert. Der erste Eingangsknoten wird an dem
% \prm{tl}-Knoten ausgerichtet, der letzte Eingangsknoten an dem
% \prm{bl}-Knoten. Die übrigen Eingangsknoten werden dazwischen
% gleichverteilt. Die Ausgangsknoten werden entsprechend behandelt. Die
% vier angegebenen Knoten werden automatisch mit den jeweils
% zugeordneten Komponentenknoten verbunden.
% \fi
% \ifENGLISH
% When four nodes are used the interface nodes and their separation are
% determined automatically. The component is positioned between the
% center of the two input and the center of the two output nodes. The
% first input interface node is aligned with the \prm{tl} node, the last
% input node is aligned with \prm{bl}, all other input nodes are equally
% distributed between these. The output nodes are handled
% accordingly. The four specified nodes are connected automatically to
% the component, each with the interface node it is aligned to.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2,5-5}]
\begin{pspicture}(3,2)
  \fiberbox[fiberboxcount=3x4, showifcnodes](0.5,1.6)(0,0.4)(2.5,2)(3,0)
  \psdot(\oenodeRefA{})\uput[90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[90](\oenodeRefB{}){RefB}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \begin{optionlist}
%   \numitem[1]{fiberboxwidth}
%   \ifGERMAN Die Breite der Faserbox.\fi
%   \ifENGLISH The width of the fiber box.\fi
%
%   \numitem[0]{fiberboxheight}
%   \ifGERMAN Die Höhe der Faserbox. Ist die Höhe kleiner als der Platz
%   der von den Eingangs- oder Ausgangsknoten benötigt wird, dann wird
%   die Höhe automatisch berechnet. Die berechnete Höhe ist
%   $\text{max}\,(\text{sepin}\times(\text{N}-1),
%   \text{sepout}\times(\text{M}-1))$.
%   \fi
%   \ifENGLISH The height of the fiber box. If the height is lower than
%   the space required by the input or output nodes, it is calculated
%   automatically. The calculated height is 
%   $\text{max}\,(\text{sepin}\times(\text{N}-1),
%   \text{sepout}\times(\text{M}-1))$. 
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2.8)
  \psset[optexp]{innerlabel, fiberboxwidth=1, fiberboxcount=1x2}
  \fiberbox(0,2)(0,2)(3,2.5)(3,1.5){auto}
  \fiberbox[fiberboxheight=1.05](0,0.5)(0,0.5)(3,1)(3,0){fix}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%   \optitem{fiberboxsize}{\prm{width} \prm{height}}
%   \ifGERMAN Die Breite und Höhe der Faserbox, ist äquivalent zum Aufruf von
%   \Lkeyword{fiberboxwidth} und \Lkeyword{fiberboxheight}.
%   \fi
%   \ifENGLISH The width and height of the fiber box, is equivalent to calling
%   both \Lkeyword{fiberboxwidth} and \Lkeyword{fiberboxheight}.
%   \fi
%
%   \numitem[0.2]{fiberboxsepin}
%   \ifGERMAN Der Abstand zwischen zwei Eingangsknoten. Dieser Wert wird nur
%   verwendet, falls die Faserbox mit zwei Knoten positioniert wird. Ansonsten
%   wird der Abstand automatisch ermittelt wird.
%   \fi
%   \ifENGLISH The separation between two input nodes. This value is
%   used only if the fiber box is positioned with two nodes. Otherwise
%   the separation is calculated automatically.
%   \fi
%
%   \numitem[0.2]{fiberboxsepout}
%   \ifGERMAN Analog zu \Lkeyword{fiberboxsepin}, aber für die Ausgangsknoten.\fi
%   \ifENGLISH Equivalent to \Lkeyword{fiberboxsepout}, but for the output nodes.\fi
%
%   \optitem[2x2]{fiberboxcount}{\prm{N}x\prm{M}}
%   \ifGERMAN Anzahl der Eingangs- (\prm{N}) und Ausgangsknoten (\prm{M}).\fi
%   \ifENGLISH Number of input (\prm{N}) and output nodes (\prm{M}).\fi
% \end{optionlist}
%
% \ifGERMAN Für bestimmte Parameterkombinationen ist eine \Lcomp{fiberbox}
% äquivalent zu einer \Lcomp{optbox}.
% \fi
% \ifENGLISH For certain parameter configurations a \Lcomp{fiberbox} is
% equivalent to an \Lcomp{optbox}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,0.3)(3,2.6)
  \psset[optexp]{label=0.6}
  \fiberbox[fiberboxsize=1.2 0.6, fiberboxcount=1x1](0,2.5)(3,2.5){fiberbox}
  \optbox[optboxsize=1.2 0.6, fiber](0,1)(3,1){optbox}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \psset{usefiberstyle=false}
%
%
% \ifGERMAN\chapter{Elektrische Komponenten}\fi
% \ifENGLISH\chapter{Electrical components}\fi
% \label{chap:electrcomp}
%
% \ifGERMAN\section{Koppler}\fi
% \ifENGLISH\section{Coupler}\fi
%
% \begin{ltxsyntax}
% \xLemultipole{eleccoupler}%
% \compitem{eleccoupler}(tl)(bl)(tr)(br){label}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \eleccoupler(0,1.5)(0,0)(3,1.5)(3,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \begin{optionlist}
%   \optitem[0.8]{eleccouplersize}{\prm{size} or \prm{width} \prm{height}}
%   \ifGERMAN Die Breite und Höhe des Kopplers, wird nur ein Wert
%   angegeben dann ist die Komponente quadratisch.
%   \fi
%   \ifENGLISH The width and height of the couplers, if only one value
%   is given the component is squared.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]eleccouplersize}]
\begin{pspicture}(3,1.5)
  \eleccoupler[eleccouplersize=1 0.6](0,1.5)(0,0)(3,1.5)(3,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%   \numitem[\{\}]{eleccouplersep}
%   \ifGERMAN Der vertikale Abstand zwischen den beiden Eingangs-
%   bzw. Ausgangsanschlüssen. Ist der Wert leer, bzw. gleich \{\}, dann
%   wird der Abstand auf 75\% der Höhe gesetzt.
%   \fi
%   \ifENGLISH The vertical distance between the two input and output
%   ports. If the value is empty \{\}, then the separation is set to
%   75\% of the height.
%   \fi
%
%   \choitem[standard]{eleccouplertype}{standard, directional}
%   \ifGERMAN Wählt zwischen unterschiedlichen Kopplertypen.\fi
%   \ifENGLISH Select between different coupler types.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]eleccouplertype}]
\begin{pspicture}(3,1.5)
  \eleccoupler[eleccouplertype=directional](0,1.5)(0,0)(3,1.5)(3,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%   \choitem[left]{eleccouplerinput}{left, right}
%   \ifGERMAN Gibt beim direktionalen Koppler die Eingangsseite an.\fi
%   \ifENGLISH Selects the input side for the directional coupler.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]eleccouplerinput}]
\begin{pspicture}(3,1.5)
  \eleccoupler[eleccouplertype=directional, eleccouplerinput=right](0,1.5)(0,0)(3,1.5)(3,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN Die automatischen Verbindungen des elektrischen Kopplers
% sind, anders als beim optischen Koppler, alle auf die Komponente
% gerichtet. Das ergibt ein symmetrisches Layout der automatischen
% Verbindungen des elektrischen Kopplers bei Verwendung der Vorgabe
% \Lkeyword{wirestyle}\opt{=angle}.
% \fi
% \ifENGLISH The automatic connections of the electrical coupler are all
% directed towards the component, in contrast to the optical
% coupler. This gives a symmetric layout of the automatic electrical coupler
% connections when using the default of
% \Lkeyword{wirestyle}\opt{=angle}.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,4)
  \addtopsstyle{Wire}{arrows=->}
  \addtopsstyle{Fiber}{arrows=->, fiberstyle=angle}
  \eleccoupler(0,4)(0,2)(3,4)(3,2)
  \optcoupler[couplersize=0.8 0.8, couplersep={}, couplertype=rectangle](0,1.5)(0,0)(3,1.5)(3,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\section{Synthesizer}\fi
% \ifENGLISH\section{Synthesizer}\fi
%
% \begin{ltxsyntax}
% \xLemultipole{elecsynthesizer}%
% \compitem{elecsynthesizer}(in)(out){label}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \elecsynthesizer(1,1)(3,1){SYN}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \elecsynthesizer[position=0.5](0,1)(3,1){SYN}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \begin{optionlist}
%   \optitem[0.8]{synthsize}{\prm{size} or \prm{width} \prm{height}}
%   \ifGERMAN Die Größe der Komponente, ist diese rund und wurden zwei
%   Werte angegeben, dann wird der kleinere als Durchmesser verwendet.
%   \fi
%   \ifENGLISH The size of the component, if this is of circular shape
%   and two values were given, the smaller one is used as diameter.
%   \fi
%
%   \choitem[sine]{synthtype}{sine, pulse, sawtooth, rectangle, triangle, custom}
%   \ifGERMAN Wählt zwischen unterschiedlichen Typen.\fi
%   \ifENGLISH Select between different synthesizer types.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]synthtype}]
\begin{pspicture}(0,0.6)(3,5.4)
  \elecsynthesizer[synthtype=sine](1,5)(3,5)
  \elecsynthesizer[synthtype=sawtooth](1,4)(3,4)
  \elecsynthesizer[synthtype=triangle](1,3)(3,3)
  \elecsynthesizer[synthtype=rectangle](1,2)(3,2)
  \elecsynthesizer[synthtype=pulse](1,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN Es kann auch eine frei wählbare Wellenform gewählt werden.\fi
% \ifENGLISH You can also use a freely customizable waveform.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]synthtype}]
\begin{pspicture}(0,0)(3,2)
  \makeatletter
  \def\elecsynthesizer@custom{%
    \psline(-0.25,-0.1)(-0.1,-0.1)(-0.1,0)%
           (0.1,0)(0.1,0.1)(0.25,0.1)}
  \makeatother
  \elecsynthesizer[synthtype=custom](1,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[circle]{synthshape}{circle, rectangle}
% \ifGERMAN Wählt zwischen kreisförmiger und rechteckiger Außenform.\fi
% \ifENGLISH Select between circular and rectangular outer shape.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]synthshape}]
\begin{pspicture}(3,1.5)
  \elecsynthesizer[synthshape=rectangle](1,1)(3,1){SYN}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem{SynthStyle}
% \ifGERMAN Beinflusst das Aussehen der internen Symbole.\fi
% \ifENGLISH Change the style of the internal synthesizer symbol.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]SynthStyle}]
\begin{pspicture}(3,1)
  \newpsstyle{SynthStyle}{xunit=0.5, yunit=-1}
  \elecsynthesizer(1,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
%
% \ifGERMAN\section{Mixer}\fi
% \ifENGLISH\section{Mixer}\fi
%
% \begin{ltxsyntax}
% \xLemultipole{elecmixer}%
% \compitem{elecmixer}(left)(right)(bottom){label}%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \newpsstyle{Wire}{arrowscale=1.5, arrowinset=0, arrows=->}
  \addtopsstyle{WireOut1}{linecolor=blue}
  \addtopsstyle{WireOut2}{linecolor=green!80!black}
  \elecmixer(0,1)(3,1)(1.5,0){Mixer}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \begin{optionlist}
%   \numitem[0.8]{elecmixersize}
%   \ifGERMAN Der Durchmesser des Mixers.\fi
%   \ifENGLISH The diameter of the mixer.\fi
% \end{optionlist}
%
% \ifGERMAN Weitere Details bezüglich der Referenzknoten und
% Positionierung finden Sie unter \Lcomp{optcirculator}.
% \fi
% \ifENGLISH For further details about the reference nodes and the
% positioning, please refer to \Lcomp{optcirculator}.
% \fi
%
% \ifGERMAN\chapter{Hybridkomponenten}\fi
% \ifENGLISH\chapter{Hybrid components}\fi
% \label{sec:hybridcomp}
%
% \ifENGLISH This chapter describes the components which can be used both for
% free-ray and fiber optics but which differ from these two categories.
%
% The \Lcomp{optfilter} is connected by default with automatic fiber
% connections, but can likewise be used with free-ray beams, in contrast
% to the fiber components (\prettyref{chap:fibercomp}). The
% \Lcomp{fibercollimator} has one interface only, the other connection is
% a fiber and the \Lcomp{optdetector} has one interface, the other
% connection is a wire.
% \fi
% \ifGERMAN Dieses Kapitel beschreibt die Komponenten, die sowohl für
% Freistrahl- als auch Faseroptik zu verwenden sind, sich von diesen aber etwas
% abgrenzen.
%
% Der \Lcomp{optfilter} wird mit den Voreinstellungen zwar als
% Faserkomponente gehandhabt, kann jedoch im Gegensatz zu den reinen
% Faserkomponenten (\prettyref{chap:fibercomp}) auch als
% Freistrahlkomponente verwendet werden. Der \Lcomp{fibercollimator} hat
% nur eine Faser, die andere Verbindung ist Freistrahl und der
% \Lcomp{optdetector} hat eine Freistrahl- und eine elektrische
% Verbindung.
% \fi
%
% \ifGERMAN\section{Optischer Filter}\fi
% \ifENGLISH\section{Optical filter}\fi
%
% \psset{usefiberstyle}
% \begin{ltxsyntax}
% \fiberdipoledesc{optfilter}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optfilter(0,1)(3,1){bandpass}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \begin{optionlist}
% \numitem[0.8]{filtersize}
% \ifGERMAN Die Größe des Filters.\fi
% \ifENGLISH The size of the filter.\fi
%
% \choitem[bandpass]{filtertype}{bandpass, bandstop, lowpass, highpass}
% \ifGERMAN Wähle zwischen unterschiedlichen Filtertypen.\fi
% \ifENGLISH Select between different filter types.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{filtertype}}]
\begin{pspicture}(3,1.5)
  \optfilter[filtertype=bandstop](0,1)(3,1){bandstop}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{filtertype}}]
\begin{pspicture}(3,1.5)
  \optfilter[filtertype=lowpass](0,1)(3,1){lowpass}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[morekeywords={[21]{filtertype}}]
\begin{pspicture}(3,1.5)
  \optfilter[filtertype=highpass](0,1)(3,1){highpass}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[0]{filterangle}
% \ifGERMAN Dreht das «Innere» des Filters relativ zum seinem
% Rahmen. Anstattdessn kann auch \Lkeyword{innercompalign} verwendet
% werden.
% \fi
% \ifENGLISH Rotates the «inner» part of the filter relativ to its
% frame. Alternatively \Lkeyword{innercompalign} can be used.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{filterangle}}]
\begin{pspicture}(2,2)
  \optfilter(0.5,0)(0.5,2)
  \optfilter[filterangle=90](1.5,0)(1.5,2)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem{FilterStyle}
% \ifGERMAN Beinflusst das Aussehen der internen Filterlinien.\fi
% \ifENGLISH Change the style of the internal filter lines.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]FilterStyle}]
\begin{pspicture}(3,1.5)
  \newpsstyle{OptComp}{linewidth=2\pslinewidth}
  \optfilter(0,1)(1.5,1)
  \newpsstyle{FilterStyle}{linewidth=0.5\pslinewidth}
  \optfilter(1.5,1)(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
%
% \ifGERMAN Verwendung als Freistrahlkomponenten, \Lkeyword{allowbeaminside} ist
% auf \opt{false} voreingestellt:
% \fi
% \ifENGLISH Usage as free-ray component, \Lkeyword{allowbeaminside} is set to
% \opt{false} by default:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \optfilter[fiber=none](0,1)(3,1)
  \addtopsstyle{Beam}{beamwidth=0.3,
      fillstyle=solid, fillcolor=green, opacity=0.2}
  \drawwidebeam(0,1){}(3,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%
% \ifGERMAN\section{Faserkollimator}\fi
% \ifENGLISH\section{Fiber collimator}\fi
% 
% \begin{ltxsyntax}
% \xLdipole{fibercollimator}\compitem{fibercollimator}(in)(A)(B)(out){label}%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \fibercollimator[beam](0,1)(3,1){FC}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifGERMAN
% Der Faserkollimator kann mit zwei, drei oder vier Punkten verwendet
% werden. Bei zwei Punkten wird der Kollimator wie jeder andere Zweipol zwischen
% \prm{in} und \prm{out} Knoten platziert. Bei drei Punkten wird eine
% \Lcs*{psbezier} Kurve gezeichnet, wobei der mittlere Punkt doppelt verwendet
% wird. Die Positionierungsparameter (siehe \prettyref{sec:positioning}) können
% verwendet werden um den Kollimator zwischen dem \prm{in} und \prm{A} Knoten
% auszurichten.
% \fi
% \ifENGLISH
% The fiber collimator can be used with two, three or four points. With two
% points, the collimator is placed like any other dipole component between
% \prm{in} and \prm{out} node. For three nodes, the fiber is drawn as
% \Lcs*{psbezier} curve for which the central node \prm{A} is used
% twice. Positioning parameters (see \prettyref{sec:positioning}) can be used to
% shift the object between \prm{in} and \prm{A} nodes.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
   \fibercollimator[beam](0,1)(2,1)(3,2){FC}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \medskip
%
% \ifGERMAN
% Bei vier Knoten wird eine \Lcs*{psbezier} Kurve mit allen vier Knoten
% gezeichnet. Die Positionierungsparameter (siehe \prettyref{sec:positioning})
% können verwendet werden um den Kollimator zwischen den ersten beiden Knoten
% (\prm{in} und \prm{A}) zu verschieben.
% \fi
% \ifENGLISH
% For four nodes, the fiber is drawn as \Lcs*{psbezier} curve with the specified
% nodes. Positioning parameters (siehe \prettyref{sec:positioning}) can be used
% to shift the object between the first two nodes (\prm{in} and \prm{A}).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
   \fibercollimator[beam](0,1)(2,1)(3,1)(3,2){FC}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \begin{optionlist}
% \optitem[0.3]{fibercolsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Eine einzelne Zahl gibt die Seitenlänge des Kollimators an, zwei Zahlen die Breite und
% Höhe. Beachten Sie, dass \opt{fibercolsize=1} und \opt{fibercolsize=1 1} nicht
% dasselbe Ergebnis liefern. Alternativ kann das Verhältnis zwischen Höhe und
% Breite mit \opt{xunit} und \opt{yunit} geändert werden.
% \fi
% \ifENGLISH
% A single number gives the side length of the collimator, two numbers the width
% and height. Note, that \opt{fibercolsize=1} and \opt{fibercolsize=1 1} do not give
% the same result. You may also change the relation of width and height with
% \opt{xunit} and \opt{yunit}.
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Detektor}\fi
% \ifENGLISH\section{Detector}\fi
% 
% \begin{ltxsyntax}
% \dipoledesc{optdetector}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.2)
  \optdetector[beam](0,0)(1.5,1){detector}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifENGLISH The detector is placed by default at the end of the
% reference line (\Lkeyword{position}\opt{=end}). If this setting is
% overwritten, the output connection is treated like that of an
% electrical component.
% \fi
% \ifGERMAN Der Detektor wird in der Voreinstellung ans Ende der
% Referenzlinie platziert (\Lkeyword{position}\opt{=end}). Wird dieser
% Parameter überschrieben, dann wird die ausgehende Verbindung wie bei
% einer elektrischen Komponente behandelt.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.2)
  \optdetector[position=0.5](0,0)(1.5,1){detector}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \begin{optionlist}
% \optitem[0.8]{detsize}{\prm{num} or \prm{width} \prm{height}}
% \ifGERMAN 
% Wenn eine einzelne Zahl angegeben ist, dann ist das die Seitenlänge
% (\opt{diode}) bzw. der Durchmesser (\opt{round}) des Detektors. Werden zwei
% Zahlen angegeben, so sind das Breite und Höhe des Detektors. Beachten Sie,
% dass \opt{detsize=1} und \opt{detsize=1 1} für \opt{dettype=round} nicht dasselbe ist.
% \fi
% \ifENGLISH 
% If a single number is given it is the side length (\opt{diode}) or the
% diameter (\opt{round}) of the detector. Two numbers define the width and
% height of the detector. Note, that \opt{detsize=1} and \opt{detsize=1 1} are
% not equivalent for \opt{dettype=round}.
% \fi
% 
% \choitem[round]{dettype}{round, diode} 
% \ifGERMAN
% Dieser Parameter bestimmt den Typ und damit das Aussehen des Detektors.
% \fi
% \ifENGLISH
% This parameter selects between different types of detectors.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{dettype}}] 
\begin{pspicture}(3,1.5)
  \optdetector[beam, dettype=diode](0,0)(1.5,1){detector}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \begin{stylelist}
% \styleitem{DetectorStyle} 
% \ifGERMAN 
% Der Stil der Diode für \Lkeyword{dettype}\opt{=diode}.
% \fi
% \ifENGLISH 
% The style of the diode for \Lkeyword{dettype}\opt{=diode}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \newpsstyle{OptComp}{linewidth=3\pslinewidth}
  \newpsstyle{DetectorStyle}{linewidth=0.333\pslinewidth}
  \optdetector[dettype=diode](0,1)(2,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
% 
%
% \ifGERMAN\chapter{Spezielle Knoten}\fi
% \ifENGLISH\chapter{Special nodes}\fi
% \label{sec:objnodes}
% 
% \ifGERMAN
% Jedes \nxLPack{pst-optexp}-Objekt stellt mehrere spezielle Knoten zur
% Verfügung, die mit dessen Geometrie und Positionierung zusammenhängen. Diese
% Knoten stehen für weitere Verwendung zur Verfügung.
%
% Sie sollten immer die dafür vorgesehenen Makros verwenden um auf die
% Knotennamen zuzugreifen.
% \fi
% \ifENGLISH
% Every \nxLPack{pst-optexp} object of an experimental setup provides
% several special nodes which are related to its geometry and
% positioning. They can be accessed and used for related positioning and
% drawing.
%
% You should always use the dedicated macros to access these node names.
% \fi
% \begin{ltxsyntax}
%   \cmditem{oenode}{node}{comp} 
%
% \ifGERMAN
% Das ist das grundlegende Makro mit dem auf die Knotennamen einer Komponente
% zugegriffen werden kann. Das erste Argument \prm{node} ist der Bezeichner des
% angeforderten Knotens. Das zweite Argument \prm{comp} ist der Name der
% Komponente (gemäß \prettyref{sec:namingobj}). Ist dieses leer so wird das
% zuletzt definierte Objekt verwendet.
%
% Für viele der Knoten wird ein eigenes Makro bereitgestellt, das Sie dann auch
% verwenden sollten, da sich die Namenskonventionen ändern könnten. Die Makros
% stellen sicher, dass Sie immer die passenden Knotennamen erhalten. Daher sind
% die verfügbaren Bezeichner auch nicht aufgelistet.
% \fi
% \ifENGLISH
% This is the basic command to access any node associated with a certain
% component. The first argument \prm{node} is the identifier of the requested
% node. The second argument \prm{comp} is the name of the target component
% (according to \prettyref{sec:namingobj}). If left empty, it uses the last
% component defined.
%
% For most special nodes an appropriate macro is provided, which you are
% strongly advised to use, because the naming conventions may change. Using the
% macros makes sure, that you always get the correct node names. Therefore, the
% available identifiers are not listed explicitely.
% \fi
% \end{ltxsyntax}
%
% \begin{optionlist}
%   \boolitem[false]{showoptdots}
%   \ifGERMAN 
%   Markiert einige der speziellen Komponentenknoten: die schwarzen Punkte sind
%   die normalen und die schwarzen Kreuze die transformierten Referenzknoten
%   (\prettyref{sec:refnode}), der rote Punkt ist der Mittelpunktknoten
%   (\prettyref{sec:centernode}) und das rote Kreuz der Beschriftungsknoten
%   (\prettyref{sec:labelnode}).
%   \fi
%   \ifENGLISH 
%   Draw some special component nodes for debugging: The black points are the
%   normal and the black crosses are the transformed reference nodes
%   (\prettyref{sec:refnode}), the red point is the center node
%   (\prettyref{sec:centernode}), and the red cross is the label node
%   (\prettyref{sec:labelnode}).
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
\mirror[showoptdots, angle=10, beam](0,1)(1.9,1)(1.9,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Komponenten-Bezeichner}\fi
% \ifENGLISH\section{Component identifiers}\fi
% \label{sec:namingobj}
%
% \ifGERMAN
% Alle Komponenten einer Aufbauskizze werden in Reihenfolge ihrer Definition im
% Code aufsteigend nummeriert, angefangen bei \opt{1}. Die Komponenten und deren
% Spezialknoten können immer über diese Nummer (ID) referenziert werden.
%
% IDs können auch relativ zur aktuellen ID über die Syntax
% \opt{<}\prm{num} angegeben werden: \opt{<1} ist die vorletzte ID,
% \opt{<2} die vorvorletzte ID usw. Die vorletzte ID kann abgekürzt auch
% mit \opt{<} erhalten werden, und die aktuelle ID mit \opt{<0}, was
% äquivalent zu einem leeren Parameter ist.
% \fi
% \ifENGLISH
% All components of a setup drawing are numbered automatically in increasing
% order according to their definition in the code, starting with \opt{1}. The
% components as well as their special nodes can always be accessed by this
% number (ID). 
%
% ID specifications relative to the current ID can be used with the
% syntax \opt{<}\prm{num}: \opt{<1} is the previous ID, \opt{<2} is the
% current ID minus two etc. The previous ID can also be accessed by only
% \opt{<}, and the current ID is \opt{<0}, which is equivalent to an
% empty parameter.
% \fi
%
% \begin{optionlist}
%   \valitem{compname}{string} 
%   \ifGERMAN
%   Weist einer Komponente einen Bezeichner zu. Die Komponente kann nun sowohl
%   über diesen Bezeichner als auch über die ID referenziert werden. Dieser
%   Parameter kann nur im optionalen Argument einer \nxLPack{pst-optexp}
%   Komponente verwendet werden. Der Bezeichner sollte innerhalb einer
%   \Lenv*{pspicture}-Umgebung eindeutig sein.
%   \fi
%   \ifENGLISH
%   Assigns a name identifier to a component, which can then be
%   referenced both by this name and by its ID. The parameter can be
%   assigned only locally, i.e. in the optional argument of a
%   \nxLPack{pst-optexp} component, and should be unique within one
%   \Lenv*{pspicture} environment.
%   \fi
% \end{optionlist}
%
% \ifGERMAN Beispiele für unterschiedliche Methoden auf ein und
% dieselbe Komponente zuzugreifen.
% \fi
% \ifENGLISH Examples for different methods to access the same
% component.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\ifGERMAN
\begin{LTXexample}
\begin{pspicture}(2,2)
  \optbox[compname=MyBox](0,1)(2,2)
  \psdot[linecolor=red](\oenodeIn{MyBox}) % Verwende den Namen
  \psdot[linecolor=blue](\oenodeOut{1})   % Verwende die ID
  \psdot[linecolor=green](\oenodeCenter{})% Nimm die letzte Komponente
\end{pspicture}
\end{LTXexample}
\fi\ifENGLISH
\begin{LTXexample}
\begin{pspicture}(2,2)
  \optbox[compname=MyBox](0,1)(2,2)
  \psdot[linecolor=red](\oenodeIn{MyBox})% use the compname
  \psdot[linecolor=blue](\oenodeOut{1})  % use the ID
  \psdot[linecolor=green](\oenodeCenter{})  % the last component
\end{pspicture}
\end{LTXexample}
\fi
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN 
% Die Verwendung von relativen IDs ist u.a. nützlich, um eine neue
% Komponente relativ zur vorangegangenen zu definieren. Die Verwendung
% von z.B. \Lcs{oenodeOut}\opt{\{\}} in den Referenzknoten ist nicht
% möglich, da hiermit zum Zeitpunkt der Auswertung der Koordinaten schon
% auf die neue, nicht fertige Komponente referenziert wird. Ein Aufruf
% der Art \lstinline!\optbox(\oenodeOut{})(B)! ist daher nicht möglich,
% und führt zu einem Fehler. Mit relativen IDs kann das allerdings mit
% \lstinline!\optbox(\oenodeOut{<})(B)! erreicht werden:
% \fi
% \ifENGLISH
% Using relative IDs can be very handy to define a component relative to
% the previous one. It is not possible to use
% e.g. \Lcs{oenodeOut}\opt{\{\}} as reference node, because at the time
% these coordinates are evaluated, they reference to the new, not yet
% defined component. A call like \lstinline!\optbox(\oenodeOut{})(B)!
% is, therefore, not possible and gives an error. With relative IDs one
% can achieve that with \lstinline!\optbox(\oenodeOut{<})(B)!:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,2)
  \psset{optboxsize=0.4 0.8, abspos=0.5}
  \optbox(0,1)(4,1)
  \multido{}{3}{\optbox(\oenodeOut{<})(4,1)}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\section{Referenzknoten}\fi
% \ifENGLISH\section{Reference nodes}\fi
% \label{sec:refnode}
%
% \begin{ltxsyntax}
%   \cmditem{oenodeRefA}{comp}
%   \cmditem{oenodeRefB}{comp}
%
%  \ifGERMAN
%  Die Eingangs- und Ausgangs-Referenzknoten.
%
%  Das sind die ursprünglichen Knoten, die für die Positionierung der Komponente
%  benutzt wurden, \nxLcs{oenodeRefA} ist der erste und \nxLcs{oenodeRefB} der
%  letzte Knoten. Diese Zuordnung ist nicht gültig für Faserkoppler
%  (\ref{sec:coupler-refnodes}) und Zirkulatoren (\compref{optcirculator}).
%  \fi
%  \ifENGLISH
%  The input and output reference nodes.
%
%  These are the original nodes which were used for the component positioning,
%  \nxLcs{oenodeRefA} is the first and \nxLcs{oenodeRefB} the last node. This
%  definition is not valid couplers (\ref{sec:coupler-refnodes}) and circulators
%  (\compref{optcirculator}).
%  \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[pos=t, linerange={1-3, 4-7}]
\begin{pspicture}(5,1)
  \pnodes(0.5,0.5){A}(4.5,0.5){B}
  \optbox(A)(B)
  \psline[style=Refline](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%   \cmditem{oenodeTrefA}{comp}
%   \cmditem{oenodeTrefB}{comp}
%
%   \ifGERMAN
%   Die transformierten Eingangs- und Ausgangs-Referenzknoten.
%
%   Das sind die Referenzknoten nachdem sie zusammen mit der Komponente gemäß
%   der \Lkeyword{compshift} und \Lkeyword{angle} Parameter transformiert wurden.
%   \fi
%   \ifENGLISH
%   The transformed input and output reference nodes.
%
%   These are the input and output reference nodes which are transformed
%   together with the component according to the \Lkeyword{compshift} and
%   \Lkeyword{angle} parameters.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[pos=t, linerange={1-3,5-9}]
\begin{pspicture}(5,1.8)
  \pnodes(0.5,0.5){A}(4.5,0.5){B}
  \optbox[compshift=0.5, angle=10](A)(B)
  \psline[style=Refline](\oenodeTrefA{})(\oenodeTrefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psdot(\oenodeTrefA{})\uput[90](\oenodeTrefA{}){TrefA}
  \psdot(\oenodeTrefB{})\uput[90](\oenodeTrefB{}){TrefB}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifGERMAN\section{Mittelpunktknoten}\fi
% \ifENGLISH\section{Center node}\fi
% \label{sec:centernode}
%
% \begin{ltxsyntax}
%   \cmditem{oenodeCenter}{comp}
% 
% \ifGERMAN
% Dieser Knoten liegt, bis auf wenige Ausnahmen, wie
% z.B. \Lcomp{optdetector} und \Lcomp{optcoupler} (siehe unten), im
% Mittelpunkt der Komponente.
% \fi
% \ifENGLISH
% This node lays, except for a few components like
% e.g. \Lcomp{optcirculator} and \Lcomp{optcoupler} (see below), in the
% center of the component.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2, 5-5, 8-8}]
\begin{pspicture}(3,2)
  \optbox(0,0.5)(3,0.5)
  \psline[style=Refline](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeCenter{})
  \optdetector(0,1.5)(2.5,1.5)
  \psline[style=Refline](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Bei \Lcomp{optcoupler} hängt die Position der Komponentenmitte
% von den \Lkeyword{coupleralign} Einstellungen ab.
% \fi
% \ifENGLISH For \Lcomp{optcoupler} the position of the component center
% depends on the \Lkeyword{coupleralign} settings.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,0.3)(3,3)
  \psset[optexp]{couplersize=0.6 0.4, couplersep=0.2, couplertype=rectangle}
  \optcoupler(0,3)(0,2)(3,3)(3,2)
  \psdot(\oenodeCenter{})
  \optcoupler[coupleralign=b](0,1.5)(0,0.5)(3,1.5)(3,0.5)
  \psdot(\oenodeCenter{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
% 
% \ifGERMAN\section{Beschriftungsknoten}\fi
% \ifENGLISH\section{Label node}\fi
% \label{sec:labelnode}
%
% \begin{ltxsyntax}
%   \cmditem{oenodeLabel}{comp}
%
%   \ifGERMAN
%   Auf diesen Knoten wird die Beschriftung platziert. Der Knoten ist auch
%   verfügbar wenn keine Beschriftung angegeben wurde. Für
%   \Lkeyword{labeloffset}\opt{=0} ist dieser Knoten
%   identisch mit dem Mittelpunktsknoten (\prettyref{sec:centernode}).
%   \fi
%   \ifENGLISH
%   The component label is placed at this node. It is also available
%   if no label was specified. The label node is identical with the center
%   node for \Lkeyword{labeloffset}\opt{=0}.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-2,5-5}]
\begin{pspicture}(3,1.5)
  \optbox(0,1)(3,1)
  \psline[style=Refline](\oenodeTrefA{})(\oenodeTrefB{})
  \psdot(\oenodeLabel{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifGERMAN\section{Externe Knoten}\fi
% \ifENGLISH\section{External nodes}\fi
% \label{sec:extnode}
%
% \begin{ltxsyntax}
%   \cmditem{oenodeExt}{comp}
%
% \ifGERMAN
% Ein externer Knoten kann an unterschiedliche Positionen entlang des
% Komponentenrandes gesetzt werden. Dieser wird nur für den externen Zugriff
% definiert, und beeinflusst in keiner Weise die Komponente.
% \fi
% \ifENGLISH
% An external node can be placed at different positions along the component
% boundary. It gets defined only for external usage and does not affect the
% component in any way.
% \fi
% \end{ltxsyntax}
% \begin{optionlist}
% \valitem{extnode}{refpoint}
% \ifGERMAN
% Bestimmt die Position des externen Knotens. \refpointexplanation Nicht
% jede Komponente unterstützt alle möglichen Kombinationen, die möglichen
% Positionen jeder Komponente sind in \prettyref{sec:overview-extnode}
% zusammengefasst.
% \fi
% \ifENGLISH
% Set the position of the external node. \refpointexplanation Not all
% components support any possible combination. The allowed positions of each
% component are listed in \prettyref{sec:overview-extnode}.
% \fi
%
% \begin{pspicture}(6,2.5) 
%   \addtopsstyle{Beam}{beaminside=false, arrows=->, arrowinset=0, arrowscale=1.5}
%    \psset{optboxsize=2.5 1.5}\ttfamily
%    \pnodes(0,1.25){A}(6,1.25){B}
%    \optbox[beam, extnode=tl](A)(B)
%    \psdot(\oenodeExt{})\uput[135](\oenodeExt{}){tl}
%    \backlayer{%
%      \optbox[extnode=t](A)(B)\psdot(\oenodeExt{})\uput[90](\oenodeExt{}){t}
%      \optbox[extnode=tr](A)(B)\psdot(\oenodeExt{})\uput[90](\oenodeExt{}){tr}
%      \optbox[extnode=r](A)(B)\psdot(\oenodeExt{})\uput[45](\oenodeExt{}){r}
%      \optbox[extnode=br](A)(B)\psdot(\oenodeExt{})\uput[-90](\oenodeExt{}){br}
%      \optbox[extnode=b](A)(B)\psdot(\oenodeExt{})\uput[-90](\oenodeExt{}){b}
%      \optbox[extnode=bl](A)(B)\psdot(\oenodeExt{})\uput[-90](\oenodeExt{}){bl}
%      \optbox[extnode=l](A)(B)\psdot(\oenodeExt{})\uput[135](\oenodeExt{}){l}
%      \optbox[extnode=c](A)(B)\psdot(\oenodeExt{})\uput[180](\oenodeExt{}){c}
%    }
% \end{pspicture}
%
% \choitem[abs]{extnodealign}{rel,relative,abs,absolute}
% \ifGERMAN
% Die Bezeichnung von «oben» (\opt{t}) und den anderen Positionierungsparametern
% von \Lkeyword{extnode} können absolut oder relativ zur Komponente betrachtet
% werden.
%
% In dem folgenden Beispiel ist der externe Knoten immer «oben rechts»
% (\opt{tr}) platziert, unabhängig von der Reihenfolge der Referenzknoten
% (\opt{extnodealign=abs}). Das Verhalten ist identisch zu
% \Lkeyword{labelref}\opt{=relative} für die Ausrichtung der Beschriftung.
% \fi
% \ifENGLISH 
% The definition of «top» (\opt{t}) and the other \Lkeyword{extnode} refpoint
% parameters can be absolute or relative to the component.
%
% In the following example the external node is always placed «top right»
% independent of the actual order of the reference nodes
% (\opt{extnodealign=abs}). The behaviour is identical to the label rotation for
% \Lkeyword{labelref}\opt{=relative}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]extnodealign}]
\begin{pspicture}(-2,-2)(2,2)
  \psset{endbox, optboxsize=1 0.6, dotscale=1.5}
  \psset{extnodealign=abs, extnode=tr}
  \multido{\i=0+45}{8}{%
    \optbox[innerlabel](0,0)(1;\i){\i}
    \psdot(\oenodeExt{})
  }%
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[morekeywords={[21]extnodealign}]
\begin{pspicture}(-2.2,-2.2)(2.2,2.2)
  \psset{dotscale=1.5, mirrortype=extended, mirrordepth=0.5, label=0.25 . . relative, extnodealign=abs, extnode=tr}
  \newpsstyle{ExtendedMirror}{}
  \multido{\i=0+45,\ii=-45+45}{8}{%
    \mirror(0,0)(1.5;\i)(2.1212;\ii){\i}
    \psdot(\oenodeExt{})
  }%
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% In dem darauffolgenden Beispiel bezieht sich die Positionierung relativ zur
% Verbindung zwischen Eingangs- und Ausgangsreferenzknoten
% (\opt{extnodealign=rel}).
% \fi
% \ifENGLISH
% In the next example the position is relative to the order of input and output
% reference node (\opt{extnodealign=rel}).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]extnodealign}]
\begin{pspicture}(-2,-2)(2,2)
  \psset{endbox, optboxsize=1 0.6, dotscale=1.5}
  \psset{extnodealign=rel, extnode=tr}
  \multido{\i=0+45}{8}{%
    \optbox[innerlabel](0,0)(1;\i){\i}
    \psdot(\oenodeExt{})
  }%
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[morekeywords={[21]extnodealign}]
\begin{pspicture}(-2.2,-2.2)(2.2,2.2)
  \psset{dotscale=1.5, mirrortype=extended, mirrordepth=0.5, label=0.25 . . relative, extnodealign=abs, extnode=tr}
  \newpsstyle{ExtendedMirror}{}
  \multido{\i=0+45,\ii=-45+45}{8}{%
    \mirror(0,0)(1.5;\i)(2.1212;\ii){\i}
    \psdot(\oenodeExt{})
  }%
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \valitem{extnodes}{list}
% \ifGERMAN Erlaubt die Definition mehrerer externer Knoten, \prm{list}
% ist eine Liste von \prm{refpoint}, wie sie von \Lkeyword{extnode}
% verwendet werden. Der erste Knoten kann wie gewohnt mit
% \Lcs{oenodeExt} angesprochen werden (ist äquivalent zu
% \Lcs{oenode}{\{Ext\}} und \Lcs{oenode}{\{Ext1\}}). Für alle weiteren
% Knoten muss \Lcs{oenode} mit den Knotenbezeichnungen
% \opt{Ext}\prm{num} verwendet werden: \Lcs{oenode}\opt{\{Ext1\}} für den
% ersten, \Lcs{oenode}{\{Ext2\}} für den zweiten usw.
% \fi
% \ifENGLISH
% Define multiple external nodes, with their \prm{refpoints} given in
% the \prm{list} and separated by commas. The first node can be accessed
% as usual with \Lcs{oenodeExt} (is equivalent to \Lcs{oenode}{\{Ext\}}
% and \Lcs{oenode}{\{Ext1\}}). All additional nodes must be accessed
% with \Lcs{oenode} and the node label \opt{Ext}\prm{num}:
% \Lcs{oenode}{\{Ext1\}} for the first one, \Lcs{oenode}{\{Ext2\}} for
% the second, etc.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]extnodes}, linerange={1-3,5-5}]
\begin{pspicture}(3,2)
  \optbox[extnodes={tl,tr,br,bl}](0,1)(3,1)
  \multido{\i=1+1}{4}{\psdot[dotstyle=o](\oenode{Ext\i}{})}%
  \multido{\i=1+1,\ii=135+-90}{4}{\uput[\ii](\oenode{Ext\i}{}){Ext\i}}%
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Grenzflächenknoten}\fi
% \ifENGLISH\section{Interface nodes}\fi
% \label{sec:ifcnode}
%
% \begin{ltxsyntax}
%   \cmditem{oenodeIfc}{num}{comp}
%
%   \ifGERMAN
%   Der Grenzflächenknoten \prm{num}, wobei \prm{num} eine positive
%   Ganzzahl oder der Buchstabe \opt{N} ist. Der letzte Knoten ist immer
%   \opt{N}, kann aber auch über die entsprechende Zahl angesprochen
%   werden.
%   \fi
%   \ifENGLISH
%   The interface node \prm{num}, where the number is a positive integer
%   or the character \opt{N}. The last node is always defined as \opt{N}
%   but can also be accessed via its number.
%   \fi
%
%   \cmditem{oenodeIn}{comp}
%
%   \ifGERMAN
%   Der Knoten \prm{1} ist der Eingangsknoten und sollte immer über
%   \nxLcs{oenodeIn} angesprochen werden.
%   \fi
%   \ifENGLISH
%   The interface node \prm{1} is the input node and should always be accessed
%   via \nxLcs{oenodeIn}.
%   \fi
%
%   \cmditem{oenodeOut}{comp}
%
%   \ifGERMAN
%   Der Knoten \opt{N} ist der Ausgangsknoten und sollte
%   immer über \nxLcs{oenodeOut} angesprochen werden.
%   \fi
%   \ifENGLISH
%   The interface node \prm{N} is the output node and should always be accessed
%   via \nxLcs{oenodeOut}.
%   \fi
%
%   \ifGERMAN
%   «Eingang» und «Ausgang» können nur anhand einer relativen Orientierung
%   definiert werden. Per Definition ist der Eingangsknoten derjenige zu dem ein
%   Lichtstrahl ausgehend vom Referenzknoten \Lcs{oenodeRefA} verläuft. Analog
%   dazu ist die Definition ds Ausgangsknotens. Diese Bezeichnung kann nur für
%   Faserkoppler (siehe \prettyref{sec:coupler-nodes}) und Strahlteiler
%   (\compref{beamsplitter}) nicht angewendet werden.
%
%   \nxLcs{oenodeIn} ist äquivalent zu \nxLcs{oenodeIfc\{1\}} und
%   \nxLcs{oenodeOut} ist äquivalent zu \nxLcs{oenodeIfc\{N\}}. Die Eingangs-
%   und Ausgangsknoten sollten über die explizit bereitgestellten Makros
%   angesprochen werden, \nxLcs{oenodeIfc} sollte nur für die weiteren
%   Grenzflächenknoten, sofern vorhanden, verwendet werden.
%   \fi
%   \ifENGLISH
%   «Input» and «output» can define only relative orientations. The input node
%   is by definition the node to which a beam coming from the reference node
%   \Lcs{oenodeRefA} is connected to. Correspondingly is the definition of the
%   output node. This definition breaks down only for fiber couplers (see
%   \prettyref{sec:coupler-nodes}) and beamsplitter (\compref{beamsplitter}).
%
%   \nxLcs{oenodeIn} is equivalent to \nxLcs{oenodeIfc\{1\}} and
%   \nxLcs{oenodeOut} is equivalent to \nxLcs{oenodeIfc\{N\}}. You should use
%   the \nxLcs{oenodeIfc} macro only to access the nodes which are not the input
%   and output nodes as for those explicit macros are provided.
%   \fi
% \end{ltxsyntax}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(2.8,3) 
  \pentaprism[pentaprismsize=1.3](0,1.5)(1.5,1.5)(1.5,0)
  \drawbeam[arrows=->, arrowinset=0, arrowscale=1.5](0,1.5){}(1.5,0)
  \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
  \psdot(\oenodeIfc{2}{})\uput[0](\oenodeIfc{2}{}){2}
  \psdot(\oenodeIfc{3}{})\uput[90](\oenodeIfc{3}{}){3}
  \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% In \prettyref{sec:overview-ifcnode} finden Sie eine vollständige Liste aller
% Komponenten mit ihren Grenzflächenknoten.
% \fi
% \ifENGLISH
% See \prettyref{sec:overview-ifcnode} for a complete list of all
% components with their interface nodes.
% \fi
%
% \ifGERMAN\section{Referenzknoten für die Rotation}\fi
% \ifENGLISH\section{Rotation reference node}\fi
% \label{sec:rotrefnode}
%
% \begin{ltxsyntax}
%   \cmditem{oenodeRotref}{comp}
%
%   \ifGERMAN 
%   Der Referenzknoten um den eine Komponente mit \Lkeyword{angle} gedreht
%   wird. Die Position des Knotens wird mit dem \Lkeyword{rotateref} Parameter
%   definiert und kann dieselben Werte annehmen wie \Lkeyword{extnode}. Eine
%   vollständige Liste der möglichen Positionen finden Sie in
%   \prettyref{sec:overview-extnode}.
%   \fi
%   \ifENGLISH
%   The node around which a component is rotated by \Lkeyword{angle}. The
%   position is defined with the \Lkeyword{rotateref} parameter and can take the
%   same values as \Lkeyword{extnode}. See \prettyref{sec:overview-extnode} for
%   possible rotation reference nodes of all components.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[pos=t, linerange={1-2, 6-7, 11-12}]
\begin{pspicture}(0,0.1)(12,1.8) 
  \optbox[angle=20](0.5,1)(4.5,1)
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psline[style=Refline](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRotref{})\uput[-90](\oenodeRotref{}){Rotref}
  \optbox[angle=20, rotateref=bl](7.5,1)(11.5,1)
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psline[style=Refline](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRotref{})\uput[-90](\oenodeRotref{}){Rotref}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifGERMAN\section{Strahlknoten}\fi
% \ifENGLISH\section{Beam nodes}\fi
% \label{sec:beamnode}
%
% \ifGERMAN
% Die Endknoten eines \Lcs{drawbeam} oder \Lcs{drawwidebeam} Kommandos
% können wieder verwendet werden, wenn \Lkeyword{savebeampoints} gesetzt ist.
% \fi
% \ifENGLISH
% The end points of a recent \Lcs{drawbeam} or \Lcs{drawwidebeam} command can
% be reused if \Lkeyword{savebeampoints} is set.
% \fi
% \begin{ltxsyntax}
%   \cmditem{oenodeBeam}{num}
%
%   \ifGERMAN
%   Damit wird der Endknoten eines vorangegangenen \Lcs{drawbeam} Kommandos
%   angesprochen. Wird \prm{num} leer gelassen so wird \opt{1} genommen, was in
%   der Regel dem letzten Strahlengang entspricht. Auf welchen Strahl genau
%   Bezug genommen wird, hängt i.a. von den gewählten Einstellungen von
%   \Lkeyword{savebeampoints} und entsprechender Wahl von \prm{num} ab.
%   \fi
%   \ifENGLISH
%   Access the end point of a preceeding \Lcs{drawbeam} command. If \prm{num} is
%   left empty it defaults to \opt{1} which usually refers to the last beam
%   ray. However, generally it depends on the settings of
%   \Lkeyword{savebeampoints} and the choice of \prm{num} which beam you refer
%   to.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,0)(3,2) 
  \pnodes(0,1){A}(1.6,1){B}
  \optbox[position=end](A)(B)
  \drawbeam[beaminsidelast=false](A){1}
  \psdot(\oenodeBeam{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%   \cmditem{oenodeBeamUp}{num}
%   \cmditem{oenodeBeamLow}{num}
%
%   \ifGERMAN
%   Damit wird der obere («upper») oder untere («lower») Endknoten eines
%   vorangegangenen \Lcs{drawwidebeam} Kommandos angesprochen. Wird \prm{num}
%   leer gelassen so wird \opt{1} genommen, womit man sich in der Regel auf den
%   letzten Strahlengang bezieht. Auf welchen Strahl genau Bezug genommen wird,
%   hängt i.a. von den gewählten Einstellungen von \Lkeyword{savebeampoints} und
%   entsprechender Wahl von \prm{num} ab.
%   \fi
%   \ifENGLISH
%   Access the upper or lower end point of a preceeding \Lcs{drawwidebeam}
%   command. If \prm{num} is left empty it defaults to \opt{1}, which usually
%   refers to the last beam ray. However, generally it depends on the settings
%   of \Lkeyword{savebeampoints} and the choice of \prm{num} which beam you
%   refer to.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-6,10-10}]
\begin{pspicture}(0,0)(3,2) 
  \pnodes(0,1){A}(3,1){B}
  \lens[abspos=1, lensradius=-2](A)(B)
  \addtopsstyle{Beam}{%
    fillstyle=solid, fillcolor=green, opacity=0.3}
  \drawwidebeam[beamwidth=0.5](A){}(B)
  \psdot(\oenodeBeamUp{})\psdot(\oenodeBeamLow{})
  \uput[90](\oenodeBeamUp{}){\rput[rb](0,0){BeamUp}}
  \uput[-90](\oenodeBeamLow{}){\rput[rt](0,0){BeamLow}}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Beachten Sie, dass «oben» («upper») und «unten» («lower») bezüglich der
% Ausbreitungsrichtung des Strahls definiert ist. Ein Randstrahl der als «upper»
% startet can zu «lower» werden, wenn er den anderen Randstrahl kreuzt. Das wird
% in dem folgenden Beispiel erläutert:
% \fi
% \ifENGLISH
% Note, that «upper» and «lower» is defined with respect to the propagation
% direction of the beam. A marginal beam which started as «upper» can change to «lower»
% if it crosses the other marginal beam. This is shown in the following example,
% where the marginal rays exchange their roles:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-6,10-10,14-14}]
\begin{pspicture}(0,0)(3,2) 
  \pnodes(0,1){A}(3,1){B}
  \lens[abspos=1, n=2](A)(B)
  \addtopsstyle{Beam}{%
    fillstyle=solid, fillcolor=green, opacity=0.3}
  \drawwidebeam[beamwidth=0.5](A){}
  \psdot(\oenodeBeamUp{})\psdot(\oenodeBeamLow{})
  \uput[90](\oenodeBeamUp{}){\rput[rb](0,0){BeamUp}}
  \uput[-90](\oenodeBeamLow{}){\rput[rt](0,0){BeamLow}}
  \drawwidebeam[loadbeam, beaminsidefirst]{}(B)
  \psdot(\oenodeBeamUp{})\psdot(\oenodeBeamLow{})
  \uput[90](\oenodeBeamUp{}){\rput[rb](0,0){BeamUp}}
  \uput[-90](\oenodeBeamLow{}){\rput[rt](0,0){BeamLow}}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Bei einer Reflektion können ebenfalls die Rollen vertauscht werden.\fi
% \ifENGLISH After a reflection the roles can also be exchanged.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-6,8-8,15-15}]
\begin{pspicture}(0,-1)(4,2)
  \pnodes(0,1.5){A}(2,1.5){B}(2.8,0){C}
  \mirror[mirrorwidth=1.2, mirrortype=extended](A)(B)(C)
  \addtopsstyle{Beam}{%
    fillstyle=solid, fillcolor=green, opacity=0.3}
  \drawwidebeam[beamwidth=0.5](A){}
  \pnodes(\oenodeBeamUp{}){Up1}(\oenodeBeamLow{}){Low1}
  \drawwidebeam[loadbeam]{}(C)
  \psdot(\oenodeBeamUp{})\psdot(\oenodeBeamLow{})
  \uput[90](\oenodeBeamUp{}){\rput[lb](0,0){BeamUp}}
  \uput[-90](\oenodeBeamLow{}){BeamLow}
  \psdot(Up1)\psdot(Low1)
  \uput[90](Up1){\rput[lb](0,0){BeamUp}}
  \uput[0](Low1){\rput[l](0,0){BeamLow}}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN 
% Beachten Sie, dass sich die Orientierung von «oben» und «unten» in
% Version 3.3 geändert hat, siehe \prettyref{sec:bwd-comp-3.3}.
% \fi
% \ifENGLISH
% Note, that the orientation of «upper» and «lower» changed with version
% 3.3, for more details see \prettyref{sec:bwd-comp-3.3}.
% \fi
%
%   \cmditem{oeBeamCenter}{num}
%
%   \ifGERMAN Damit erhält man die Mitte zwischen oberem und unterem
%   Endknoten, die Koordinaten sind nur aus Postscript-Ebene verfügbar,
%   im Gegensatz zu \Lcs*{oenodeBeam*}, daher auch die an
%   \Lcs*{oeBeamVec*} angelehnte Nomenklatur. Ein Anwendungsbeispiel ist
%   \prettyref{ex:beamcenter}.
%   \fi
%   \ifENGLISH Get the mean of upper and lower beam node. The
%   coordinates are available only at Postscript level, in contrast to
%   the \Lcs*{oenodeBeam*} macros. For an example see 
%   \prettyref{ex:beamcenter}.
%   \fi
% \end{ltxsyntax}
%
% \ifGERMAN
% Die Strahlknoten können nur innerhalb der \Lenv*{pspicture}-Umgebung verwendet
% werden, in der sie definiert wurden. Um auf bestimmte Strahlknoten von
% außerhalb zugreifen zu können müssen diese vorher explizit umdefiniert werden:
% \fi
% \ifENGLISH
% The beam nodes can be accessed only within the \Lenv*{pspicture} environment
% they were defined in. If you want to use one of these nodes from outside, you
% must explicitely redefine them beforehand:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{lstlisting}
\pnode(\oenodeBeam{}){MyBeamNode}
\end{lstlisting}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
% Desweiteren werden die Endknoten durch \Lkeyword{stopinside}
% beeinflusst. Siehe \prettyref{sec:custombeam} für weitere Details.
% \fi
% \ifENGLISH
% The end points are also affected by \Lkeyword{stopinside}. See
% \prettyref{sec:custombeam} for further details.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,0)(3,2) 
  \pnodes(0,1){A}(1.6,1){B}
  \optbox[position=end](A)(B)
  \psset{beaminsidelast=false}
  \drawbeam[linecolor=red, beampos=0.3](A){1}
  \psdot(\oenodeBeam{})
  \drawbeam[stopinside](A){1}
  \psdot(\oenodeBeam{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\section{Strahlvektor}\fi
% \ifENGLISH\section{Beam vector}\fi
%
% \ifENGLISH In addition to the beam nodes (see
% \prettyref{sec:beamnode}) also the normalized vectors of the last
% saved beams (see \Lkeyword{savebeam}) can be accessed at Postscript
% level.
%
% These are again separated in single, upper and lower beams. \prm{num}
% has the same meaning as for \Lcs{oenodeBeam}.
% \fi
%
% \ifGERMAN Zusätzlich zu den Strahlknoten (siehe
% \prettyref{sec:beamnode}) kann auf Postscript-Ebene auf die normierten
% Strahlvektoren der letzten gespeicherten Strahlen (siehe
% \Lkeyword{savebeam}) zugegriffen werden.
%
% Auch hier wird zwischen Einzelstrahlen, und oberem bzw. unterem Strahl
% unterschieden. \prm{num} hat dieselbe Bedeutung wie bei \Lcs{oenodeBeam}.
% \fi
% \begin{ltxsyntax}
%   \cmditem{oeBeamVec}{num}
%   \cmditem{oeBeamVecUp}{num}
%   \cmditem{oeBeamVecLow}{num}
% \end{ltxsyntax}
%
% \ifGERMAN Bei den gespeicherten Werten handelt es sich um den
% normierten Richtungsvektor des letzten Strahlsegments, dieser ist nur
% auf Postscript-Ebene verfügbar. Dieser Richtungsvektor ist im
% folgenden Beispiel in rot zu sehen. Im Gegensatz dazu wird mit
% \Lkeyword{savebeam} der Richtungsvektor gespeichert, der nach der
% letzten Grenzfläche gelten würde, also für einen nachfolgenden Strahl
% verwendet würde. Dieser ist im Beispiel in blau eingezeichnet.
% \fi
% \ifENGLISH The saved values are those of the normalized direction
% vector of the last beam segment and are drawn in red in the next example. In contrast
% to this, the vector saved with \Lkeyword{savebeam} is that behind the
% last interface and would be used for a following beam. This is shown
% in blue in the following example.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]beaminsidelast}]
\begin{pspicture}(4,2)
  \optbox[optboxsize=2 1, angle=20, n=2](0,1)(4,1)
  \drawbeam[beaminsidelast, beamalign=abs](0,1){1}
  \pnode(\oenodeBeam{}){Out}
  \nodexn{(Out)+(!\oeBeamVec{})}{C}
  \drawbeam[linecolor=blue, arrows=->, loadbeam]{1}(C)
  \drawbeam[linecolor=red, arrows=->](Out)(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Das Verhalten ist unabhängig davon, ob der letzte Strahl nur
% berechnet, oder auch gezeichnet wurde. Das nächste Beispiel verwendet
% \Lkeyword{stopinside} anstelle vom Parameter \Lkeyword{beaminsidelast}
% im vorangegangenen Beispiel; die Strahlvektoren bleiben davon
% unbeeinflusst.
% \fi
% \ifENGLISH This behaviour is independent of whether the last beam was
% only calculated or also drawn. The next example uses
% \Lkeyword{stopinside} instead of \Lkeyword{beaminsidelast} compared to
% the previous example; the beam vectors are not affected by this.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]stopinside}]
\begin{pspicture}(4,2)
  \optbox[optboxsize=2 1, angle=20, n=2](0,1)(4,1)
  \drawbeam[stopinside, beamalign=abs](0,1){1}
  \pnode(\oenodeBeam{}){Out}
  \nodexn{(Out)+(!\oeBeamVec{})}{C}
  \drawbeam[linecolor=blue, arrows=->, loadbeam]{1}(C)
  \drawbeam[linecolor=red, arrows=->](Out)(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Das kann dazu genutzt werden, um z.B. die Polarisation eines
% Strahls zu kennzeichnen. Im folgenden Beispiel werden die neuen Knoten
% \prm{U} und \prm{L}definiert, indem mit \Lcs*{nodexn} die Endpunkte
% des oberen bzw. unteren Strahls entlang ihrer Trajektorie zurück
% verschoben werden.
% \fi
% \ifENGLISH A possible application is marking of the polarization of a
% beam. In the following example we define the nodes \prm{U} and \prm{L}
% which are shifted with \Lcs*{nodexn} from the end point of the upper
% and lower beam along the respective beam trajectory.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-9,11-11}]
\begin{pspicture}(3,3)
  \pnodes(0,1.5){A}(3,1.5){B}
  \lens[abspos=1, lens=5 5 3, n=2.0](A)(B)
  \optplane[angle=90](B)
  \drawwidebeam[beamwidth=2](A){1-2}
  \nodexn{(\oenodeBeamUp{})-2(!\oeBeamVecUp{})}{U}
  \nodexn{(\oenodeBeamLow{})-2(!\oeBeamVecLow{})}{L}
  \polarization(U)(\oenodeBeamUp{})
  \polarization(L)(\oenodeBeamLow{})
  \psdot(U)\uput[45](U){U}\psdot(L)\uput[-45](L){L}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \begin{ltxsyntax}
%   \cmditem{oeBeamVecMedian}{num}
%   \ifGERMAN Der Mittelwert aus oberem und unterem Strahlvektor.\fi
%   \ifENGLISH The mean of upper and lower beam vector.\fi
% \end{ltxsyntax}
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[caption={caption}, label={ex:beamcenter}]
\begin{pspicture}(3.5,2.6)
  \pnodes(0,2){A}(1,2){B}(3,1){C}
  \optprism(A)(B)(C)
  \newpsstyle{Beam}{linestyle=none, fillstyle=solid, beamwidth=0.2, beamnodealign=vector}
  \drawwidebeam[fillcolor=orange](A){}
  \psset[optexp]{beampathskip=1}
  \drawwidebeam[fillcolor=green, n=1.2, savebeam=2](A){}(C)
  \drawwidebeam[fillcolor=red, n=1.4, savebeam=3](A){}(C)
  \drawwidebeam[fillcolor=red!50!black, n=1.57, savebeam=4](A){}(C)
  \multido{\i=2+1}{3}{%
    \backlayer{%
      \pnode(!\oeBeamCenter{\i}){Det\i}
      \nodexn{(Det\i)-(!\oeBeamVecMedian{\i})}{Det\i'}}
    \optdetector[detsize=0.4 0.4](Det\i')(Det\i)}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Weitere Anwendungsbeispiele sind \prettyref{ex:glan-thompson} und \prettyref{ex:wgm-pdc}.\fi
% \ifENGLISH Further example are \prettyref{ex:glan-thompson} and \prettyref{ex:wgm-pdc}.\fi
%
%
% \ifGERMAN\section{Knotenübersicht}\fi
% \ifENGLISH\section{Node overview}\fi
%
% \ifENGLISH This is an overview of all available component nodes.\fi
% \ifGERMAN Dies ist eine Übersicht über alle verfügbaren Komponentenknoten.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[pos=t, linerange={2-4,17-17}]
\psset{unit=2}
\begin{pspicture}(0.3,0.1)(4.8,1.6)
  \pnodes(0.5,0.5){A}(4.5,0.5){B}
  \optbox[compshift=0.5, angle=10, rotateref=tr, extnode={-0.5,1}](A)(B)
  \psline[style=Refline](\oenodeTrefA{})(\oenodeTrefB{})
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\uput[-90](\oenodeRefA{}){RefA}
  \psdot(\oenodeRefB{})\uput[-90](\oenodeRefB{}){RefB}
  \psdot(\oenodeTrefA{})\uput[90](\oenodeTrefA{}){TrefA}
  \psdot(\oenodeTrefB{})\uput[90](\oenodeTrefB{}){TrefB}
  \psdot(\oenodeOut{})\uput[80](\oenodeOut{}){\rput[l](0,0.1){Out}}
  \psdot(\oenodeIn{})\uput[100](\oenodeIn{}){\rput[r](0,0){In}}
  \psdot(\oenodeCenter{})\uput[90](\oenodeCenter{}){Center}
  \psdot(\oenodeRotref{})\uput[90](\oenodeRotref{}){Rotref}
  \psdot(\oenodeExt{})\uput[90](\oenodeExt{}){Ext}
  \psdot(\oenodeLabel{})\uput[90](\oenodeLabel{}){Label}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN\chapter{Verbinden von Komponenten}\fi
% \ifENGLISH\chapter{Connecting components}\fi
% \label{chap:connecting}
% 
% \ifGERMAN 
% Das \nxLPack{pst-optexp}-Paket stellt unterschiedlichen Methoden
% bereit, Komponenten vollautomatisch oder manuell, mit Lichtstrahlen,
% Fasern oder Drähten zu verbinden.
% \begin{compactitem}
% \item In \prettyref{sec:accessobj} wird beschrieben wie Komponenten
%   und Knoten für Verbindungen angesprochen werden.
% \item Strahlverbindungen im Allgemeinen und das Verhalten von
%   Einzelstrahlen wird in \prettyref{sec:drawbeam} beschrieben.
% \item \prettyref{sec:drawwidebeam} erweitert diese Beschreibung von
%   Strahlverbindungen auf ausgedehnte Strahlen und deren Eigenheiten.
% \item In \prettyref{sec:error-handling} wird gezeigt, wie fehlerhafte
%   Strahlverbindungen (verfehlen von Grenzflächen) gehandhabt wird).
% \item \prettyref{sec:custombeam} erläutert, wie bestimmte, stückweise
%   definierte Strahlengänge, wie z.B. bei eine Teleskop, einfach
%   realisiert werden können.
% \item Manuelle Faserverbindungen werden in \prettyref{sec:drawfiber}
%   behandelt, manuelle elektrischen Verbindungen, die sehr ähnlich
%   funktionieren, in \prettyref{sec:drawwire}.
% \item Automatische Verbindungen werden in
%   \prettyref{sec:drawconn-auto} erklärt.
% \item \prettyref{sec:layers} erklärt das Konzept der «front» und
%   «back»-Ebene.
% \end{compactitem}
% \fi
% \ifENGLISH
% The \LPack{pst-optexp} package provides several methods for automatic
% and manual connections of components with beams, fibers, or wires.
% \begin{compactitem}
% \item \prettyref{sec:accessobj} describes how to access objects and
%   nodes for use with the connection macros.
% \item Beam drawing in general and the behavior of single beams is
%   explained in \prettyref{sec:drawbeam}.
% \item \prettyref{sec:drawwidebeam} extends this description of beam
%   drawing to wide beams and their special properties.
% \item \prettyref{sec:error-handling} shows how errors in beam
%   connections (missed interfaces etc.) are handled.
% \item \prettyref{sec:custombeam} explains how customized, piecewise
%   defined beam paths, like e.g. in a telescope, can be easily
%   constructed.
% \item Manual fiber connections are described in
%   \prettyref{sec:drawfiber}, manual wire connections, which show the
%   same behavior, are treated in \prettyref{sec:drawwire}.
% \item Automatic connections are explained in
%   \prettyref{sec:drawconn-auto}.
% \item \prettyref{sec:layers} introduces the concept of front and back
%   layer for the drawings.
% \end{compactitem}
% \fi
% \ifGERMAN\section{Zugriff auf Komponenten}\fi
% \ifENGLISH\section{Accessing components}\fi\label{sec:accessobj}
% 
% \ifENGLISH
% All macros for connections can take either an ID, a \Lkeyword{compname}
% identifier (see \prettyref{sec:namingobj}) or PSTricks nodes as arguments,
% which are denoted with \prm{obj$_1$}, \prm{obj$_2$}, \ldots. To distinguish
% between nodes and components, nodes must be either enclosed in parenthesis
% within the brackets, or enclosed only in parenthesis:
% \Lcs{drawbeam}\opt{\{(node)\}\{comp\}}, or \Lcs{drawbeam}\opt{(node)\{comp\}}.
% \fi
% \ifGERMAN
% Alle Makros für Verbindungen akzeptieren entweder eine ID, ein
% \Lkeyword{compname} Bezeichner (siehe \prettyref{sec:namingobj}) oder einen
% PSTricks-Knoten als Argument, die als \prm{obj$_1$}, \prm{obj$_2$}, \ldots{}
% bezeichnet werden. Um zwischen Knoten und Komponenten unterscheiden zu können,
% müssen Knoten entweder in runde Klammern innerhalb der geschweiften Klammern
% eingeschlossen werden oder dürfen nur runde Klammern haben:
% \Lcs{drawbeam}\opt{\{(node)\}\{comp\}}, oder
% \Lcs{drawbeam}\opt{(node)\{comp\}}.
% \fi
%
% \begin{enumerate}
% \item 
%   \ifGERMAN Auf alle Komponenten kann immer unter Verwendung der ID
%   zugegriffen werden.
%   \fi
%   \ifENGLISH All components can always be accessed via their ID.\fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \pnodes(0,1){A}(1.5,1){B}
  \optbox[position=end, labeloffset=0](A)(B){1}
  \drawbeam(A){1}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifGERMAN Wenn eine Komponente mit \Lkeyword{compname} einen zusätzlichen
%   Namen erhalten hat, so kann dieser anstelle der ID verwendet werden.
%   \fi
%   \ifENGLISH A component which has been assigned a name with
%   \Lkeyword{compname} can also be accessed via this instead of its ID.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{compname}}]
\begin{pspicture}(3,2)
  \psset{position=end, labeloffset=0}
  \optbox[compname=obj](0,1)(1.5,1){obj}
  \drawbeam(0,1){obj}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \item
%   \ifGERMAN Wird das Argument leer gelassen, dann greift man auf die zuletzt
%   definierte Komponente zu.
%   \fi
%   \ifENGLISH If the argument is left empty, use the last component defined.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \psset{position=end, labeloffset=0}
  \optbox(0,0.5)(1.5,0.5){1}
  \optbox(0,1.5)(1.5,1.5){2}
  \drawbeam(0,1){}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
% \ifGERMAN 
% Es können auch Zahlintervalle verwendet werden, gültige Intervallangaben sind
% \begin{description}
% \item[\parbox{2em}{\texttt{x-y}}] Von \opt{x} bis \opt{y}, ist \opt{x}
%   größer als \opt{y}, so wird heruntergezählt. Ist der gesamte
%   Bereich nicht definiert, dann wird ein Fehler ausgegeben.
% \item[\parbox{2em}{\texttt{x-}}] Von \opt{x} bis zur letzten Komponente.
% \item[\parbox{2em}{\texttt{\hphantom{x}-y}}] Von der ersten Komponente
%   bis \opt{y}. Ist \opt{y} außerhalb des definierten Bereichs, dann
%   wird eine Warnung ausgegeben.
% \item[\parbox{2em}{\texttt{\hphantom{x}-}}] Verbinde alle Komponenten.
% \end{description}
% \fi
% \ifENGLISH You can also use number ranges, valid range specifications are
% \begin{description}
% \item[\parbox{2em}{\texttt{x-y}}] From \opt{x} to \opt{y}, if \opt{x}
%   is greater than \opt{y}, the numbers are decremented. If the whole
%   range is not defined, an error is raised.
% \item[\parbox{2em}{\texttt{x-}}] From \opt{x} to the last component.
% \item[\parbox{2em}{\texttt{\hphantom{x}-y}}] From the first component
%   to \opt{y}. If \opt{y} is outside the valid range, a warning is
%   raised.
% \item[\parbox{2em}{\texttt{\hphantom{x}-}}] Connect all components.
% \end{description}
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,3)
  \psset{position=end, optboxsize=0.5 0.5, bssize=0.5}
  \optbox[compname=obj](0.5,0.5)(0.5,2.5){obj, 1}
  \beamsplitter(0.5,2.5)(0.5,1)(2.5,1){2}
  \optbox(0.5,1)(2.5,1){3}
  \drawbeam{1-3}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{enumerate}
%
% \ifENGLISH\section{Drawing beams}\fi
% \ifGERMAN\section{Strahlen zeichnen}\fi
% \label{sec:drawbeam}
%
% \ifENGLISH
% The package provides several ways to connect components and nodes with beams,
% which can be either single rays or wide beams. Most parameters have the same
% effect on both single and wide beams so most examples will be shown for
% single beams only. For options specific to wide beams please see
% \prettyref{sec:drawwidebeam}.
% \fi
% \ifGERMAN Es gibt mehrere Möglichkeiten Komponenten und Knoten mit Strahlen zu
% verbinden: einfache Linien oder ausgedehnte Strahlen. Die meisten Parameter
% haben für beide Typen dieselbe Bedeutung, daher beschränken sich die
% entsprechenden Beispiele auf die einfachen Strahlen. Die Parameter die nur
% ausgedehnte Strahlen betreffen, werden in \prettyref{sec:drawwidebeam}
% beschrieben.
% \fi
%
% \begin{ltxsyntax}
%   \xLcs{drawbeam}\cmditem{drawbeam}[options]{obj$_1$}{obj$_2$}\ldots
%   \xLcs{drawwidebeam}\cmditem*{drawwidebeam}[options]{obj$_1$}{obj$_2$}\ldots
%
%   \ifENGLISH
%   These are the two macros for beam connections; they can take a
%   variable number of arguments (minimum of two) which can be either an
%   ID, an ID range, a \Lkeyword{compname}, or a PSTricks nodes (see
%   \prettyref{sec:accessobj}). To distinguish between nodes and
%   components, nodes must be either enclosed in parenthesis within the
%   brackets, or enclosed only in parenthesis:
%   \Lcs{drawbeam}\opt{\{(node)\}\{comp\}}, or
%   \Lcs{drawbeam}\opt{(node)\{comp\}}.
%   \fi
%   \ifGERMAN 
%   Diese beiden Makros sind für die Strahlverbindungen zuständig, sie
%   akzeptieren eine variable Anzahl an Argumenten (mindestens zwei),
%   die entweder eine ID, ein ID-Intervall, ein \Lkeyword{compname} oder
%   ein PSTricks-Knoten sein können (siehe \prettyref{sec:accessobj}. Um
%   zwischen Knoten und Komponenten unterscheiden zu können, müssen
%   Knoten entweder in runde Klammern innerhalb der geschweiften
%   Klammern eingeschlossen werden oder dürfen nur runde Klammern haben:
%   \Lcs{drawbeam}\opt{\{(node)\}\{comp\}}, oder
%   \Lcs{drawbeam}\opt{(node)\{comp\}}. 
%   \fi
% \end{ltxsyntax}
%
% \subsection{Raytracing}\label{sec:raytracing}
% \ifENGLISH
% The beam connection macros support two modes of tracing the beam across the
% optical components: one is to use refractive indices and Snell's law to
% determine the beam path. The other mode is to connect the components only,
% regardless of their optical properties.
%
% You must always keep in mind, that this is a package for \emph{sketching}
% experimental setups. Therefore, we do not provide a comprehensive raytracing
% framwork, because deviations from the actual physical path are often desired
% for sketches: beam angles and divergences should be in many cases more extreme
% than in the real setup in order to highlight certain aspects. You should also
% consider the refractive index (see \prettyref{sec:n}) only as a tool to
% optimize the visual effects of the beam path, and not stick with its
% physically correct values.
% \fi
% \ifGERMAN
% Der Strahlengang durch die Komponenten kann mit zwei unterschiedlichen
% Methoden ermittelt werden: über den Brechungsindex und das Snelliussche
% Brechungsgesetz, oder indem die Komponenten unabhängig von ihren optischen
% Eigenschaften einfach verbunden werden.
%
% Behalten Sie immer im Hinterkopf, dass dieses Paket für \emph{Skizzen}
% optischer Aufbauten gedacht ist und daher keine vollständige Umgebung zur
% Strahlverfolgung bereitstellt. Abweichungen vom physikalisch richtigen Weg
% können in vielen Fällen erwünscht sein: Winkel und Divergenzen werden häufig
% extremer dargestellt um bestimmte Effekte hervorzuheben. Daher sollten Sie den
% Brechungsindex (siehe \prettyref{sec:n}) lediglich as Mittel zur Optimierung
% des gewünschten Lichtweges sehen und nicht zu sehr an den physikalisch
% richtigen Werten festhalten.
% \fi
%
% \begin{optionlist}
%   \boolitem[true]{raytrace}
%   \ifENGLISH
%   Chooses the mode of tracing the beam path,
%   \opt{true} uses the refractive index («raytracing»), \opt{false} selects
%   component connection («connect» mode).
%
%   In most cases, the «connect» mode is equivalent to «raytracing» with
%   \Lkeyword{n}\opt{=1}, except for \Lcomp{optprism} and \Lcomp{doveprism}, where
%   the interface nodes (\prettyref{sec:ifcnode}) are simply connected. 
%   See the following two example for the differences between the tracing modes
%   using these two components. The interface nodes are highlighted for clarity.
%
%   The raytraced beam with \Lkeyword{n}\opt{=1} (blue) passes the component
%   without changing its direction, the refraction for \Lkeyword{n}\opt{=1.5} is
%   calculated (red), and the «connect» beam (green) just passes through the two
%   interface nodes.
%   \fi
%   \ifGERMAN
%   Wählt die Methode der Strahlverfolgung, mit \opt{true} wird der
%   Brechungsindex («raytracing») verwendet, \opt{false} verbindet die
%   Komponente lediglich («connect» Variante).
%
%   In vielen Fällen ist «connect» identisch mit «raytracing» für
%   \Lkeyword{n}\opt{=1}, außer für \Lcomp{optprism} oder \Lcomp{doveprism} bei
%   denen die Grenzflächenknoten (\prettyref{sec:ifcnode}) dann einfach nur
%   verbunden werden.  Die folgenden beiden Beispiele zeigen die Unterschiede
%   der beiden Methoden für diese Komponenten. Die Grenzflächenknoten sind zum
%   besseren Verständnis hervorgehoben.
%
%   Der «raytracing» Strahl mit \Lkeyword{n}\opt{=1} (blau) wird durch die
%   Komponente transmittiert ohne die Richtung zu verändern, für
%   \Lkeyword{n}\opt{=1.5} (rot) wird die Brechung an den Grenzflächen berechnet,
%   und der «connect» Strahl (grün) durchläuft genau die Grenzflächenknoten.
%   \fi
%
%\iffalse
%<*ignore>
%\fi
\begin{LTXexample}[linerange={1-7,9-9}]
\begin{pspicture}(3,2.2)
  \pnodes(0,1.5){A}(1,1.5){B}(3,1){C}
  \optprism[prismsize=1.2](A)(B)(C)
  \optplane(C)
  \drawbeam[n=1, linecolor=blue](A){1}{2}
  \drawbeam[n=1.5, linecolor=red](A){1}{2}
  \drawbeam[raytrace=false, linecolor=DGreen](A){1}{2}  
  \psdot(\oenodeIn{1})\psdot(\oenodeOut{1})
\end{pspicture}
\end{LTXexample}
%\iffalse
%</ignore>
%\fi
%
% \ifENGLISH
% For the \Lcomp{doveprism} the same applies as for the \Lcomp{optprism}, but the
% raytraced beam with \Lkeyword{n}\opt{=1} (blue) misses the second interface
% because it is not refracted and stops therefore at the first interface (see
% \prettyref{sec:error-handling}). Again, the green «connect» ray passes through
% all interface nodes.
% \fi
% \ifGERMAN
% Das \Lcomp{doveprism} wird im Prinzip genauso behandelt wie das \Lcomp{optprism},
% der «raytracing» Strahl mit \Lkeyword{n}\opt{=1} (blau) trifft wegen fehlender
% Brechung die zweite Grenzfläche gar nicht, und endet daher schon an der ersten
% Grenzflächen (siehe \prettyref{sec:error-handling}). Der grüne «connect»
% Strahl verläuft wieder durch die Grenzflächenknoten.
% \fi
%
%\iffalse
%<*ignore>
%\fi
\begin{LTXexample}[linerange={1-6,8-8}]
\begin{pspicture}(4,2)
  \pnodes(0,1){A}(4,1){B}
  \doveprism[doveprismsize=1](A)(B)
  \drawbeam[n=1, linecolor=blue, beampos=0.1](A){1}(B)
  \drawbeam[n=1.5, linecolor=red](A){1}(B)
  \drawbeam[raytrace=false, linecolor=DGreen](A){1}(B)  
  \psdot(\oenodeIn{1})\psdot(\oenodeIfc{2}{1})\psdot(\oenodeOut{1})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN 
% Für «connect» können auch unterschiedliche Anfangsbedingungen
% (\ref{prm:beampos}) verwendet werden.
% \fi
% \ifENGLISH
% The «connect» mode also supports changing the initial conditions
% (\ref{prm:beampos}).
% \fi
%\iffalse
%<*ignore>
%\fi
\begin{LTXexample}[linerange={1-7,9-9}, morekeywords={[21]beampos,beamangle}]
\begin{pspicture}(3.7,2)
  \pnodes(0,1){A}(4,1){B}
  \doveprism[doveprismsize=1](A)(B)
  \psset[optexp]{raytrace=false}
  \drawbeam[linecolor=blue, beampos=0.2, beamangle=-10](A){1}(B)
  \drawbeam[raytrace=false, linecolor=DGreen](A){1}(B) 
  \drawbeam[linecolor=red, beampos=-0.2, beamangle=10](A){1}(B)
  \psdot(\oenodeIn{1})\psdot(\oenodeIfc{2}{1})\psdot(\oenodeOut{1})
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[linerange={1-7,9-9}, morekeywords={[21]beampos,beamangle}]
\begin{pspicture}(3.7,2)
  \pnodes(0,1){A}(4,1){B}
  \doveprism[doveprismsize=1](A)(B)
  \psset[optexp]{raytrace=false}
  \drawbeam[linecolor=blue, beampos=0.2](A){1}(B)
  \drawbeam[linecolor=DGreen](A){1}(B) 
  \drawbeam[linecolor=red, beampos=-0.2](A){1}(B)
  \psdot(\oenodeIn{1})\psdot(\oenodeIfc{2}{1})\psdot(\oenodeOut{1})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[true]{useNA}
% \ifGERMAN Ein Strahlengang wird abgebrochen, falls eine Komponente nicht
% getroffen wird. Für manche Zwecke, z.B. zum Ermitteln des richtigen
% Brechungsindex, kann es sinnvoll sein, wenn die numerische Apertur eine
% Komponente nicht berücksichtigt wird. In dem folgenden Beispiel wird der
% rote Strahl gezeichnet, obwohl er außerhalb der gezeichneten Spiegelfläche
% liegt.
% \fi
% \ifENGLISH The beam path is interrupted if an interface is missed. In some
% cases, e.g. to estimate the correct refractive index for a ray trace, it can
% be useful if the numerical aperture of the components is not considered. The
% red beam in the following example is drawn, although it hits the mirror
% outside the drawn mirror surface.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \pnodes(0,0.5){A}(2.5,0.5){B}(2.5,2){C}
  \mirror(A)(B)(C)
  \psset{useNA=false}
  \drawbeam(A){}(C)
  \drawbeam[linecolor=red, beamangle=10](A){}(C)  
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \end{optionlist}
%
% \ifENGLISH\subsection{Refractive index}\fi
% \ifGERMAN\subsection{Brechungsindex}\fi
% \label{sec:n}
%
% \ifENGLISH
% The raytracing depends on the refractive index, which may be set for each
% component separately. The refractive index is always relative to the
% background which has a constant value for the whole sketch.
% \fi
% \ifGERMAN
% Das Raytracing wird durch den Brechungsindex bestimmt, der für jede Komponente
% einzeln gesetzt werden kann. Der Wert ist relativ zum Hintergrund, für den ein
% konstanter Wert für die gesamte Skizze angenommen wird.
% \fi
%
% \begin{optionlist}
% \valitem[1.5]{n}{code}
% \ifGERMAN 
% Setzt den Brechungsindex relativ zum Hintergrund. Diese Option hat zwei
% Anwendungsbereiche: zum einen kann der Index einer Komponente gesetzt werden,
% zum anderen der Brechungsindex für einen Strahlengang:
% \fi
% \ifENGLISH Sets the relative refractive index respect to the background. This
% parameter has two scopes, you can either set the refractive index of each
% component or of each beam ray: 
% \fi
% \end{optionlist}
%
% \ifGERMAN
% \begin{enumerate}
% \item Wird \Lkeyword{n} als globaler Parameter oder als Komponentenparameter
%   verwendet, so wird der Index für alle betroffenen Komponenten gesetzt. Ohne
%   weitere Änderungen wird jeder Lichtstrahl diese Werte verwenden.
% \item Als Parameter zu \Lcs{drawbeam} oder \Lcs{drawwidebeam} kann der
%   Brechungsindex der Komponenten für einzelne Strahlengänge überschrieben oder
%   geändert werden. Das kann sehr nützlich sein, um z.B. chromatische
%   Dispersion zu illustrieren. Soll die Änderung global für alle oder mehrere
%   Lichtstrahlen wirksam sein, so muss der gewünschte Wert dem
%   \Lstyle{Beam}-Stil hinzugefügt werden, da globale Definitionen von
%   \Lkeyword{n} nur die Komponenten betreffen.
% \end{enumerate}
% \fi
% \ifENGLISH
% \begin{enumerate}
% \item Using \Lkeyword{n} as global parameter or component argument
%   sets a fixed refractive index for each affected component. Without further
%   actions, all beam paths experience this refractive index.
% \item As parameter for \Lcs{drawbeam} or \Lcs{drawwidebeam} you can overwrite
%   or even change the refractive index of the components for specific beam
%   paths. This can be very useful e.g. to simulate chromatic dispersion. To set
%   this globally for all beams you must add the respective parameter
%   definition to the \Lstyle{Beam} style because global definitions of
%   \Lkeyword{n} affect only the components and not the beams.
% \end{enumerate}
% \fi
%
% \ifENGLISH
% The \prm{code} can in general be any Postscript code which evaluates to a
% number, e.g. \opt{1.5}, or \opt{5 sqrt}. If the \prm{code} starts with a
% \opt{*}, it will be interpreted as an algebraic
% expression\fnurl{http://mirror.ctan.org/graphics/pstricks/base/doc/pst-news08.pdf},
% e.g. \opt{*sqrt(5)} is equivalent to \opt{5 sqrt}. Inside the \prm{code} you
% can access the predefined refractive index of the component via \opt{n} which
% allows you to change the index relative to its original value. Use
% e.g. \opt{n=n 1.01 mul} to change \opt{n} by one percent.
%
% In the following you find several examples about the different aspects of
% using \Lkeyword{n}.
% \fi
% \ifGERMAN
% Der \prm{code} kann jeglicher Postscript-Kode sein, der zu einer Zahl
% ausgewertet werden kann, also z.B. \opt{1.5} oder \opt{5 sqrt}. Beginnt
% \prm{code} mit einem \opt{*}, so wird der Code als algebraischer
% Ausdruck\fnurl{http://mirror.ctan.org/graphics/pstricks/base/doc/pst-news08.pdf}
% ausgewertet, d.h. \opt{*sqrt(5)} ist äquivalent zu \opt{5 sqrt}. Innerhalb von
% \prm{code} kann mit \opt{n} auf den vordefinierten Brechungsindex der
% Komponenten zugegriffen werden, es kann also eine Änderung relativ zum
% ursprünglichen Wert erzielt werden. Mit \opt{n=n 1.01 mul} kann \opt{n}
% z.B. um ein Prozent geändert werden.
%
% In den folgenden Beispielen werden diese unterschiedlichen Möglichkeiten von
% \Lkeyword{n} gezeigt.
% \fi
%
% \begin{enumerate}
% \item 
%   \ifENGLISH Set a fixed refractive index for the component. Interestingly,
%   for the default shape of the \Lcomp{doveprism} a refractive index of
%   $\sqrt{5}$ gives the ideal output direction which is the same as the input
%   direction.
%   \fi
%   \ifGERMAN
%   Setze den Brechungsindex einer Komponente. Interessanterweise ist für die
%   Standardform des \Lcomp{doveprism} ein Brechungsindex von $\sqrt{5}$ der
%   ideale Wert so dass der Ausgangsstrahl parallel zum Eingangsstrahl verläuft.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample} 
\begin{pspicture}(3,1.5)
  \pnodes(0,1){A}(3,1){B}
  \doveprism[n=*sqrt(5)](A)(B)
  \drawbeam(A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH In this example one beam uses the default refractive index of the
%   components (green), the other one overwrites it with a value of \opt{2}
%   (red).
%   \fi
%   \ifGERMAN
%   Ein Strahl (grün) verwendet die voreingestellten Werte der Komponenten, der
%   rote überschreibt diese mit \opt{2}.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{n}}]
\begin{pspicture}(3,3)
  \pnodes(0,1){A}(3,1){B}
  \optplane(A)
  \psset{lens=3 3 2, n=1.5}
  \lens[abspos=0.5](A)(B)
  \lens[abspos=2](A)(B)
  \optplane(B)
  \addtopsstyle{Beam}{beampos=0.5}
  \drawbeam{-}
  \drawbeam[linecolor=red, n=2]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH 
%   Now, the red beam uses the default refractive index of the component, the
%   yellow beam adds \opt{0.5} to the default index.
%   \fi
%   \ifGERMAN
%   Der rote Strahl verwendet die voreingestellten Werte, der grüne ändert diese
%   um \opt{0.5}.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{n}}]
\begin{pspicture}(3,3)
  \pnodes(0,1.5){A}(3,1.5){B}
  \lens[lens=4 4 3, n=2, abspos=0.3](A)(B)
  \optplane[compname=Plane](B)
  \psset{beampos=0.6}
  \drawbeam[linecolor=red](A){1}{Plane}
  \drawbeam[linecolor=yellow, n=*(n+0.5)](A){1}{Plane}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH 
%   Dynamically changing the refractive index is very useful to emulate
%   chromatic dispersion. Here, we sketch the dispersion of a prism by
%   calculating the refractive index with Sellmaier's
%   equation\fnurl{http://en.wikipedia.org/wiki/Sellmeier_equation} for
%   different wavelengths.
%   \fi
%   \ifGERMAN
%   Mit dynamischer Anpassung von \Lkeyword{n} kann chromatische Dispersion sehr
%   gut emuliert werden. Hier wird die Dispersion eines Prisma gezeigt, der
%   Brechungsindex wird mit der Sellmaier
%   Gleichung\fnurl{http://en.wikipedia.org/wiki/Sellmeier_equation} für die
%   unterschiedlichen Wellenlängen berechnet. 
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{n}}]
\begin{pspicture}(3,3)
  \pnodes(-1,0){A}(1,2.2){B}(3,0){C}
  \optplane(0,2.15)
  \optprism[prismalign=center, prismangle=59](A)(B)(C)
  \optplane(C)
  \definecolor[ps]{bl}{rgb}{%
    tx@addDict begin tx@OptexpDict begin
      Wavelength wavelengthToRGB 
      Red Green Blue 
    end end }%
  \addtopsstyle{Beam}{linecolor=bl, linewidth=0.4\pslinewidth, beamalign=abs}
  \multido{\iLambda=400+4}{60}{%
    \pstVerb{/Wavelength \iLambda\space def }%
    \drawbeam[n=Wavelength Sellmaier]{-}%
  }%
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
% \ifENGLISH Using the numerical aperture of a pinhole as spectral filter.\fi
% \ifGERMAN Die numerische Apertur einer Lochblende als spektraler Filter.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{n}}]
\begin{pspicture}(0.3,0)(3.3,5.2)
  \pnodes(0.3,1){A}(2,1){B}(3,2){C}(2.5,5){D}
  \optplane(A)
  \optgrating[reverse](A)(B)(C)
  \pinhole[phwidth=-0.1, innerheight=0.03, abspos=0.5](D)(B)
  \optplate[position=end, plateheight=1.5](B)(D)
  \definecolor[ps]{bl}{rgb}{%
    tx@addDict begin Red Green Blue end}%
  \drawbeam[linecolor=red]{1-2}
  \addtopsstyle{Beam}{linecolor=bl, linewidth=0.4\pslinewidth}
  \multido{\i=0+1}{60}{%
    \pstVerb{%
      \i\space 650 400 sub 59 div mul 400 add 
      tx@addDict begin wavelengthToRGB end }%
    \drawbeam[beamangle=\i\space 0.1 mul 3 sub]{2-}%
  }%
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{enumerate}
%
% \begin{optionlist}
%   \valitem{refractiveindex}{code}
%   \deprecatedmsg{\Lkeyword{n}}
% \end{optionlist}
%
% \ifENGLISH\subsection{Initial conditions}\fi
% \ifGERMAN\subsection{Anfangsbedingungen}\fi
%
% \begin{optionlist}
% \optitem[0]{beampos}{[\prm{x} ]\prm{y}}
% \ifENGLISH
% This is the start position (\prm{x}, \prm{y}) of the beam at the first
% interface. Both values are of \prm{psnum} type. If a single number is given,
% the $x$-coordinate is set to \opt{0}.
% \fi
% \ifGERMAN
% Die Startposition (\prm{x}, \prm{y}) des Strahls an der ersten
% Grenzfläche. Beide Zahlen sind vom Typ \prm{psnum}. Wird eine einzelne Zahl
% angegeben, wird die $x$-Koordinate auf \opt{0} gesetzt.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beampos}}]
\begin{pspicture}(4,3.8)
  \pnodes(1.5,0.5){A}(3.5,0.5){B}(3.5,3.5){C} 
  \optbox[position=end](B)(A)
  \mirror[mirrortype=extended, mirrorradius=3](A)(B)(C)
  \optplate[position=end](B)(C)
  \drawbeam[linecolor=red, beampos=-0.2]{1-3}
  \drawbeam[linecolor=blue, beampos=0]{1-3}
  \drawbeam[linecolor=green, beampos=0.2]{1-3}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH The start position is relative to the respective interface node, as
% it is illustrated in the following example. The beam start position is fixed,
% but depending on e.g. the \Lkeyword{beamangle}, the actual intersection with
% the curved interface is at a different position.
% \fi
% \ifGERMAN
% Die Startposition ist relativ zum entsprechenden Grenzflächenknoten, wie im
% folgenden Beispiel gezeigt wird. Die Startposition ist fest, abhängig z.B. von
% \Lkeyword{beamangle} kann der eigentliche Schnittpunkt mit der ersten
% Grenzfläche jedoch anders sein.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-7,9-9}, morekeywords = {[21]{beampos}}, explpreset={escapeinside={}}]
\begin{pspicture*}(0,2)(3.05,6)
  \lens[lens=8 8 8, abspos=0.6](0.5,2)(3,2)
  \optplate[position=1, plateheight=6](0.5,2)(3,2)
  \psset{beampos=2.1}
  \drawbeam[beamangle=-60]{1}{2}
  \drawbeam[beamangle=-40]{1}{2}
  \drawbeam[beamangle=-20]{1}{2}
  \psline[style=Refline, linewidth=3\pslinewidth, arrows=->, arrowinset=0, arrowscale=1.3](\oenodeOut{1})([offset=2.1]\oenodeOut{1})
\end{pspicture*}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH
% Which interface the beam starts at is determined by the options
% \Lkeyword{beaminsidefirst} and \Lkeyword{startinside}.
% \fi
% \ifGERMAN
% An welcher Grenzfläche der ersten Komponente gestartet wird hängt von
% \Lkeyword{beaminsidefirst} und \Lkeyword{startinside} ab.
% \fi
%
% \psnumitem[0]{beamangle}
% \ifGERMAN
% Der Anfangswinkel des Strahls. Dieser ist in der Regel relativ zu der
% Verbindung von der ersten zur zweiten Komponente, mit \Lkeyword{beamalign}
% kann dieses Verhalten verändert werden.
% \fi
% \ifENGLISH
% This is the start angle of the beam. Usually, it is relative to the connection
% between the first two components, use \Lkeyword{beamalign} to change this.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beamangle}}]
\begin{pspicture}(4,4)
  \pnodes(1.5,0.5){A}(3.5,0.5){B}(3.5,3.5){C} 
  \optbox[position=end](B)(A)
  \mirror[mirrortype=extended](A)(B)(C)
  \optplate[position=end](B)(C)
  \drawbeam[linecolor=red, beamangle=3]{-3}
  \drawbeam[linecolor=blue, beamangle=0]{1-}
  \drawbeam[linecolor=green, beamangle=-3]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \choitem[relative]{beamalign}{rel, relative, abs, absolute, firstcomp}
% \ifGERMAN
% Gibt vor, ob der Winkel \Lkeyword{beamangle} relativ zu der Verbindung
% zwischen den ersten beiden Komponenten ist, ob es sich um einen
% absoluten Winkel handelt, oder ob der Winkel durch die Ausrichtung der
% ersten Komponente vorgegeben wird.
%
% Ein absoluter Winkel kann sehr hilfreich sein, falls eine der beiden ersten
% Komponenten gedreht oder verschoben wurde. Dabei werden die
% Grenzflächenknoten, auf die sich ein relativer Winkel bezieht, ebenfalls
% transformiert (siehe \prettyref{sec:rotshift}). In dem folgenden Beispiel
% verläuft daher der grüne Strahl mit der relativen Ausrichtung nicht
% horizontal.
% \fi
% \ifENGLISH
% Select whether the \Lkeyword{beamangle} is relative to the connection between
% the first two components, or if it is an absolute angle.
%
% A typical situation where an absolute angle is helpful is with rotated or
% shifted components. By rotating or shifting a component also its interface
% nodes are rotated (see \prettyref{sec:rotshift}) which are then used to
% determine the input angle for relative alignment. Accordingly, in the
% following example, the green beam with the relative alignment is not
% horizontal.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beamalign, angle}}]
\begin{pspicture}(3,1.5)
  \pnodes(0,0.75){A}(3,0.75){B}
  \optbox[angle=10, showifcnodes](A)(B)
  \drawbeam(A){}(B)
  \drawbeam[linecolor=red, beamalign=abs](A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN 
% Im folgenden Beispiel liegen beide Komponenten auf der horizontalen
% Linie $\overline{AB}$. Der grüne Strahl, mit
% \Lkeyword{beamalign}\opt{=rel} verläuft daher auch horizontal. Der
% rote Strahl ist hingegen mit \Lkeyword{beamalign}\opt{=firstcomp}
% entsprechend der Drehung der ersten Komponente ausgerichtet.
% \fi
% \ifENGLISH 
% Both components in the following example are align on the horizontal
% line $\overline{AB}$. The green beam with
% \Lkeyword{beamalign}\opt{=rel} is accordingly aligned
% horizontally. The red beam with \Lkeyword{beamalign}\opt{=firstcomp}
% is aligned according to the rotation of the first component:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beamalign, angle}}]
\begin{pspicture}(4,3)
  \pnodes(1.5,1.5){A}(4,1.5){B}
  \optbox[position=start, rotateref=r, angle=10](A)(B)
  \optplate[position=end, plateheight=3](A)(B)
  \addtopsstyle{Beam}{beamdiv=20}
  \drawwidebeam{-}
  \drawwidebeam[beamalign=firstcomp, linecolor=red]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[0]{beampathskip}
% \ifGERMAN
% Überspringt \prm{num} Segmente am Anfang des Strahlengangs. Diese
% Option beinflusst lediglich ab welchem Segment der Strahlgang
% gezeichnet wird, das Raytracing beginnt immer noch an der ersten
% Grenzfläche. Um das zu ändern können Sie \Lkeyword{startinsidecount}
% verwenden.
% \fi
% \ifENGLISH
% Skip \prm{num} segments at the beginning of the beam path. This option
% determines only at which segment the beam is drawn, the ray tracing
% always starts at the first interface. To change this, see option
% \Lkeyword{startinsidecount}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beampathskip}}, pos=t]
\begin{pspicture}(5,2)
\pnodes(0,1){A}(5,1){B}(2,0){C}
\begin{optexp}
  \glanthompson(A)(B)
  \optplane(B)\optplane[angle=90](C)
  \polarization[abspos=1, poltype=misc, linecolor=yellow!80!black](A)(B)
  \drawbeam[beaminsidelast, linecolor=yellow!80!black](A){1}
  \drawbeam[beampathskip=2](A){1-2}
  \drawbeam[beampathskip=2, savebeam, linestyle=dashed, dash=2pt 2pt, linecolor=red,arrowscale=1.5, arrows=->](A){1}{3}
\end{optexp}
\nodexn{(\oenodeBeam{})-1.5(!\oeBeamVec{})}{D}
\polarization[poltype=parallel, linecolor=red](D)(\oenodeBeam{})
\polarization[abspos=4, poltype=perp, linecolor=green, dotscale=1.5](A)(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[-1]{beampathcount}
% \ifGERMAN
% Anzahl der Strahlsegmente, die gezeichnet werden sollen. Werden am
% Anfang Segmente mit \Lkeyword{beampathskip} übersprungen, so werden
% diese nicht mitgezählt. 
% \fi
% \ifENGLISH
% Number of beam segments, which are drawn. Segments which are skipped
% at the beam start with \Lkeyword{beampathskip} do not count.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beampathcount}}]
\begin{pspicture}(3,2)
  \pnodes(0,2){A}(2,0.8){B}(4,2){C}
  \optprism[compname=P, prismtype=reflective, prismangle=90](A)(B)(C)
  \lens[abspos=1.33](\oenodeIfc{2}{P})(A)%
  \drawwidebeam[beamwidth=0.2, beaminsidelast, beampathcount=4](A){2}{1}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN\subsection{Interner Strahlengang}\fi
% \ifENGLISH\subsection{Internal beam path}\fi
%
% \ifENGLISH
% A beam path is composed of rays between components and rays inside the
% components. Depending on some options these internal beams can be drawn or
% not. Generally, the first, the last, and all other components are treated
% separately.
% \fi
% \ifGERMAN
% Ein Strahlengang setzt sich aus Strahlen zwischen den Komponenten und
% innerhalb der Komponenten zusammen. Ob diese internen Strahlen gezeichnet
% werden, kann mit mehreren Parametern festgelegt werden. Die erste, letzte und
% die übrigen Komponenten werden separat gehandhabt.
% \fi
%
% \begin{optionlist}
% \boolitem[true]{beaminside}
% \ifGERMAN
% Zeichnet den Strahlengang innerhalb aller Komponenten mit Ausnahme der
% ersten und letzten, die von dieser Option nicht beeinflusst.
% \fi
% \ifENGLISH
% Draw the internal beams in all intermediate components, the first and last
% components are not affected.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beaminside}}]
\begin{pspicture}(0.3,0.3)(3,4)
  \psset{optboxwidth=1}
  \optbox[position=end](1,1)(1,3)
  \optretplate(1,1)(1,3)
  \pentaprism(1,3)(1,1)(2,1)
  \optbox[position=end](1,1)(2,1)
  \drawbeam[beampos=-0.05, linecolor=red]{-}
  \drawbeam[beampos=0.05, beaminside=false]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[false]{beaminsidefirst}
% \ifGERMAN
% Zeichne den Strahlengang innerhalb der ersten Komponenten.
% \fi
% \ifENGLISH
% Draw the internal beams of the first component.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beaminsidefirst}}]
\begin{pspicture}(0.3,0.3)(3,4)
  \psset{optboxwidth=1}
  \optbox[position=end](1,1)(1,3)
  \optretplate(1,1)(1,3)
  \pentaprism(1,3)(1,1)(2,1)
  \optbox[position=end](1,1)(2,1)
  \drawbeam[beampos=-0.05, linecolor=red]{-}
  \drawbeam[beampos=0.05, beaminsidefirst]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[false]{beaminsidelast}
% \ifGERMAN
% Zeichne den Strahlengang innerhalb der letzten Komponenten.
% \fi
% \ifENGLISH
% Draw the internal beams of the last component.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beaminsidelast}}]
\begin{pspicture}(0.3,0.3)(3,4)
  \psset{optboxwidth=1}
  \optbox[position=end](1,1)(1,3)
  \optretplate(1,1)(1,3)
  \pentaprism(1,3)(1,1)(2,1)
  \optbox[position=end](1,1)(2,1)
  \drawbeam[beampos=-0.05, linecolor=red]{-}
  \drawbeam[beampos=0.05, beaminsidelast]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[true]{allowbeaminside}
% \ifGERMAN
% Damit kann bestimmt werden, ob der Strahlengang innerhalb einer Komponente
% gezeichnet werden darf. Dieser Parameter wirkt nur auf Komponenten und
% überschreibt, falls auf \opt{false} gesetzt, jegliche Strahleinstellungen mit
% \Lkeyword{beaminside}, \Lkeyword{beaminsidefirst} und
% \Lkeyword{beaminsidelast}. Damit kann der Strahlengang in einzelnen
% Komponenten unterdrückt werden, für die es keinen Sinn macht
% (z.B. \Lcomp{optfilter} und \Lcomp{optdiode}, was sonst nicht möglich ist. 
% \fi
% \ifENGLISH
% Define whether a beam is drawn inside a component. The option affects
% components only and overwrites all settings of \Lkeyword{beaminside},
% \Lkeyword{beaminsidefirst}, and \Lkeyword{beaminsidelast} if set to
% \opt{false}. With this you can forbid any internal beams for components where
% it does not make any sense (e.g. \Lcomp{optfilter} and \Lcomp{optdiode}).
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{allowbeaminside}}]
\begin{pspicture}(3,2)
  \psset{optboxwidth=0.5}
  \pnodes(0,1){A}(3,1){B}
  \optbox[position=0.2](A)(B)
  \optbox[position=0.4, allowbeaminside=false](A)(B)
  \optbox[position=0.6](A)(B)
  \optbox[position=0.8](A)(B)
  \drawbeam(A){-}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \boolitem[false]{forcebeaminside}
% \ifGERMAN
% Wenn auf \opt{true} gesetzt, wird der Strahlengang innerhalb der
% betroffenen Komponenten immer gezeichnet wird, unabhängig von allen
% anderen Strahleinstellungen mit \Lkeyword{allowbeaminside},
% \Lkeyword{beaminside}, \Lkeyword{beaminsidefirst} und
% \Lkeyword{beaminsidelast}. Damit kann der Strahl innerhalb einzelner
% Komponenten gezeichnet werden, auch wenn alle anderen Komponenten in
% dem Strahlengang keinen internen Strahl haben sollen.
% \fi
% \ifENGLISH
% Forces to draw a beam inside a component. The option affects
% components only and overwrites all settings of
% \Lkeyword{allowbeaminside}, \Lkeyword{beaminside},
% \Lkeyword{beaminsidefirst}, and \Lkeyword{beaminsidelast} if set to
% \opt{true}. With this you can force an internal beams for single
% components within a beam path.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{forcebeaminside}}]
\begin{pspicture}(3,2)
  \psset{optboxwidth=0.5}
  \pnodes(0,1){A}(3,1){B}
  \optbox[position=0.2](A)(B)
  \optbox[position=0.4, forcebeaminside](A)(B)
  \optbox[position=0.6](A)(B)
  \optbox[position=0.8](A)(B)
  \drawbeam[beaminside=false](A){-}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[-1]{startinsidecount}
% \ifGERMAN
% Anzahl der Segmente, die innerhalb der ersten Komponente verwendet
% werden. Diese Option hat nur eine Wirkung, wenn
% \Lkeyword{beaminsidefirst} oder \Lkeyword{startinside} auf \opt{true}
% gesetzt sind.
% \fi
% \ifENGLISH
% Number of segments, which are used inside the first component. This
% option is in effect only with \Lkeyword{beaminsidefirst} or
% \Lkeyword{startinside} set to \opt{true}.
% \fi
%
% \numitem[-1]{stopinsidecount}
% \ifGERMAN
% Anzahl der Segmente, die innerhalb der letzten Komponente verwendet
% werden. Diese Option hat nur eine Wirkung, wenn
% \Lkeyword{beaminsidelast} oder \Lkeyword{stopinside} auf \opt{true}
% gesetzt sind.
% \fi
% \ifENGLISH
% Number of segments, which are used inside the last component. This
% option is in effect only with \Lkeyword{beaminsidelast} or
% \Lkeyword{stopinside} set to \opt{true}.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{stopinsidecount, startinsidecount}}]
\begin{pspicture}(4,2)
  \pnodes(0,2){A}(2,0){B}(4,2){C}
  \optprism[compname=P, n=1, prismtype=reflective, prismangle=90](A)(B)(C)
  \lens[abspos=1.08](\oenodeIfc{2}{P})(A)
  \lens[abspos=1.08](\oenodeIfc{2}{P})(C)
  \newpsstyle{Beam}{linestyle=none, fillstyle=solid}
  \drawwidebeam[fillcolor=green, beamwidth=0.2, beaminsidelast, stopinsidecount=1](A){2}{1}
  \drawwidebeam[fillcolor=orange, beaminsidefirst, startinsidecount=1, loadbeam]{1}{3}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \choitem[auto]{beammode}{refl, trans, reflective, transmittive, auto}
% \ifGERMAN 
% Mit dieser Option kann das Strahlverhalten bei Komponenten wie
% z. B. dem \Lcomp{beamsplitter} auf reflektierend oder transmittierend
% festgelegt werden, unabhängig von den verwendeten Knoten und deren
% relative Position bezüglich der Komponente.
% \fi
% \ifENGLISH
% With this option one can force the beam path through e.g. a
% \Lcomp{beamsplitter} to \opt{reflective} or \opt{transmittive}
% independent of the choosen nodes and their position relative to the
% component.
% \fi
% \end{optionlist}
%
% \ifENGLISH\subsection{Connecting with nodes}\fi
% \ifGERMAN\subsection{Verbinden mit Knoten}\fi
%
% \ifENGLISH
% As mentioned earlier in this chapter, beams can connect components
% also with nodes. For raytracing you need a plane, which can be created
% automatically or manually in different ways.
% \fi
% \ifGERMAN
% Wie vorher schon einmal erwähnt können Komponenten auch mit Knoten
% verbunden werden. Für Raytracing wird in der Regel eine Ebene
% benötigt, die auf unterschiedliche Weise automatisch oder manuell
% erstellt werden kann.
% \fi
%
% \begin{optionlist}
% \choitem[connection]{beamnodealign}{vec, conn, vector, connection}
% \ifENGLISH
% This parameter controls the alignment of the automatically created
% node interfaces. By default (\opt{connection}) the interface is
% aligned perpendicular to the direct connection between node and the
% previous interface node.
% \fi
% \ifGERMAN 
% Dieser Parameter bestimmt die Ausrichtung der automatisch erstellen
% Grenzflächen. In der Voreinstellung (\opt{connection}) wird die Ebene
% vertikal zur direkten Verbindung zwischen dem Knoten und dem
% vorangegangenen Grenzflächenknoten ausgerichtet.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(2.5,1){B}
  \lens[lens=3 3 2, n=2.5, abspos=0.5](A)(B)
  \multido{\r=-0.3+0.3}{3}{%
    \drawbeam[beampos=\r](A){}(B)}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(3,1){B}
  \lens[abspos=0.5](A)(B)
  \addtopsstyle{Beam}{linecolor=black, fillstyle=solid, beamwidth=0.2, fillcolor=red, opacity=0.5, beaminside=false}
  \multido{\r=-0.3+0.3}{3}{\drawwidebeam[beampos=\r](A){}(B)}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN 
% Ist der Wert auf \opt{vector} gesetzt, dann wird die Ebene vertikal
% zum einfallenden Strahlvektor ausgerichtet. Bei weiten Strahlen wird
% der gemittelte Strahlenvektor (siehe \Lcs{oeBeamVecMedian}) als
% Referenz verwendet. Beispiele in dem das sehr praktisch ist, sind
% \prettyref{ex:beamcenter} und \prettyref{ex:wgm-pdc}.
% \fi
% \ifENGLISH
% For a value \opt{vector}, the plane is aligned vertical to the
% incoming beam vector. For wide beams the mean beam vector is used (see
% \Lcs{oeBeamVecMedian}). Examples where this is very convenient are
% \prettyref{ex:beamcenter} and \prettyref{ex:wgm-pdc}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]beamnodealign}]
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(3,1){B}
  \lens[abspos=0.5](A)(B)
  \addtopsstyle{Beam}{linecolor=black, fillstyle=solid, beamwidth=0.2, beamnodealign=vector, fillcolor=green, opacity=0.5, beaminside=false}
  \multido{\r=-0.3+0.3}{3}{\drawwidebeam[beampos=\r](A){}(B)}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifENGLISH
% The automatic alignment is very handy in many cases, but does not
% allow to rotate the node planes to a fixed angle and can give again
% problems with shifted and rotated components (see
% \prettyref{sec:rotshift}). In the following example the green beam is
% with \Lkeyword{beamnodealign} set to \opt{vector}, for the red beam it
% is set to \opt{connection}:
% \fi
% \ifGERMAN
% Die automatische Ausrichtung ist in vielen Fällen sehr praktisch, kann
% aber wiederum unerwünschte Ergebnisse bei gedrehten und verschobenen
% Komponenten ergeben und die Ebenenausrichtung kann nicht beliebig
% gesetzt werden. Im folgenden Beispiel ist beim grünen Strahl
% \Lkeyword{beamnodealign} auf \opt{vector} gesetzt, bei dem roten
% Strahl hingegen auf \opt{connection}:
% \fi
%
% \hspace*{\fill}%
% \begin{pspicture}(4,2.7)
%   \pnodes(0,0.5){A}(4,0.5){B}
%   \lens[compshift=0.5, abspos=1, lens=1.5 1.5 2](A)(B)
%   \drawwidebeam[beamalign=absolute, linecolor=black, fillstyle=solid, beamwidth=0.6, fillcolor=green, opacity=0.5, beamnodealign=vector](A){}(B)
%   \rput[rb](4,0){\ttfamily vector}
% \end{pspicture}
% \hspace*{1cm}%
% \begin{pspicture}(5,3)
%   \pnodes(0,0.5){A}(4,0.5){B}
%   \lens[compshift=0.5, abspos=1, lens=1.5 1.5 2](A)(B)
%   \drawwidebeam[beamalign=absolute, linecolor=black, fillstyle=solid, beamwidth=0.6, fillcolor=red, opacity=0.5](A){}(B)
%   \rput[rb](5,0){\ttfamily connection}
% \end{pspicture}
% \hspace*{\fill}%
%
% \ifENGLISH
% For more flexibility, the package provides an «invisible» plane which
% can be used for this purpose.
% \fi
% \ifGERMAN
% Das kann mit einer «unsichtbaren» Ebene erreicht werden, die mit
% \Lcomp{optplane} definiert wird.
% \fi
%
% \begin{ltxsyntax}
%   \xLcomp{optplane}\compitem{optplane}(center) 
%
%   \ifENGLISH
%   The plane is defined by a single node only, the rotation around this node
%   is defined with \Lkeyword{angle}. The angle is with respect to the default
%   alignment, which is vertical.
%   \fi
%   \ifGERMAN Die Ebene wird durch lediglich einen Knoten definiert, die Drehung
%   darum kann mit \Lkeyword{angle} angegeben werden. Der Winkel ist relativ zur
%   ursprünglichen, vertikalen Ausrichtung.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(2.5,1){B}
  \lens[lens=3 3 2, n=2.5, abspos=0.5](A)(B)
  \optplane[angle=-30](B)
  \multido{\r=-0.3+0.3}{3}{%
    \drawbeam[beampos=\r](A){-}}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifENGLISH\subsection{Automatic connections}\fi
% \ifGERMAN\subsection{Automatische Verbindungen}\fi
%
% \ifENGLISH
% Beam can also be drawn at definition time of a component, which can be handy,
% but allows only very elemental beams.
% \fi
% \ifGERMAN Lichtstrahlen können auch zusammen mit der Komponentendefinition
% gezeichnet werden. Das kann für einfache Strahlengänge sehr praktisch sein,
% ist aber sehr unflexibel.
% \fi
%
% \begin{optionlist}
% \boolitem[false]{beam}
% \ifGERMAN Kann als Option für jede Komponente verwendet werden, ist äquivalent
% zu
% \fi
% \ifENGLISH Can be used as option for every component, is equivalent to the
% statement
% \fi
% \begin{lstlisting}[gobble=2]
% \drawbeam[raytrace=false](\oenodeRefA{}){}(\oenodeRefB{})
% \end{lstlisting}
% \ifENGLISH which draws a beam from one reference node via the component to the
% other reference node.
% \fi 
% \ifGERMAN womit ein Strahl vom ersten Referenzknoten über die Komponente zum
% zweiten Referenzknoten gezeichnet wird.
% \fi
% \end{optionlist}
%
% \ifENGLISH\subsection{Beam appearance}\fi
% \ifGERMAN\subsection{Strahlaussehen}\fi
% \label{sec:beamappearance-single}
%
% \begin{stylelist}
%   \styleitem[linecolor=green!90!black, linejoin=1]{Beam}
%   \ifENGLISH
%   The appearance of beams is controlled with this style. The optional argument
%   of \nxLcs{draw*beam} can also be used, these options can overwrite settings from
%   the \Lstyle{Beam} style.
%   \fi
%   \ifGERMAN
%   Das Aussehen der Lichtstrahlen kann mit diesem Stil gesteuert werden. Das
%   optionale Argument von \nxLcs{draw*beam} kann ebenfalls dafür verwendet
%   werden und kann die Einstellungen des \Lstyle{Beam}-Stils überschreiben.
%   \fi
% \end{stylelist}
%
% \begin{optionlist}
%   \valitem{addtoBeam}{list}
%     \addtostylemsg{Beam}
%   \valitem{newBeam}{list}
%     \newstylemsg{Beam}
%
%   \psnumitem[0.2]{ArrowInsideMinLength}
%   \ifGERMAN 
%   \nxLcs{draw*beam} verwendet auch die Option \Lkeyword*{ArrowInside} aus
%   \LPack{pstricks-add}. In dem Fall wird für alle Strahlsegmente ein Pfeil
%   gezeichnet, was häufig für die internen, kurzen Strahlengänge unerwünscht
%   ist. Mit \Lkeyword{ArrowInsideMinLength} kann angegeben werden ab welcher
%   Mindestlänge eines Strahlsegmentes die Pfeil gezeichnet werden. In dem
%   folgenden Beispiel ist der Wert so gewählt, dass nur der untere interne
%   Strahl einen Pfeil hat (siehe auch \prettyref{ex:czerny-turner}).
%   \fi
%   \ifENGLISH 
%   \nxLcs{draw*beam} uses also the option \Lkeyword*{ArrowInside} from
%   \LPack{pstricks-add}. In this case the arrows would be drawn for every beam
%   segment, which is often undesired for the internal, short beam
%   paths. \Lkeyword{ArrowInsideMinLength} sets a minimum segment length, below
%   which no internal arrows are drawn. In the following example the value is
%   selected such that only the lower internal beam has an arrow (see also
%   \prettyref{ex:czerny-turner}).
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{ArrowInsideMinLength}}]
\begin{pspicture}(3,2)
  \optprism(0,1)(2,1)(3,0.5)
  \drawwidebeam[beamwidth=0.4, ArrowInside=->, ArrowInsideMinLength=0.5, arrowscale=1.5, raytrace=false](0,1){}(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \psnumitem[-1]{ArrowInsideMaxLength}
% \ifGERMAN Gibt analog zu \Lkeyword{ArrowInsideMinLength} die maximale Länge
% eines Segments an, für das Pfeile gezeichnet werden. Ist der Wert negativ,
% dann gibt es keine obere Grenze.
% \fi
% \ifENGLISH Like \Lkeyword{ArrowInsideMaxLength}, but sets the maximum length
% of a segment for which the arrows are drawn. If the value is negative, no
% upper limit is defined.
% \fi
% \end{optionlist}
% 
% \ifGERMAN \Lkeyword*{ArrowInside} kann auch verwendet werden ohne dass
% ein Linientyp definiert ist.
% \fi
% \ifENGLISH \Lkeyword*{ArrowInside} can be used also without a
% linestyle.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(0,0)(3.5,2)
  \pnodes(0,1.5){A}(2,1.5){B}(2.8,0){C}
  \mirror[mirrorwidth=1.2, mirrortype=extended](A)(B)(C)
  \newpsstyle{Beam}{linecolor=green, linestyle=none, fillstyle=solid, fillcolor=green, opacity=0.2}
  \drawwidebeam[beamwidth=0.5](A){}(C)
  \drawbeam[ArrowInside=->, arrowscale=2.5, ArrowFill=false, linewidth=1.5\pslinewidth, ArrowInsidePos=0.9, ArrowInsideMaxLength=1.8](A){}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \begin{stylelist}
% \typeitem{fade}{\prm{linestyle}}
% \ifENGLISH 
% Fade from the current \opt{linecolor} to another color, defined by
% \Lkeyword{fadeto}. The line style currently works only for line, not
% for curves. The complete path is divided in \Lkeyword{fadepoints}$ -
% 1$ segments.
% \fi
% \ifGERMAN
% Erzeugt einen Farbverlauf von der aktuellen \opt{linecolor} zu einer
% anderen Farbe, definiert durch \Lkeyword{fadeto}. Der Linienstil
% funktioniert momentan nur vernünftig mit Linien, nicht jedoch mit
% Kurven. Der gesamte Pfad wird in \Lkeyword{fadepoints}$- 1$ Segmente
% unterteilt.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1)
  \psline[linewidth=0.2, linecolor=red, linestyle=fade, fadepoints=50](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
% \begin{optionlist}
% \choitem[white]{fadeto}{white, black, transparency}
% \ifENGLISH 
% The color at the fade end, depends on \Lkeyword{fadefuncname} and
% \Lkeyword{fadefunc}.
% \fi
% \ifGERMAN
% Die Endfarbe des Farbverlaufs, hängt auch von \Lkeyword{fadefuncname}
% und \Lkeyword{fadefunc} ab.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1)
  \psset{linewidth=0.2, linecolor=red, linestyle=fade, fadepoints=50}
  \psline[fadeto=white](0,0.9)(3,0.9)
  \psline[fadeto=black](0,0.5)(3,0.5)
  \psline[fadeto=transparency](0,0.1)(3,0.1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \numitem[200]{fadepoints}
% \ifENGLISH
% Number of points used for lines with style \opt{fade}.
% \fi
% \ifGERMAN
% Anzahl der Punkte, die für den Linienstil \opt{fade} verwendet werden.
% \fi
%
% \choitem[linear]{fadefuncname}{gauss, linear, squared, exp, custom}
% \ifENGLISH 
% Some predefined fade functions, which determine the color gradient. If
% set to \opt{custom}, the Postscript code in \Lkeyword{fadefunc} is
% used.
% \fi
% \ifGERMAN
% Ein paar vordefinierte Funktionen, die den Farbverlauf bestimmen. Wird
% \opt{custom} angegeben, dann wird der Postscript-Code aus
% \Lkeyword{fadefunc} verwendet.
% \fi
%
% \valitem{fadefunc}{PS code}
% \ifENGLISH 
% Define a custom gradient for line style \Lkeyword{fade}. The \prm{PS
% code} must evaluate a number on the stack in the range $[0,1]$ (0:
% path start, 1: path end) to $[0,1]$ (0: \Lkeyword{fadeto} color, 1:
% current line color). The function values are clipped to $[0,1]$.
% \fi
% \ifGERMAN
% Eine benutzerdefinierte Funktion für den Farbverlauf des Linienstils
% \Lkeyword{fade}. Der \prm{PS code} muss eine Zahl auf dem Stack im
% Intervall $[0,1]$ (0: Pfadanfang, 1: Pfadende) auf das Intervall $[0,
% 1]$ abbilden (0: \Lkeyword{fadeto}-Farbe, 1: aktuelle
% Linienfarbe). Die Funktionswerte werden auf das Intervall $[0, 1]$
% abgeschnitten.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1)
  \psset{linewidth=0.2, linecolor=red, linestyle=fade, fadepoints=50}
  \psline[fadefuncname=gauss](0,1)(3,1)
  \psline[fadefuncname=exp](0,0.7)(3,0.7)
  \psline[fadefuncname=custom, fadefunc={360 mul cos 1 add 0.5 mul}](0,0.4)(3,0.4)
  \psline[fadefuncname=custom, fadefunc={neg 1 add 2 mul}](0,0.1)(3,0.1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH For a nice example see \prettyref{ex:dsotm}.\fi
% \ifGERMAN Ein schönes Beispiel ist \prettyref{ex:dsotm}.\fi
% \end{optionlist}
% 
% \ifGERMAN\section{Aufgeweitete Strahlen}\fi
% \ifENGLISH\section{Drawing wide beams}\fi
% \label{sec:drawwidebeam}
%
% \ifENGLISH
% All information about single beams (see \prettyref{sec:drawbeam}) apply to
% wide beams as well. Here, you find all additional information which apply to
% wide beams only.
% \fi
% \ifGERMAN
% Alle Informationen über einfache Strahlen (siehe \prettyref{sec:drawbeam})
% betreffen auch aufgeweitete Strahlen. Hier werden nur zusätzliche
% Einstellmöglichkeiten aufgeweiteter Strahlen behandelt.
% \fi
%
% \begin{ltxsyntax}
%   \xLcs{drawwidebeam}\cmditem{drawwidebeam}[options]{obj$_1$}{obj$_2$}\ldots
% \end{ltxsyntax}
%
% \begin{optionlist}
% \psnumitem[0]{beamwidth}
% \ifENGLISH The initial beam width, measured at the initial position (defined
% with \Lkeyword{beampos}) perpendicular to the beam direction.
% \fi
% \ifGERMAN Die Anfangsstrahlbreite an der mit \Lkeyword{beampos} angegebenen
% Position, gemessen vertikal zur Verbindungslinie zur nächsten Komponente.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beamwidth}}]
\begin{pspicture}(4,4)
  \pnodes(1.5,0.5){A}(3.5,0.5){B}(3.5,3.5){C} 
  \optbox[position=end](B)(A)
  \mirror[mirrortype=extended](A)(B)(C)
  \optplate[position=end](B)(C)
  \drawwidebeam[beamwidth=0.3]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \psnumitem[0]{beamdiv}
% \ifENGLISH The total beam divergence at the starting position, given in
% degree. Positive values give an expanding beam, negative values a contracting
% beam.
% \fi
% \ifGERMAN Die Strahldivergenz an der Startposition, angegeben in
% Grad. Positive Werte ergebenen einen expandierenden Strahl, negative einen
% kontrahierenden.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{beamdiv}}, linerange={1-8,11-11}]
\begin{pspicture}(3,2)
  \pnodes(0,1){A}(3,1){B}
  \psset{plateheight=2}
  \optplate[position=start](A)(B)
  \optplate[position=end](A)(B)
  \addtopsstyle{Beam}{beamwidth=0.2}
  \drawwidebeam[beampos=0.4, beamdiv=5]{-}
  \drawwidebeam[beampos=-0.4, beamdiv=-5, linecolor=red]{-}
  \rput[b](1.5,0){\footnotesize\ttfamily beamdiv < 0}
  \rput[t](1.5,2){\footnotesize\ttfamily beamdiv > 0}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifENGLISH\subsection{Beam appearance}\fi
% \ifGERMAN\subsection{Strahlaussehen}\fi
%
% \ifENGLISH
% The appearance of wide beams can be controlled like that of single beams with
% the optional argument or the \Lstyle{Beam} style (see
% \prettyref{sec:beamappearance-single}).
%
% Wide beams have two marginal rays, which are drawn according to the line
% settings, and may be filled.
% \fi
% \ifGERMAN Das Aussehen aufgeweiteter Strahlen kann genauso wie bei einfachen
% Strahlen über \Lstyle{Beam} oder das optionale Argument vorgegeben werden
% (siehe \prettyref{sec:beamappearance-single}).
%
% Breite Strahlen bestehen aus zwei Randstrahlen, die gemäß der
% Linieneinstellungen gezeichnet werden, und können zusätzlich gefüllt werden.
% \fi
%
% \begin{enumerate}
% \item 
%   \ifENGLISH Only marginal rays.\fi
%   \ifGERMAN Nur die Randstrahlen.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2)
  \pnodes(0,0.5){A}(1,0.5){B}(2.8,2){C}
  \mirror[mirrorwidth=1.5](A)(B)(C)
  \drawwidebeam[beamwidth=0.4](A){}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH Marginal rays, and with fill style.\fi
%   \ifGERMAN Randstrahlen, und Füllstil.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fillstyle, linestyle}]
\begin{pspicture}(3,2)
  \pnodes(0,0.5){A}(1,0.5){B}(2.8,2){C}
  \mirror[mirrorwidth=1.5](A)(B)(C)
  \addtopsstyle{Beam}{fillstyle=solid, fillcolor=red!50!white, linecolor=red}
  \drawwidebeam[beamwidth=0.4](A){}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item
%   \ifENGLISH Only with fill style.\fi
%   \ifGERMAN Nur Füllstil.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fillstyle, linestyle}]
\begin{pspicture}(3,2)
  \pnodes(0,0.5){A}(1,0.5){B}(2.8,2){C}
  \mirror[mirrorwidth=1.5](A)(B)(C)
  \addtopsstyle{Beam}{fillstyle=solid, fillcolor=red, opacity=0.3, linestyle=none}
  \drawwidebeam[beamwidth=0.4](A){}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{enumerate}
%
% \ifGERMAN\section{Fehlerbehandlung}\fi
% \ifENGLISH\section{Error handling}\fi
% \label{sec:error-handling}
%
% \ifGERMAN
% Alle Strahlen werden direkt mit Postscript berechnet und gezeichnet,
% so dass eine umfassende Fehlerbehandlung zur Zeit der Kompilation
% nicht möglich ist. Um jedoch trotzdem fehlerfreie Bilder zu bekommen,
% wird der Strahlengang abgebrochen, sobald eine Situation eintritt, die
% nicht unterstützt wird. Das kann eintreten, falls der Strahl eine
% Grenzfläche nicht trifft, Totalreflektion auftritt oder wenn die
% folgende Komponente keine Freistrahlverbindungen unterstützt. Die
% folgenden Beispiele zeigen Situationen, in denen diese Fehler
% auftreten:
% \fi
% \ifENGLISH 
% All beam are calculated and drawn directly in Postscript, so that a
% comprehensive error handling at compilation time is not possible. If a
% situation arises which is not supported by the drawing algorithm, the beam
% path is truncated at this point. This happens in the following cases:
% \fi
% \begin{enumerate}
% \item 
%   \ifENGLISH A beam misses an interface. The red beam in the following example
%   misses the last plane and is truncated at the last valid interface.
%   \fi
%   \ifGERMAN Ein Strahl trifft eine Grenzfläche nicht. Der rote Strahl in dem
%   folgenden Beispiel verpasst die letzte Grenzfläche und endet daher an der
%   vorhergehenden.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2.7)
  \pnodes(0,1){A}(3,1){B}
  \optplate[position=start](A)(B)
  \lens[lens=4 4 2, abspos=0.5, n=2.5](A)(B)
  \optplate[position=end, plateheight=0.5](A)(B)
  \drawbeam{-}
  \drawbeam[beampos=0.2]{-}
  \drawbeam[beampos=0.4, linecolor=red]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item
%   \ifENGLISH Total internal reflection occurs at an interface which is
%   not set up for this. The red beam in the following example would be
%   reflected, but this is not supported and the beam is truncated at the
%   interface where the total internal reflection occurs.
%   \fi
%   \ifGERMAN Totale interne Reflektion tritt an einer Grenzfläche auf, die
%   nicht dafür vorgesehen ist. Der rote Strahl im folgenden Beispiel würde
%   reflektiert werden, aber das wird für diese Komponente nicht unterstützt und
%   der Strahl endet an der total reflektierenden Grenzfläche.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2.5)
  \pnodes(0,2){A}(3,0){B}
  \optplane(A)
  \optprism[n=1.8](A)([Xnodesep=1.5]A)(B)
  \optplane(B)
  \drawbeam[beamangle=5]{-}
  \drawbeam[beamangle=-5, linecolor=red]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Dasselbe gilt ebenfalls für aufgeweitete Strahlen (siehe
% \prettyref{sec:drawwidebeam}). Bei diesen wird der Strahlengang abgebrochen,
% falls einer der beiden Randstrahlen einen Fehler aufweist.
% \fi
% \ifENGLISH These conditions apply to wide beams (see \prettyref{sec:drawwidebeam}) as
% well, the beam path is interrupted as soon as one of the marginal rays has an
% error.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2.5)
  \pnodes(0,2){A}(3,0){B}
  \optplane(A)
  \optprism[n=1.8](A)([Xnodesep=1.5]A)(B)
  \optplane(B)
  \drawwidebeam[beamdiv=10, linecolor=red]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifGERMAN Eine Komponente soll verbunden werden, die jedoch keine
%   Freistrahlverbindungen unterstützt. In diesem Fall wird die falsche
%   Komponente und alle Folgenden ignoriert.
%   \fi
%   \ifENGLISH A component is to be connected, which does not support
%   free-ray connections. In this case, the wrong component and all
%   following ones are ignored.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,2.7)
  \pnodes(0,1){A}(2,1){B}
  \optplate[position=start](A)(B)
  \lens[lens=4 4 2, abspos=0.5, n=2.5](A)(B)
  \fiberdelayline[fdlsize=1 0.7, position=end, fiber=none](A)(B)
  \drawbeam[beampos=0.2, linecolor=red]{-}
  \drawbeam[beampos=-0.2, linecolor=blue, beaminsidelast]{-}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{enumerate}
%
% \begin{optionlist}
%   \boolitem[false]{pswarning} 
%   \ifENGLISH To simplify debugging, you can have a message printed out
%   if any of these situations arises. The message will be printed to
%   standard output, when a Postscript interpreter reads the file,
%   e.g. when you view the file, or you convert it with \opt{ps2pdf} or
%   similar.
%   \fi
%   \ifGERMAN Um eine Fehlersuche zu vereinfachen kann ein Hinweis
%   ausgegeben werden sobald ein Strahlengang vorzeitig beendet. Die
%   Fehlermeldung wird auf die Standardausgabe geschrieben, wenn die
%   Datei mit einem Postscript-Interpreter gelesen wird, also mit einem
%   Betrachter geöffnet oder z.B. mit \opt{ps2pdf} konvertiert wird.
%   \fi
% \end{optionlist}
% 
% \ifGERMAN\section{Angepasste Strahlen}\fi
% \ifENGLISH\section{Custom beams}\fi
% \label{sec:custombeam}
%
% \ifGERMAN 
% Im Prinzip können alle Strahlengänge mit passender Wahl des Brechungsindex und
% der Komponentenparameter (z.B. der Linsenkrümmung) realisiert werden, was
% jedoch sehr aufwendig werden kann.  Um das zu vereinfachen, besteht die
% Möglichkeit die Endpunkte eines Strahls als Anfangspunkte für folgende
% Strahlen zu nutzen, so dass man abschnittsweise die Divergenz und die
% Ausbreitungsrichtung definieren kann.
% \fi
% \ifENGLISH
% In principal, all kind of beam paths can be realized with an
% appropriate choice of refractive index and component parameters
% (e.g. lens curvature). This can become very cumbersome, so that the
% package provides the means to simplify this. The end points of one
% beam path can be used as starting points for the next beam, which
% allows piecewise definition of the beam divergence, angle, and
% direction.
% \fi
%
% \begin{optionlist}
%   \choitem[true]{savebeampoints}{true,false,\prm{int}}
%   \ifGERMAN Speichert die Endpunkte eines \nxLcs{draw*beam} Makros,
%   vorangegangene Punkte werden überschrieben. \Lcs{drawbeam} und
%   \Lcs{drawwidebeam} werden getrennt behandelt. Wird hier eine Zahl
%   \prm{int} $> 0$ angegeben, so können beliebig viele Endpunkte
%   separat gespeichert werden, siehe z.B. \prettyref{ex:ratchet}. In
%   der Regel reicht an- und abschalten vollkommen aus, was den Zahlen 1
%   und 0 entspricht.
%   \fi
%   \ifENGLISH Saves the end points of a \nxLcs{draw*beam} macro,
%   previous points are overwritten. \Lcs{drawbeam} and
%   \Lcs{drawwidebeam} are treated separately. If a number \prm{int} $>
%   0$ is given, you can save as many end points as you like, see
%   e.g. \prettyref{ex:ratchet}. But in most cases enabling (1) and
%   disabling (0) this option is sufficient.
%   \fi
%
%   \choitem[false]{loadbeampoints}{true,false,\prm{int}}
%   \ifGERMAN Verwende die Endpunkte eines vorangegangenen Strahls als
%   Startpunkte. Wird keine Zahl \prm{int} angegeben, dann wird \opt{1}
%   verwendet.
%   \fi
%   \ifENGLISH Use the end points of a previous beam as starting points for the
%   next beam. If no number \prm{int} is specified, \opt{1} is used.
%   \fi
% \end{optionlist}
%
% \ifGERMAN Als Beispiel nehmen wir ein Teleskop, die Strahldivergenz am Eingang
% und am Ausgang ist Null. Anstatt die Linsenparameter und den Brechungsindex
% genau einzustellen, so dass die Ausgangsdivergenz Null ist, zeichnen wir
% einfach die drei Strahlenteile mit den gewünschten Divergenzen, und verwenden
% die Endpunkte des jeweils vorangegangenen Strahls als neue Ausgangspunkte. 
% \fi
% \ifENGLISH As example we consider a telescope which has no divergence at the
% input and output. Usually we would need to tweak the refractive index and the
% lens parameters to get an output beam without divergence. Instead, we draw the
% three beam parts separately using the end points of the previous beams as new
% starting points and specifying the divergence for each beam part
% explicitely.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{savebeampoints, loadbeampoints}}]
\begin{pspicture}(4,2) 
  \pnodes(0,1){A}(4,1){B}
  \begin{optexp}
    \lens[lens=0.5 0.5 0.5, abspos=0.5](A)(B)
    \lens[lens=4 4 2, abspos=2](A)(B)
    \addtopsstyle{Beam}{%
      fillstyle=solid, fillcolor=green, opacity=0.3}
    \psset{loadbeampoints}
    \drawwidebeam[beamwidth=0.2, stopinside](A){1}
    \drawwidebeam[beamdiv=-60]{1}{2}
    \drawwidebeam{2}(B)
  \end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Als weiteres Beispiel betrachten wir die Beugung an einem Gittern in
% die nullte und erste Beugungsordnung. Zuerst wird der Strahl von dem Eingang
% bis zum Gitter gezeichnet, die Endpunkte dieses Strahls werden nun für die
% Strahlen in beide Beugungsordnungen verwendet.
% \fi
% \ifENGLISH The next example shows diffraction from a grating in the zeroth and
% first diffraction order. First we draw the beam to the grating, its end points
% are used for the beams into both diffraction orders.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{savebeampoints, loadbeampoints}},
  linerange={1-12,16-16}, caption={caption}, label={ex:loadbeampoints}]
\begin{pspicture}(3.5,3.5)
  \pnodes(0,0.5){A}(2,0.5){B}(2,3){C}
  \nodexn{(C)-(1,0)}{C'}
  \nodexn{(C)(1,0)}{C''}
  \optgrating(A)(B)(C)
  \addtopsstyle{Beam}{%
    fillstyle=solid, fillcolor=green, opacity=0.3}
  \drawwidebeam[beamwidth=0.3](A){1}
  \psset{savebeampoints=false, loadbeampoints}
  \drawwidebeam{1}(C)
  \drawwidebeam{1}(C')
  \drawwidebeam{1}(C'')
  \rput[b]([offset=0.2]C){0th}
  \rput[b]([offset=0.2]C'){1st}
  \rput[b]([offset=0.2]C''){-1st}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \begin{optionlist}
%   \choitem[true]{savebeam}{true,false,\prm{int}}
%   \ifGERMAN Speichert die Endzustände, d.h. Endpunkte und Ausgangsvektoren,
%   eines \nxLcs{draw*beam} Makros, vorangegangene Werte werden
%   überschrieben. \Lcs{drawbeam} und \Lcs{drawwidebeam} werden getrennt
%   behandelt. Wird hier eine Zahl \prm{int} $> 0$ angegeben, so können beliebig
%   viele Strahlen separat gespeichert werden. In der Regel reicht an- und
%   abschalten vollkommen aus.
%   \fi
%   \ifENGLISH Saves the end conditions, i.e. end points and output vectors, of
%   each \nxLcs{draw*beam} macro, previous values are
%   overwritten. \Lcs{drawbeam} and \Lcs{drawwidebeam} are treated
%   separately. If a number \prm{int} $> 0$ is given, you can save as many end
%   points as you like, but in most use cases enabling and disabling this option
%   is sufficient.
%   \fi
%
%   \choitem[false]{loadbeam}{true,false,\prm{int}}
%   \ifGERMAN Verwende den Endzustand (Punkte und Richtung) eines
%   vorangegangenen Strahls als Anfangszustand. Der Parameter
%   \Lkeyword{beamangle} kann verwendet werden um die Richtung relativ zu der
%   geladenen zu verändern (siehe folgendes Beispiel).
%   \fi
%   \ifENGLISH Use the end condition (points and vectors) of a previous beam as
%   starting conditions for the next beam. The parameter \Lkeyword{beamangle}
%   can be used to change the direction relative to the loaded one (see
%   following example).
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{savebeam, loadbeam}},
  linerange={1-10,14-14}, caption={caption}, label={ex:loadbeam}]
\begin{pspicture}(3.5,3.5)
  \pnodes(0,0.5){A}(2,0.5){B}(2,3){C}
  \optgrating(A)(B)(C)
  \addtopsstyle{Beam}{%
    fillstyle=solid, fillcolor=green, opacity=0.3}
  \drawwidebeam[savebeam, beamwidth=0.3](A){1}
  \psset{savebeam=false, loadbeam}
  \drawwidebeam[beamangle=-20]{1}(C)
  \drawwidebeam{1}(C)
  \drawwidebeam[beamangle=20]{1}(C)
  \rput[b]([offset=0.2]C){0th}
  \rput[b]([Xnodesep=-0.9, offset=0.2]C){1st}
  \rput[b]([Xnodesep=0.9,offset=0.2]C){-1st}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Beachten Sie, dass \Lkeyword{loadbeam} und
% \Lkeyword{savebeam} nicht immer funktionieren, wenn der Strahlengang an
% einem halbdurchlässigen Spiegel oder einem Strahlteiler endet. In
% diesen Fällen wird nur der transmittierte Strahlvektor gespeichert,
% soll der Strahlengang über den reflektierenden Weg fortgesetzt werden,
% so ist das nicht möglich. 
%
% In den beiden folgenden Beispielen wird demnach der rote Strahl, der
% von der Komponente zum Knoten \prm{B} fortgesetzt werden soll, nicht
% gezeichnet. 
% \fi
% \ifENGLISH Please note, that \Lkeyword{loadbeam} and
% \Lkeyword{savebeam} do not always work, if the beam path ends inside a
% semitransparent mirror or a beamsplitter. In these cases only the
% transmitted ray vector is saved and continuing the beam via the
% reflective path is not possible.
%
% Accordingly, in the following examples the red beam is not drawn,
% which should continue the green beam from the component to node
% \prm{B}.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-6,9-9}, morekeywords={[21]{savebeam, loadbeam}}]
\begin{pspicture}(3,1.5)
  \pnodes(0,0.5){A}(1.5,1.5){B}(3,0.5){C}
  \beamsplitter(A)(1.5,0.5)(B)
  \drawbeam[beaminsidelast, savebeam](A){}
  \drawbeam[linecolor=red, beaminsidefirst, loadbeam]{}(B)
  \drawbeam[linecolor=blue, beaminsidefirst, loadbeam]{}(C)
  \psdot(B)\uput[-30](B){B}
  \psdot(C)\uput[-120](C){C}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[linerange={1-6,9-9}, morekeywords={[21]{savebeam, loadbeam}}]
\begin{pspicture}(3,1.5)
  \pnodes(0,0.5){A}(1.5,1.5){B}(3,0.5){C}
  \mirror[mirrortype=semitrans](A)(1.5,0.5)(B)
  \drawbeam[beaminsidelast, savebeam](A){}
  \drawbeam[linecolor=red, beaminsidefirst, loadbeam]{}(B)
  \drawbeam[linecolor=blue, beaminsidefirst, loadbeam]{}(C)
  \psdot(B)\uput[-30](B){B}
  \psdot(C)\uput[-120](C){C}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% 
%
% \begin{optionlist}
%   \boolitem[false]{startinside}
%   \ifENGLISH
%   The parameter \Lkeyword{beaminsidefirst} controls if the internal beams are
%   drawn inside the first component. However, for custom beams it can also be
%   necessary to trace the internal beam of the first component without drawing
%   it, e.g. if the previous beam ended at the first interface.
%
%   In the following example the red beam is the wrong continuation of the
%   incoming green beam because it assumes that the loaded beam conditions refer
%   to the output interface. But the previous beam stopped at the input
%   interface, so one needs to set \Lkeyword{startinside} in order to continue
%   the beam properly (see blue beam). The dashed line helps to understand the
%   correct beam path through the lens.
%   \fi
%   \ifGERMAN Mit dem Parameter \Lkeyword{beaminsidefirst} kann eingestellt
%   werden, ob der interne Strahlengang in der erste Komponente gezeichnet
%   wird. Für angepasste Strahlengänge kann es aber notwendig sein dem internen
%   Strahlengang in der ersten Komponente zu folgen ohne diesen zu zeichnen,
%   z.B. wenn der vorangegangene Strahl an der ersten Grenzfläche schon endet.
%   
%   Im folgenden Beispiel wird der einfallende grüne Strahl falsch durch den
%   roten Strahl fortgesetzt, da der grüne an der linken Grenzfläche endet, der
%   rote aber fälschlicherweise annimmt, dass der Endzustand sich auf die rechte
%   Grenzfläche bezieht. Dem blauen Strahl wird nun mit \Lkeyword{startinside}
%   mitgeteilt, dass der Endzustand sich auf die linke Grenzfläche bezieht.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{startinside}}]
\begin{pspicture*}(0,2)(3.05,6)
  \optplane(0,2)
  \lens[lens=8 8 8, abspos=0.6, n=1.8](0.5,2)(3,2)
  \optplate[position=1, plateheight=6](0.5,2)(3,2)
  \psset{savebeam=false}
  \drawbeam[beampos=3, linestyle=dashed]{-}
  \drawbeam[beampos=3, savebeam]{1-2}
  \drawbeam[loadbeam, linecolor=red]{2-3}
  \drawbeam[loadbeam, startinside, linecolor=blue]{2-3}
\end{pspicture*}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%   
%   \boolitem[false]{stopinside}
%   \ifENGLISH This option is equivalent to \Lkeyword{startinside} but refers
%   to the last component.
%   \fi
%   \ifGERMAN Äquivalent zu \Lkeyword{startinside}, bezieht sich aber auf die
%   letzte Komponenten.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords = {[21]{stopinside}}]
\begin{pspicture*}(0,2)(3.05,6)
  \optplane(0,2)
  \lens[lens=8 8 8, abspos=0.6, n=1.8](0.5,2)(3,2)
  \optplate[position=1, plateheight=6](0.5,2)(3,2)
  \psset{savebeam=false}
  \drawbeam[beampos=3, linestyle=dashed]{-}
  \drawbeam[beampos=3, savebeam, stopinside]{1-2}
  \drawbeam[loadbeam, linecolor=blue]{2-3}
\end{pspicture*}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
%
% \ifGERMAN\section{Faserverbindungen}\fi
% \ifENGLISH\section{Drawing fibers}\fi
% \label{sec:drawfiber}
%
% \ifENGLISH
% All available components can be connected with fiber connections, the
% fiber components in \prettyref{chap:fibercomp} are connected automatically.
% \fi
% \ifGERMAN
% Alle Komponenten können mit Fasern verbunden werden, die Faserkomponenten
% in \prettyref{chap:fibercomp} werden automatisch verbunden.
% \fi
%
% \begin{ltxsyntax}
%   \xLcs{drawfiber}\cmditem{drawfiber}[options]{obj$_1$}{obj$_2$}\ldots
% \end{ltxsyntax}
%   \ifENGLISH
%   This macro draws fiber connections and takes a variable number of
%   arguments (minimum of two) which can be either an ID, an ID range, a
%   \Lkeyword{compname}, or a PSTricks node (see
%   \prettyref{sec:accessobj}). To distinguish between nodes and
%   components, nodes must be either enclosed in parenthesis within the
%   brackets, or enclosed only in parenthesis:
%   \Lcs{drawfiber}\opt{\{(node)\}\{comp\}}, or
%   \Lcs{drawfiber}\opt{(node)\{comp\}}. If you specify more than two
%   arguments, it draws the connections $1\rightarrow 2$, $2\rightarrow
%   3$, and so on.
%
%   The automatic fiber connections are drawn internally with
%   \Lcs{drawfiber} commands from each reference node to the component.
%   \fi
%   \ifGERMAN 
%   Dieses Makro zeichnet Faserverbindungen und akzeptiert eine variable
%   Anzahl an Argumenten (mindestens zwei), die entweder eine ID, ein
%   ID-Intervall, ein \Lkeyword{compname} oder ein PSTricks-Knoten sein
%   können (siehe \prettyref{sec:accessobj}. Um zwischen Knoten und
%   Komponenten unterscheiden zu können, müssen Knoten entweder in runde
%   Klammern innerhalb der geschweiften Klammern eingeschlossen werden
%   oder dürfen nur runde Klammern haben:
%   \Lcs{drawbeam}\opt{\{(node)\}\{comp\}}, oder
%   \Lcs{drawbeam}\opt{(node)\{comp\}}. Werden mehr als zwei Argumente
%   mitgegeben, werden die Verbindungen $1\rightarrow 2$, $2\rightarrow
%   3$, usw. gezeichnet.
%
%   Die automatischen Faserverbindungen werden intern als
%   \Lcs{drawfiber} von den Referenzknoten zur Komponente gezeichnet.
%   \fi
%
% \ifENGLISH\subsection{Fiber angles}\fi
% \ifGERMAN\subsection{Faserwinkel}\fi
% \label{sec:drawfiber-angles}
% 
% \ifENGLISH
% The fibers are usually drawn as \Lcs*{nccurve} connections, the angles at both
% curve ends are automatically determined by the component orientation and
% depend on whether you connect a component with a component, or a component
% with a node.
% \fi
% \ifGERMAN
% Üblicherweise werden Fasern als \Lcs*{nccurve}-Verbindungen gezeichnet, die
% Winkel an beiden Kurvenenden werden automatisch anhand der
% Komponentenausrichtung bestimmt und hängen davon ab, ob eine Komponente mit
% einer anderen Komponente oder einem Knoten verbunden wird.
% \fi
% 
% \ifENGLISH\minisec{Component with node}\fi
% \ifGERMAN\minisec{Komponente mit Knoten}\fi
%
% \ifENGLISH
% A connection of a component with a node is what is used for automatic
% connections (see \prettyref{sec:drawconn-auto}). Consider the following
% example for clarification of the curve alignment:
% \fi
% \ifGERMAN
% Eine Verbindung zwischen einer Komponente und einem Knoten ist das, was bei
% automatischen Verbindungen verwendet wird (siehe
% \prettyref{sec:drawconn-auto}). Folgendes Beispiel erläutert die Ausrichtung
% der Kurve:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-3,10-11}]
\begin{pspicture}(-1,-0.7)(7,2.7)
  \pnodes(0,1){A}(6,1){B}
  \optbox[angle=30](A)(B)
  \psdot(\oenodeRefA{})\uput[180](\oenodeRefA{}){RefA}%
  \psdot(\oenodeRefB{})\uput[0](\oenodeRefB{}){RefB}%
  \psdot(\oenodeTrefA{})\uput[180](\oenodeTrefA{}){TrefA}%
  \psdot(\oenodeTrefB{})\uput[0](\oenodeTrefB{}){TrefB}%
  \psline[style=Refline, linestyle=dashed](\oenodeTrefA{})(\oenodeTrefB{})
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{})
  \drawfiber(A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifENGLISH
% The angle at the component itself agrees with the transformed reference line.
% The angle at the node corresponds to the angle of the original reference line
% of the component which it gets connected to. The fiber is always directed to
% the component node.
%
% Considering the following example, this means that the start angles of the red
% fibers are rotated by 180° with respect to the blue fibers. The angles at the
% component do not change.
% \fi
% \ifGERMAN
% Der Winkel an der Komponente entspricht dem der transformierten
% Referenzlinie. Der Winkel an dem Knoten entspricht dem der ursprünglichen
% Referenzlinie der Komponente zu der die Verbindung geht. Die Faser ist in
% Richtung des entsprechenden Komponentenknotens orientiert. 
%
% Das führt dazu, dass im folgenden Beispiel die Anfangswinkel der roten Fasern
% um 180° gegenüber den blauen Fasern gedreht sind, die Winkel an der Komponente
% bleiben unverändert.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-1,4-4,7-14}]
\begin{pspicture}(-2,-1.6)(2,2)
  \psset[optexp]{optboxsize=1.6 0.8}
  \addtopsstyle{Fiber}{ArrowInside=->, ArrowInsidePos=0.3, arrowscale=1.5}
  \optbox[position=end](0,1)(0,0)
  \psarc[fillstyle=solid,fillcolor=gray!20, linestyle=none](0,0){2}{0}{180}
  \psline[linestyle=dashed]([Xnodesep=-2]\oenodeIn{})([Xnodesep=2]\oenodeIn{})
  \addtopsstyle{Fiber}{linecolor=blue}
  \multido{\i=10+40}{5}{%
    \drawfiber(2;\i){}
  }
  \addtopsstyle{Fiber}{linecolor=red!90!black}
  \drawfiber(2;-20){}
  \drawfiber(2;200){}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH\minisec{Component with component}\fi
% \ifGERMAN\minisec{Komponente mit Komponente}\fi
% 
% \ifENGLISH
% This variant is very helpful to achieve smoother connections between
% components which are not aligned on the same reference line but are arranged
% maybe in a loop or similar, see \prettyref{ex:nalm} and
% \prettyref{ex:recirc-loop}.
%
% In this case, the curve angles are determined by the orientation of
% the component which the respective curve end is connected to. The
% fibers are always directed away from the component center.
% \fi
% \ifGERMAN
% Diese Variante ist sehr nützlich um glattere Verbindungen zwischen Komponenten
% zu erreichen, die nicht auf derselben Referenzlinie positioniert sind, sondern
% z.B. in einer Schleife angeordnet werden, siehe \prettyref{ex:nalm} und
% \prettyref{ex:recirc-loop}.
%
% In diesem Fall werden die Kurvenwinkel von der Komponente bestimmt, mit der
% das jeweilige Ende verbunden ist. Die Fasern zeigen immer von der
% Komponentenmitte weg.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-4,9-10}]
\begin{pspicture}(0,-0.8)(7,0.8)
  \pnodes(0,0){A}(3,0){B}(4,0){C}(7,0){D}
  \optbox[angle=30](A)(B)
  \optbox[angle=-30](C)(D)
  \psline[style=Refline, linestyle=dashed](\oenodeTrefA{1})(\oenodeTrefB{1})
  \psline[style=Refline, linestyle=dashed](\oenodeTrefA{2})(\oenodeTrefB{2})
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{1})(\oenodeRefB{2})
  \psdot(\oenodeRefA{1})\psdot(\oenodeRefB{2})
  \drawfiber(A){1}{2}(D)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH These automatically calculated start and stop angles can be changed
% in a variety of ways, the available parameters are listed in the following.
% \fi
% \ifGERMAN
% Diese automatisch berechneten Winkel können vielfältig manipuliert werden, die
% möglichen Parameter sind im Folgenden aufgelistet.
% \fi
%
% \begin{optionlist}
%   \choitem[relative]{fiberalign}{rel,relative,center,abs,absolute}
%   \ifENGLISH Set the reference for the fiber angles.
%   \fi
%   \ifGERMAN
%   Wählt die Referenz für die Faserwinkel.
%   \fi
%   \begin{valuelist}
%   \item[relative] 
%     \ifENGLISH The fiber angles are relative to the component. When
%     connecting a node to a component, the angle at the node is that of the
%     component reference line. The angle at the component agrees with that of
%     its transformed reference line.
%     \fi
%     \ifGERMAN
%     Die Faserwinkel sind relativ zur Komponente. Wird ein Knoten mit der
%     Komponente verbunden, so entspricht der Winkel am Knoten dem der
%     Referenzlinie der Komponente. Der Winkel an der Komponente entspricht dem
%     der transformierten Referenzlinie.
%     \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-4,9-10}]
\begin{pspicture}(1,-1.7)(7,1.7)
  \pnodes(0,0){A}(4,0){B}(3,0){C}(7,0){D}
  \optbox[angle=30](A)(B)
  \optbox[angle=-30](C)(D)
  \psline[style=Refline, linestyle=dashed](\oenodeTrefA{1})(\oenodeTrefB{1})
  \psline[style=Refline, linestyle=dashed](\oenodeTrefA{2})(\oenodeTrefB{2})
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{1})(\oenodeRefB{2})
  \psdot(\oenodeRefA{1})\psdot(\oenodeRefB{2})
  \drawfiber(A){1}{2}(D)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item[center] 
%   \ifENGLISH 
%   The fiber angles both at the node and the component are relative to
%   the connection between the involved interface node and the center
%   node of the component. In most cases this is equivalent to
%   \opt{relative}, but necessary e.g. for \Lcomp{optcirculator} and
%   \Lcomp{elecmixer}. In the example, the green fiber shows the correct
%   alignment, while the red one is with \opt{relative} alignment.
%   \fi
%   \ifGERMAN
%   Die Winkel sowohl am Knoten als auch an der Komponente sind relativ
%   zu der Verbindung zwischen dem betroffenen Komponentenknoten und der
%   Komponentenmitte. Meistens ist das äquivalent zu \opt{relative},
%   wird aber z.B. für \Lcomp{optcirculator} und \Lcomp{elecmixer}
%   benötigt. In dem Beispiel hat die grüne Faser die korrekte
%   Ausrichtung, während die rote \opt{relative} ausgerichtet wird.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fiberalign}]
\begin{pspicture}(1,0)(3,2)
  \addtopsstyle{Fiber}{arrowscale=1.3, arrows=->, arrowinset=0}
  \optcirculator[fiber=t](0,0.5)(3,2)(1.5,0)
  \drawfiber[linecolor=red]{}(1.5,0)
  \drawfiber[fiberalign=center, linecolor=green]{}(1.5,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item[absolute] 
%   \ifENGLISH The fiber angles are absolute, no automatic values are added.
%   \fi
%   \ifGERMAN
%   Die Faserwinkel werden als absolute Werte angegeben, die automatischen
%   Winkel werden nicht berücksichtigt.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fiberalign}, linerange={1-3,7-8}]
\begin{pspicture}(1,-1)(4.5,1)
  \pnodes(0,0){A}(4,0){B}
  \optbox[angle=30](A)(B)
  \psline[style=Refline, linestyle=dashed](\oenodeTrefA{})(\oenodeTrefB{})
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\psdot(\oenodeRefB{})
  \drawfiber[fiberalign=abs, ncurv=1.5](A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%   \end{valuelist}
%
%   \numitem[0]{fiberangleA}
%   \ifENGLISH An additive value for the starting angle, the total angle depends
%   on \Lkeyword{fiberalign}. If this parameter is set to \opt{absolute}, then
%   \Lkeyword{fiberangleA} is the total angle, otherwise its value is added to
%   the calculated angle.
%   \fi
%   \ifGERMAN
%   Ein additiver Wert für den Anfangswinkel, der gesamte Winkel hängt von
%   \Lkeyword{fiberalign} ab. Ist dieser auf \opt{absolute} eingestellt, so ist
%   \Lkeyword{fiberangleA} der absolute Winkel, andernfalls wird der Wert zu dem
%   automatisch berechneten Winkel hinzuaddiert.
%   \fi
%
%   \numitem[0]{fiberangleB}
%   \ifENGLISH Like \Lkeyword{fiberangleA}, but for the end angle.\fi
%   \ifGERMAN Wie \Lkeyword{fiberangleB}, aber für den Endwinkel.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fiberangleA, fiberangleB}, linerange={1-3,7-9}]
\begin{pspicture}(0,-1)(4,1)
  \pnodes(0,0){A}(4,0){B}
  \optbox[angle=30](A)(B)
  \psline[style=Refline, linestyle=dashed](\oenodeTrefA{})(\oenodeTrefB{})
  \psline[style=Refline, linestyle=dashed](\oenodeRefA{})(\oenodeRefB{})
  \psdot(\oenodeRefA{})\psdot(\oenodeRefB{})
  \drawfiber[fiberangleA=-90](A){}
  \drawfiber[fiberangleB=-90]{}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%   \choitem[auto]{startnode}{auto, N, 1, 2, \ldots}
%   \ifGERMAN Für die Verbindungen mit \Lcs{drawfiber} werden die Knoten
%   genommen, die sich am nächsten sind. Das passt häufig, aber nicht
%   immer. Hiermit kann der Startknoten explizit gewählt werden.
%   \fi
%   \ifENGLISH The connections with \Lcs{drawfiber} are drawn between the
%   two nodes which are nearest to each other. This fits most of the time, but not
%   always. With this option you can choose the start node explicitely.
%   \fi
%
%   \choitem[auto]{stopnode}{auto, N, 1, 2, \ldots}
%   \ifGERMAN Genau wie \Lkeyword{startnode}, aber für den Stopknoten.\fi
%   \ifENGLISH Like \Lkeyword{startnode}, but for the stop node.\fi
% \end{optionlist}
%
% \ifENGLISH
% The following examples show some use cases for \Lkeyword{startnode} and
% \Lkeyword{stopnode}.
% \fi
% \ifGERMAN
% Die folgenden Beispiele zeigen Anwendungsmöglichkeiten für
% \Lkeyword{startnode} und \Lkeyword{stopnode}.
% \fi
%
% \begin{enumerate}
% \item 
%   \ifENGLISH This example shows a situation, where choosing the nearest nodes
%   is correct.
%   \fi
%   \ifGERMAN In diesem Fall ist der nächstgelegene Knoten auch der richtige.
%   \fi
% 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-1,3-6}]
\begin{pspicture}(3,2)
  \psset{label=0, optboxwidth=1}
  \pnodes(-0.5,1){A}(1.5,1){B}(3.5,1){C}
  \optbox(A)(B){Box1}\optbox(B)(C){Box2}
  \drawfiber{1}{2}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH In this case, the nearest connection is not well defined because
%   two connections have the same length.
%   \fi
%   \ifGERMAN
%   Hier ist der kürzeste Abstand nicht eindeutig definiert, da es zwei
%   Verbindungen mit der gleichen Länge gibt.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-1,3-6}]
\begin{pspicture}(2,2)
  \psset{label=0}
  \pnodes(0,0.5){A}(2,0.5){B}([offset=1]B){C}(A|C){D}
  \optbox(A)(B){Box1}\optbox(C)(D){Box2}
  \drawfiber{1}{2}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH To select the desired connection it is often enough to set either
%   \Lkeyword{startnode} or \Lkeyword{stopnode}. With this you fix one node, the
%   other is the one nearest to it. In rare cases it might be necessary to fix
%   both nodes.
%   \fi
%   \ifGERMAN
%   Um die gewünschte Verbindung zu wählen ist es meistens ausreichend entweder
%   \Lkeyword{startnode} oder \Lkeyword{stopnode} zu setzen. Ist ein Knoten fest
%   vorgegeben, wird der anderen wieder als der mit dem kürzesten Abstand
%   gewählt. Nur in Ausnahmefällen sollte es notwendig sein beide Knoten
%   explizit anzugegeben.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]startnode}]
\begin{pspicture}(2,2)
  \psset{label=0}
  \pnodes(0,0.5){A}(2,0.5){B}([offset=1]B){C}(A|C){D}
  \optbox(A)(B){Box1}\optbox(C)(D){Box2}
  \drawfiber[startnode=1]{1}{2}
  \drawfiber[startnode=N, linecolor=black]{1}{2}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \item 
%   \ifENGLISH Another example where you need to specify the
%   \Lkeyword{startnode}.
%   \fi
%   \ifGERMAN Ein weiteres Beispiel, bei dem \Lkeyword{startnode} vorgegeben
%   werden muss.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]startnode}, caption={caption}, label={ex:nalm}]
\begin{pspicture}(2.1,3)
  \pnodes(0,0){A}(2,0){B}(0.3,3){C}(1.7,3){D}
  \psset{fiber=none, arrowscale=1.2, arrowinset=0}
  \optcoupler[fiber=l,
                addtoFiberIn1={angleA=0, ArrowInside=->},
                addtoFiberIn2={angleA=180, arrows=<-},
                abspos=0.5, compname=Cpl](A)(B)(C)(D)
  \optfiber[compname=Hnlf, abspos=1](C)(C|A)
  \optamp[abspos=2, compname=Amp](D|B)(D)
  \drawfiber{Cpl}{Hnlf}
  \drawfiber[startnode=1, ncurv=1.2]{Hnlf}{Amp}
  \drawfiber{Cpl}{Amp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{enumerate}
%
% \ifENGLISH\subsection{Fiber appearance}\fi
% \ifGERMAN\subsection{Faseraussehen}\fi
% \label{sec:fiberappearance}
%
% \begin{stylelist}
%   \styleitem{Fiber}
%   \ifENGLISH
%   The appearance of fibers is controlled with this style. The optional
%   argument of \Lcs{drawfiber} can be used as well, these options can overwrite
%   settings from the \Lstyle{Fiber} style.
%   \fi
%   \ifGERMAN
%   Das Aussehen der Fasern wird durch diesen Stil vorgegeben. Das optionale
%   Argument von \Lcs{drawfiber} kann ebenfalls verwendet werden, die
%   entsprechenden Parameter können die Einstellungen von \Lstyle{Fiber}
%   überschreiben.
%   \fi
% \end{stylelist}
% \begin{optionlist}
%   \valitem{addtoFiber}{list}
%     \addtostylemsg{Fiber}
%   \ifGERMAN Siehe z.B. \prettyref{ex:recirc-loop}.\fi
%   \ifENGLISH See for example \prettyref{ex:recirc-loop}.\fi
%
%   \valitem{newFiber}{list}
%     \newstylemsg{Fiber}
% 
%   \valitem[curve]{fiberstyle}{string}
%   \ifGERMAN
%   Die Fasern werden in der Regel als \Lcs*{nccurve} gezeichnet, aber eine
%   beliebige andere Knotenverbindung \nxLcs{nc}\prm{string} des
%   \LPack{pst-node} Paketes kann ausgewählt werden, lesen Sie die entsprechende
%   Dokumentation\fnurl{http://mirror.ctan.org/help/Catalogue/entries/pst-node.html}
%   für mögliche Werte. In den folgenden Beispielen werden
%   Anwendungsmöglichkeiten gezeigt, eine weitere ist in
%   \prettyref{ex:transmission-loop} zu sehen.
%   \fi
%   \ifENGLISH 
%   The fibers are usually drawn as \Lcs*{nccurve}, but any type of node
%   connection \nxLcs{nc}\prm{string} from \LPack{pst-node} can be selected with
%   this parameter, see the \LPack{pst-node}
%   documentation\fnurl{http://mirror.ctan.org/help/Catalogue/entries/pst-node.html}
%   for possible values. The following examples show possible use cases,
%   \prettyref{ex:transmission-loop} contains another typical use case.
%   \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]fiberstyle}]
\begin{pspicture}(3,3)
  \pnodes(1, 0.5){A}(2.5,0.5){B}(2.5,2){C}
  \psset{optboxsize=1 0.6, innerlabel}
  \optbox[position=start](A)(B){start}
  \optbox[position=end](B)(C){stop}
  \drawfiber[fiberstyle=diag, linearc=0.5]{1}{2}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[morekeywords={[21]fiberstyle}, label={ex:recirc-loop}, caption={caption}]
\begin{pspicture}(4,2.5)
  \pnodes(1,2.5){In}(3,2.5){Out}(0,2){A}(4,2){B}(4,0){C}(0,0){D}
  \optcoupler[fiber=t, addtoFiber={ArrowInside=->}, coupleralign=b](In)(A)(Out)(B)
  \psset{fiber=none}
  \optamp[position=0.35](C)(D)
  \optfiber[position=0.35](D)(C)
  \drawfiber{2}{3}
  \addtopsstyle{Fiber}{fiberstyle=bar, linearc=0.5, armA=1.5}
  \drawfiber[stopnode=1]{1}{2}
  \drawfiber[stopnode=1]{1}{3}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{optionlist}
%
% \ifGERMAN\section{Elektrische Verbindungen}\fi
% \ifENGLISH\section{Drawing wires}\fi
% \label{sec:drawwire}
%
% \ifENGLISH 
% All available components can be connected with wire connections, the
% wire components in \prettyref{chap:electrcomp} are connected
% automatically. The \Lkeyword*{wire*} parameters are equivalent to
% their \Lkeyword*{fiber*} counterparts, see their respective
% documentation for details.
% \fi
% \ifGERMAN
% Alle Komponenten können mit Drähten verbunden werden, die elektrischen
% Komponenten in \prettyref{chap:electrcomp} werden automatisch
% verbunden. Die \Lkeyword*{wire*}-Parameter sind äquivalent zu den
% entsprechenden \Lkeyword*{fiber*}-Parametern, die detailliertere
% Informationen enthalten.
% \fi
%
% \begin{ltxsyntax}
%   \xLcs{drawwire}\cmditem{drawwire}[options]{obj$_1$}{obj$_2$}\ldots
% \end{ltxsyntax}
%   \ifENGLISH
%   This command can take a variable number of arguments (minimum of
%   two) which can be either an ID, an ID range, a \Lkeyword{compname},
%   or a PSTricks nodes (see \prettyref{sec:accessobj}). To distinguish
%   between nodes and components, nodes must be either enclosed in
%   parenthesis within the brackets, or enclosed only in parenthesis:
%   \Lcs{drawwire}\opt{\{(node)\}\{comp\}}, or
%   \Lcs{drawwire}\opt{(node)\{comp\}}. If you specify more than two
%   arguments, you get connections $1\rightarrow 2$, $2\rightarrow 3$,
%   and so on.
%
%   The automatic connections are drawn internally with
%   \Lcs{drawwire} commands from each reference node to the component.
%   \fi
%   \ifGERMAN 
%   Dieses Makro akzeptiert eine variable Anzahl an Argumenten
%   (mindestens zwei), die entweder eine ID, ein ID-Intervall, ein
%   \Lkeyword{compname} oder ein PSTricks-Knoten sein können (siehe
%   \prettyref{sec:accessobj}. Um zwischen Knoten und Komponenten
%   unterscheiden zu können, müssen Knoten entweder in runde Klammern
%   innerhalb der geschweiften Klammern eingeschlossen werden oder
%   dürfen nur runde Klammern haben:
%   \Lcs{drawbeam}\opt{\{(node)\}\{comp\}}, oder
%   \Lcs{drawbeam}\opt{(node)\{comp\}}. Werden mehr als zwei Argumente
%   mitgegeben, werden die Verbindungen $1\rightarrow 2$, $2\rightarrow
%   3$, usw. gezeichnet.
%
%   Die automatischen Verbindungen werden intern als
%   \Lcs{drawwire} von den Referenzknoten zur Komponente gezeichnet.
%   \fi
%
% \begin{optionlist}
%   \choitem[relative]{wirealign}{rel,relative,center,abs,absolute}
%   \ifGERMAN Siehe \Lkeyword{fiberalign}.\fi
%   \ifENGLISH See \Lkeyword{fiberalign}.\fi
%
%   \numitem[0]{wireangleA}
%   \ifGERMAN Siehe \Lkeyword{fiberangleA}.\fi
%   \ifENGLISH See \Lkeyword{fiberangleA}.\fi
%
%   \numitem[0]{wireangleB}
%   \ifGERMAN Siehe \Lkeyword{fiberangleB}.\fi
%   \ifENGLISH See \Lkeyword{fiberangleB}.\fi
%
%   \valitem[angle]{wirestyle}{string}
%   \ifGERMAN Siehe \Lkeyword{fiberstyle}, der Vorgabewert ist jedoch \opt{angle}.\fi
%   \ifENGLISH See \Lkeyword{fiberstyle}, the default value is \opt{angle}.\fi
%
%   \valitem{addtoWire}{list}
%     \addtostylemsg{Wire}
%
%   \valitem{newWire}{list}
%     \newstylemsg{Wire}
% \end{optionlist}
% \begin{stylelist}
%   \styleitem{Wire}
%   \ifENGLISH
%   The appearance of wires is controlled with this style, compare with
%   \prettyref{sec:fiberappearance}. The optional argument of
%   \Lcs{drawwire} can be used as well, these options can overwrite
%   settings from the \Lstyle{Wire} style.
%   \fi
%   \ifGERMAN
%   Das Aussehen der elektrischen Verbindungen wird durch diesen Stil
%   vorgegeben, analog zu \prettyref{sec:fiberappearance}. Das optionale
%   Argument von \Lcs{drawwire} kann ebenfalls verwendet werden, die
%   entsprechenden Parameter können die Einstellungen von \Lstyle{Wire}
%   überschreiben.
%   \fi
%   \end{stylelist}
%   
% \ifENGLISH\section{Automatic fiber and wire connections}\fi
% \ifGERMAN\section{Automatische Faser- und Drahtverbindungen}\fi
% \label{sec:drawconn-auto}
%
% \ifENGLISH
% All fiber components described in \prettyref{chap:fibercomp} are
% connected automatically to their reference nodes with \Lcs{drawfiber},
% their behaviour is descibed in \prettyref{sec:drawfiber-angles}. The
% electrical components (\prettyref{chap:electrcomp}) are accordingly
% connected with \Lcs{drawwire}. The connections can also be controlled
% in a number of ways, without explicitely using these macros. The style
% of each connection can be configure independently, see
% \prettyref{sec:drawconn-auto-styles}.
% \fi
% \ifGERMAN
% Alle Faserkomponenten, die in \prettyref{chap:fibercomp} beschrieben
% werden, werden automatisch über \Lcs{drawfiber} mit ihren
% Referenzknoten verbunden, das Verhalten ist in
% \prettyref{sec:drawfiber-angles} beschrieben. Entsprechend dazu werden
% die elektrischen Komponenten (\prettyref{chap:electrcomp}) mit
% \Lcs{drawwire} mit Drähten verbunden. Die automatischen Verbindungen
% können umfangreich kontrolliert werden, ohne diese Makros explizit zu
% verwenden. Das Aussehen jeder Verbindung kann ebenfalls separat
% konfiguriert werden, siehe \prettyref{sec:drawconn-auto-styles}.
% \fi
%
% \begin{optionlist}
%   \choitem[all]{fiber}{[*+]none,all,i,o,\prm{refpoint}} 
%   \ifENGLISH This parameter selects which fiber connections are drawn.
%   The value of this parameter can affect either only the fiber
%   components (if the value is prefixed with \opt{*}), only free-ray
%   and electrical components (prefixed with \opt{+}), or all component types
%   otherwise. Typical free-ray components which are often used with
%   fibers as well are \Lcomp{optbox} and \Lcomp{optdetector}. Please
%   note, that electrical components cannot be connected automatically
%   with fibers, in these cases you must use \Lcs{drawfiber}
%   explicitely.
%
%   You can select to connect \opt{all} nodes, \opt{none}, or select distinct
%   connections to draw. Value \opt{i} (\opt{l} is equivalent) draws all input
%   fibers, \opt{o} (\opt{r} is equivalent) draws all output fibers. These
%   values are exclusive, that means \opt{io} does not select all fibers, but
%   none.
%
%   Components which have more than one input or output fiber
%   (\hyperref[sec:coupler]{couplers} and \Lcomp{optcirculator}) allow also
%   values \opt{t} and \opt{b}, possibly in combination with \opt{i}, \opt{o},
%   \opt{r}, or \opt{l}.
%
%   See the following examples for some variants.
%   \fi
%   \ifGERMAN
%   Dieser Parameter gibt an, welche Faserverbindungen gezeichnet
%   werden. Der Parameter kann nur die Faserkomponenten betreffen (falls
%   ein \opt{*} vorangestellt ist), nur die elektrischen und
%   Freistrahlkomponenten (\opt{+} wird vorangestellt), oder alle
%   Komponententypen. Typische Freistrahlkomponenten, die häufig als
%   Faserkomponenten verwendet werden, sind \Lcomp{optbox} und
%   \Lcomp{optdetector}. Beachten Sie, dass elektrische Komponenten
%   nicht automatisch mit Fasern verbunden werden können, Sie müssen
%   dann explizit \Lcs{drawfiber} verwenden.
%
%   Es können alle Verbindungen gezeichnet werden (\opt{all}), keine
%   (\opt{none}), oder es können bestimmte ausgewählt werden. Die Werte \opt{i}
%   (\opt{l} ist äquivalent) zeichnet nur die Eingangsfasern, \opt{o}
%   (bzw. \opt{r}) alle ausgehenden Fasern. Diese Angaben sind ausschließend,
%   d.h. mit \opt{io} werden gar keine Verbindungen gezeichnet.
%
%   Komponenten, die über mehr als einen Eingang oder Ausgang verfügen
%   (\hyperref[sec:coupler]{Koppler} und \Lcomp{optcirculator}) erlauben
%   weitergehende Auswahl mit \opt{t} und \opt{b}, möglicherweise in Verbindung
%   mit \opt{i}, \opt{o}, \opt{l} und \opt{r}.
% 
%   Die folgenden Beispiele zeigen einige Möglichkeiten.
%   \fi
% \end{optionlist}
%
% \begin{enumerate}
% \item 
%   \ifENGLISH Enable all fiber connections all components.\fi
%   \ifGERMAN Zeichne alle Fasern für alle Komponenten.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{fiber}}]
\begin{pspicture}(3,3)
  \psset{fiber}
  \optbox(0,2.5)(3,2.5)
  \optmzm(0,1.5)(3,1.5)
  \elecsynthesizer[position=0.5](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH Draw only the input fiber of a fiber component (\Lcomp{optmzm}),
%   the other components are not affected.
%   \fi
%   \ifGERMAN Nur die Eingangsverbindung einer Faserkomponente (\Lcomp{optmzm})
%   wird gezeichnet, die anderen Komponenten bleiben unbeeinflusst.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{fiber}}]
\begin{pspicture}(3,3)
  \psset{fiber=*i}
  \optbox(0,2.5)(3,2.5)
  \optmzm(0,1.5)(3,1.5)
  \elecsynthesizer[position=0.5](1,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \item 
%   \ifENGLISH All connections of the fiber component are drawn, the
%   other components get only the output fiber.
%   \fi
%   \ifGERMAN Von der Faserkomponente werden alle Verbindungen
%   gezeichnet, die anderen Komponenten erhalten nur eine
%   Ausgangsverbindung.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{fiber}}]
\begin{pspicture}(3,3)
  \psset{fiber=+o}
  \optbox(0,2.5)(3,2.5)
  \optmzm(0,1.5)(3,1.5)
  \elecsynthesizer[position=0.5](1,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \item 
%   \ifENGLISH The values \opt{t} and \opt{b} affect only components which have
%   more than two fibers, i.e \Lcomp{optcirculator} and the couplers
%   (\prettyref{sec:coupler}).
%   \fi
%   \ifGERMAN
%   Die Werte \opt{t} und \opt{b} betreffen nur die Komponenten mit mehr als
%   zwei Verbindungen, also \Lcomp{optcirculator} und die Koppler
%   (\prettyref{sec:coupler}).
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{fiber}}]
\begin{pspicture}(3,1)
  \optcoupler[fiber=t](0,1)(0,0)(3,1)(3,0)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[morekeywords={[21]{fiber}}]
\begin{pspicture}(3,1)
  \wdmsplitter[fiber=br](0,0.5)(3,1)(3,0)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[morekeywords={[21]{fiber}}]
\begin{pspicture}(3,1)
  \optcirculator[fiber=b](0,0.5)(3,1)(1,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{enumerate}
%
% \begin{optionlist}
%   \choitem[all]{wire}{[*+]none,all,i,o,\prm{refpoint}}
%   \ifENGLISH 
%   This parameter selects which wire connections are drawn. The value
%   of this parameter can affect either only the electrical components
%   (if the value is prefixed with \opt{*}), only free-ray and fiber
%   components (prefixed with \opt{+}), or all components otherwise.
%   \fi
%   \ifGERMAN
%   Dieser Parameter gibt an, welche elektrische Verbindungen gezeichnet
%   werden. Der Parameter kann nur die elektrischen Komponenten
%   betreffen (falls ein \opt{*} vorangestellt ist), nur die Faser- und
%   Freistrahlkomponenten (\opt{+} wird vorangestellt), oder alle
%   Komponenten.
%   \fi
% \end{optionlist}
% \begin{enumerate}
% \item 
%   \ifENGLISH Enable all wire connections for all components.\fi
%   \ifGERMAN Zeichne alle Drähte aller Komponenten.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{wire}}]
\begin{pspicture}(3,3)
  \psset{wire}
  \optbox(0,2.5)(3,2.5)
  \optmzm(0,1.5)(3,1.5)
  \elecsynthesizer[position=0.5](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \item 
%   \ifENGLISH Draw only the input wire of an electrical component
%   (\Lcomp{elecsynthesizer}), the other components are not affected.
%   \fi
%   \ifGERMAN Nur die Eingangsverbindung einer elektrischen Komponente
%   (\Lcomp{elecsynthesizer}) wird gezeichnet, die anderen Komponenten
%   bleiben unbeeinflusst.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{wire}}]
\begin{pspicture}(3,3)
  \psset{wire=*i}
  \optbox(0,2.5)(3,2.5)
  \optmzm(0,1.5)(3,1.5)
  \elecsynthesizer[position=0.5](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \item 
%   \ifENGLISH Draw only the output wire of the free-ray and fiber
%   components, but all connections of the wire component.
%   \fi
%   \ifGERMAN Von der Freistrahl- und Faserkomponente wird nur die Ausgangsverbindung
%   gezeichnet, die elektrischen Komponente erhält jedoch alle Verbindungen.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{wire}}]
\begin{pspicture}(3,3)
  \psset{wire=+o}
  \optbox(0,2.5)(3,2.5)
  \optmzm(0,1.5)(3,1.5)
  \elecsynthesizer[position=0.5](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \item 
%   \ifENGLISH The values \opt{t} and \opt{b} affect only components which have
%   more than two connections, i.e \Lcomp{elecmixer} and \Lcomp{eleccoupler}.
%   \fi
%   \ifGERMAN
%   Die Werte \opt{t} und \opt{b} betreffen nur die Komponenten mit mehr als
%   zwei Verbindungen, also \Lcomp{elecmixer} und \Lcomp{eleccoupler}.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{wire}}]
\begin{pspicture}(3,1)
  \eleccoupler[wire=t](0,1)(0,0)(3,1)(3,0)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[morekeywords={[21]{wire}}]
\begin{pspicture}(3,1.5)
  \elecmixer[wire=b](0,1)(3,1)(1,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{enumerate}
%
%
% \ifENGLISH\subsection{Appearance of automatic connections}\fi
% \ifGERMAN\subsection{Aussehen der automatischen Verbindungen}\fi
% \label{sec:drawconn-auto-styles}
%
% \begin{figure}\centering
% \begin{pspicture}(0,-0.2)(12,4.4)
% \rput[lt](0,4.4){%
%   \pstree[levelsep=1.5cm, treesep=0.6, 
%           nodesep=4pt, arrows=<-, 
%           arrowinset=0, arrowscale=1.5]{\poeTR{Fiber}}{%
%     \pstree{\poeTR{FiberIn}}{%
%       \poeTR{FiberIn1} \poeTR{FiberIn2}%
%     }%
%     \pstree{\poeTR{FiberOut}}{%
%       \poeTR{FiberOut1} \poeTR{FiberOut2}%
%     }%
%   }%
%   \rput[l](-1,0|T-0){\ifGERMAN Grundstil\fi\ifENGLISH parent style\fi}
%   \rput[l](-1,0|T-0-0){%
%     \ifGERMAN
%       \parbox{\widthof{ausgehende Fasern}}{%
%         \RaggedRight eingehende und ausgehende Fasern}%
%     \fi
%     \ifENGLISH
%       \parbox{\widthof{outgoing fibers}}{%
%         \RaggedRight incoming and outgoing fibers}%
%     \fi
%   }
%   \rput[t](! \psGetNodeCenter{T-0-0-0} \psGetNodeCenter{T-0-0-1}
%              T-0-0-0.x T-0-0-1.x add 2 div T-0-0-0.y 0.4 sub){%
%     \ifGERMAN
%       \parbox{\widthof{Obere(1) oder untere(2)}}{%
%         \RaggedRight Obere(1) oder untere(2) eingehende Faser.}%
%     \fi
%     \ifENGLISH
%       \parbox{\widthof{Upper(1) or lower(2)}}{%
%         \RaggedRight Upper(1) or lower(2) incoming fiber.}%
%     \fi
%   }
%   \rput[t](! \psGetNodeCenter{T-0-1-0} \psGetNodeCenter{T-0-1-1}
%              T-0-1-0.x T-0-1-1.x add 2 div T-0-1-0.y 0.4 sub){%
%     \ifGERMAN
%       \parbox{\widthof{Obere(1) oder untere(2)}}{%
%         \RaggedRight Obere(1) oder untere(2) ausgehende Faser.}%
%     \fi
%     \ifENGLISH
%       \parbox{\widthof{Upper(1) or lower(2)}}{%
%         \RaggedRight Upper(1) or lower(2) outgoing fiber.}%
%     \fi
%   }
% }%
% \end{pspicture}
% \ifGERMAN
% \caption{Vererbungsdiagramm der PS-Stile für die automatischen
% Faserverbindungen. Sie sollten diese Stile mit \protect\Lcs*{addtopsstyle}
% oder den entsprechenden \opt{addto}\prm{style} Parametern ändern um die
% Vererbungslinie beizubehalten. Eine identisches Vererbungsdiagramm besteht 
% für die entsprechenden \opt{Wire\ldots} Stile.}%
% \fi \ifENGLISH
% \caption{Inheritance diagram for the psstyles used for the automatic fiber
% connections. These styles should be changed with \protect\Lcs*{addtopsstyle}
% or the respective \opt{addto}\prm{style} options to preserve the
% inheritance. An identical inheritance tree applies to the respective 
% \opt{Wire\ldots} styles.}%
% \fi
% \label{fig:fiberstyles}
% \end{figure}
%
% \ifENGLISH
% The styles of all automatic fiber connections can be configured independently,
% they are all derived from the basic \Lstyle{Fiber} style which is described in
% \prettyref{sec:fiberappearance}.
% \fi
% \ifGERMAN
% Die Stile aller automatischen Faserverbindungen können separat konfiguriert
% werden, der zugrundeliegende Stil ist immer \Lstyle{Fiber}, der in
% \prettyref{sec:fiberappearance} beschrieben ist.
% \fi
%
% \begin{stylelist}
% \item[\smash{%
%   \begin{tabular}[t]{@{}r@{}}%
%     \opt{FiberIn}\\
%     \opt{FiberIn1}\\
%     \opt{FiberIn2}\\
%     \opt{FiberOut}\\
%     \opt{FiberOut1}\\
%     \opt{FiberOut2}
%   \end{tabular}}%
% ]%
% \xLstyle{FiberIn}\label{sty:FiberIn}%
% \xLstyle{FiberIn1}\label{sty:FiberIn1}%
% \xLstyle{FiberIn2}\label{sty:FiberIn2}%
% \xLstyle{FiberOut}\label{sty:FiberOut}%
% \xLstyle{FiberOut1}\label{sty:FiberOut1}%
% \xLstyle{FiberOut2}\label{sty:FiberOut2}%
% \ifENGLISH
% Style \Lstyle{FiberIn} applies to all input fibers, it inherits from
% \Lstyle{Fiber}. If the component has more than one input fiber they use the
% styles \Lstyle{FiberIn1} and \Lstyle{FiberIn2} which inherit from
% \Lstyle{FiberIn}. All output fibers use the style \Lstyle{FiberOut}, in case of two output fibers they use the styles \Lstyle{FiberOut1} and \Lstyle{FiberOut2} which
% inherit from \Lstyle{FiberOut}. See \prettyref{fig:fiberstyles} for an
% inheritance diagram of the styles. You must have in mind, that this
% inheritance is effective only if you use \Lcs*{addtopsstyle} to change the
% styles (see also below).
% \fi
% \ifGERMAN
% Der Stil \Lstyle{FiberIn} bezieht sich auf alle Eingangsfasern und erbt alle
% Eigenschaften von \Lstyle{Fiber}. Hat eine Komponente zwei davon, so können
% diese mit \Lstyle{FiberIn1} und \Lstyle{FiberIn2} angesprochen werden, die
% alles von \Lstyle{FiberIn} übernehmen. Entsprechend bezieht sich
% \Lstyle{FiberOut} auf alle Ausgangsfasern, falls es davon zwei gibt dann
% können diese mit \Lstyle{FiberOut1} und \Lstyle{FiberOut2} geändert
% werden. Siehe \prettyref{fig:fiberstyles} für ein Vererbungsdiagramm der
% Faserstile. Beachten Sie, dass diese Vererbung nur erhalten bleibt, falls die
% Stile nur mit \Lcs*{addtopsstyle} oder den entsprechenden
% \opt{addto}\prm{style} Parametern verändert werden.
% \fi
% \item[\smash{%
%   \begin{tabular}[t]{@{}r@{}}%
%     \opt{WireIn}\\
%     \opt{WireIn1}\\
%     \opt{WireIn2}\\
%     \opt{WireOut}\\
%     \opt{WireOut1}\\
%     \opt{WireOut2}
%   \end{tabular}}%
% ]%
% \ifENGLISH
% Style \Lstyle{WireIn} applies to all input wires, it inherits from
% \Lstyle{Wire}. If the component has more than one input wire they use
% the styles \Lstyle{WireIn1} and \Lstyle{WireIn2} which inherit from
% \Lstyle{WireIn}. All output wires use the style \Lstyle{WireOut}, in
% case of two output wires they use the styles \Lstyle{WireOut1} and
% \Lstyle{WireOut2} which inherit from \Lstyle{WireOut}. See
% \prettyref{fig:fiberstyles} for an inheritance diagram of the
% styles. You must have in mind, that this inheritance is effective only
% if you use \Lcs*{addtopsstyle} to change the styles (see also below).
% \fi
% \ifGERMAN
% Der Stil \Lstyle{WireIn} bezieht sich auf alle eingehenden
% elektrischen Verbindungen und erbt alle Eigenschaften von
% \Lstyle{Wire}. Hat eine Komponente zwei davon, so können diese mit
% \Lstyle{WireIn1} und \Lstyle{WireIn2} angesprochen werden, die alles
% von \Lstyle{WireIn} übernehmen. Entsprechend bezieht sich
% \Lstyle{WireOut} auf alle ausgehenden elektrischen Verbindungen, falls
% es davon zwei gibt dann können diese mit \Lstyle{WireOut1} und
% \Lstyle{WireOut2} geändert werden. Siehe \prettyref{fig:fiberstyles}
% für ein Vererbungsdiagramm der Stile. Beachten Sie, dass diese
% Vererbung nur erhalten bleibt, falls die Stile nur mit
% \Lcs*{addtopsstyle} oder den entsprechenden \opt{addto}\prm{style}
% Parametern verändert werden.
% \fi
% \xLstyle{WireIn}\label{sty:WireIn}%
% \xLstyle{WireIn1}\label{sty:WireIn1}%
% \xLstyle{WireIn2}\label{sty:WireIn2}%
% \xLstyle{WireOut}\label{sty:WireOut}%
% \xLstyle{WireOut1}\label{sty:WireOut1}%
% \xLstyle{WireOut2}\label{sty:WireOut2}%
%
% \item[\smash{\begin{tabular}[t]{@{}r@{}}%
%   \opt{new}\prm{style}\\
%   \opt{addto}\prm{style}
%   \end{tabular}}]
%   \xLkeyword{newFiberIn}\xLkeyword{addtoFiberIn}%
%   \label{prm:newFiberIn}\label{prm:addtoFiberIn}
%   \xLkeyword{newFiberIn1}\xLkeyword{addtoFiberIn1}
%   \label{prm:newFiberIn1}\label{prm:addtoFiberIn1}
%   \xLkeyword{newFiberIn2}\xLkeyword{addtoFiberIn2}
%   \label{prm:newFiberIn2}\label{prm:addtoFiberIn2}
%   \xLkeyword{newFiberOut}\xLkeyword{addtoFiberOut}
%   \label{prm:newFiberOut}\label{prm:addtoFiberOut}
%   \xLkeyword{newFiberOut1}\xLkeyword{addtoFiberOut1}
%   \label{prm:newFiberOut1}\label{prm:addtoFiberOut1}
%   \xLkeyword{newFiberOut2}\xLkeyword{addtoFiberOut2} 
%   \label{prm:newFiberOut2}\label{prm:addtoFiberOut2}
%   \xLkeyword{newWireIn}\xLkeyword{addtoWireIn}
%   \label{prm:newWireIn}\label{prm:addtoWireIn}
%   \xLkeyword{newWireIn1}\xLkeyword{addtoWireIn1}
%   \label{prm:newWireIn1}\label{prm:addtoWireIn1}
%   \xLkeyword{newWireIn2}\xLkeyword{addtoWireIn2}
%   \label{prm:newWireIn2}\label{prm:addtoWireIn2}
%   \xLkeyword{newWireOut}\xLkeyword{addtoWireOut}
%   \label{prm:newWireOut}\label{prm:addtoWireOut}
%   \xLkeyword{newWireOut1}\xLkeyword{addtoWireOut1}
%   \label{prm:newWireOut1}\label{prm:addtoWireOut1}
%   \xLkeyword{newWireOut2}\xLkeyword{addtoWireOut2} 
%   \label{prm:newWireOut2}\label{prm:addtoWireOut2}
%   \ifENGLISH 
%   For every style two appropriate keys \opt{new}\prm{style} and
%   \opt{addto}\prm{style} are provided which can be used to change the
%   styles for single objects. This can be used to define own components
%   (\prettyref{sec:customcomp}) with respectively changed connections
%   or to avoid explicit grouping.
%   \fi
%   \ifGERMAN 
%   Für jeden Faserstil werden zwei Parameter \opt{new}\prm{style} und
%   \opt{addto}\prm{style} bereitgestellt, mit denen die Stile für
%   einzelne Komponenten verändert werden können. Damit können neuen
%   Komponenten mit anderen voreingestellten Verbindungen definiert
%   werden (\prettyref{sec:customcomp}), oder explizite Gruppierung kann
%   vermieden werden.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{addtoFiberOut1}}]
\begin{pspicture}(3,2)
  \newpsobject{tapcoupler}{wdmsplitter}{%
    coupleralign=b, 
    addtoFiberOut1={arrows=->, arrowscale=1.2, arrowinset=0}}
  \tapcoupler(0,0.5)(3,1.5)(3,0.5){99/1}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{stylelist}
%
%
% \ifGERMAN\subsection{Bekannte Einschränkungen}\fi
% \ifENGLISH\subsection{Known limitations}\fi
%
% \ifGERMAN Die Kombination von \Lkeyword{fiber} und \Lkeyword{wire}
% erlaubt in der derzeitigen Implementierung (Version \fileversion)
% nicht die beliebige Kombination aller Parametervarianten. Die meisten
% funktionieren, aber das folgende Beispiel zeigt eine Variante, die
% nicht korrekt funktioniert (der \Lcomp{elecsynthesizer} sollte eine
% Eingangsfaser haben):
% \fi
% \ifENGLISH The combination of \Lkeyword{fiber} and \Lkeyword{wire}
% does not allow any arbitrary combination of all parameter values in
% the current implementation (version \fileversion). Most combinations
% do work, but the following examples shows a variant, which does not
% work correctly (the \Lcomp{elecsynthesizer} should have an input fiber):
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{fiber, wire}}]
\begin{pspicture}(3,3)
  \psset[optexp]{fiber=i, wire=+i}
  \fiberdelayline(0,2.5)(3,2.5)
  \optbox(0,1.5)(3,1.5)
  \elecsynthesizer[position=0.5](0,0.5)(3,0.5)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN In solchen speziellen Fällen muss auf manuelle Verbindungen
% zurückgegriffen werden.
% \fi
% \ifENGLISH In such special cases one must resort to manual
% connections.
% \fi
%
% \ifGERMAN\section{Zeichenebenen}\fi
% \ifENGLISH\section{Layers}\fi
% \label{sec:layers}
% 
% \ifENGLISH 
% The necessary order of constructing a drawing is to define the components
% first before you can connect them. This implies that all connections are drawn
% on top of the components, which might be unwanted.
%
% To circumvent this, we provide the \Lenv{optexp} environment, inside which all
% connections are drawn behind the components.
% \fi
% \ifGERMAN
% Die Reihenfolge der Konstruktion einer Skizze ist die, dass zuerst die
% Komponenten definiert werden müssen, bevor diese verbunden werden können. Das
% beinhaltet aber, dass alle Verbindungen über die Komponenten gezeichnet
% werden, was nicht erwünscht sein muss.
%
% Um das zu vermeiden, wird die \Lenv{optexp}-Umgebung bereitgestellt, innerhalb
% derer alle Verbindungen hinter die Komponenten gelegt werden.
% \fi
%
% \begin{ltxsyntax}
%   \envitem{optexp}
% \end{ltxsyntax}
%
% \iffalse
%<*ignore>
% \fi
\ifENGLISH
\begin{LTXexample}
\begin{pspicture}(3,4)
  \psset{beam, fillstyle=solid, fillcolor=black}
  \optbox(0,3.5)(3,3.5){no layers}
  \begin{optexp}
    \optbox(0,1.5)(3,1.5){with layers}
  \end{optexp}
\end{pspicture}
\end{LTXexample}
\fi
\ifGERMAN
\begin{LTXexample}
\begin{pspicture}(3,4)
  \psset{beam, fillstyle=solid, fillcolor=black}
  \optbox(0,3.5)(3,3.5){ohne Ebenen}
  \begin{optexp}
    \optbox(0,1.5)(3,1.5){mit Ebenen}
  \end{optexp}
\end{pspicture}
\end{LTXexample}
\fi
% \iffalse
%</ignore>
% \fi
% 
% \ifENGLISH
% Beware, that this is achieved by executing twice all code included in the
% environment. This works fine for all \LPack{pst-optexp} commands which take
% care of not drawing stuff twice but only in a changed order. All other text
% and graphics are drawn twice which leads to ugly results because of altered
% anti-aliasing in the viewer.
%
% To avoid this, you can either move all other code outside the environment, or
% use the following two commands to define code parts which are executed only
% once.
% \fi
% \ifGERMAN
% Beachten Sie, dass das erreicht wird, indem der gesamte Code innerhalb der
% Umgebung doppelt ausgeführt wird. Das funktioniert mit allen
% \LPack{pst-optexp}-Makros, da diese sich intern darum kümmern nichts doppelt
% sondern nur in geänderter Reihenfolge zu zeichnen. Alle anderen Zeichnungen
% und Texte werden zweimal gezeichnet, was zu unschönen Ergebnissen aufgrund
% von geändertem Antialiasing in dem Betrachter führen kann.
%
% Um zu verhindern, dass anderer Code doppelt ausgeführt wird, muss dieser
% entweder außerhalb der \Lenv{optexp}-Umgebung definiert werden, oder durch
% eins der beiden folgenden Makros auf eine Ebene beschränkt werden.
% \fi
%
% \begin{ltxsyntax}
%   \cmditem{backlayer}{code} 
%
%   \ifENGLISH Execute \prm{code} only once in the first pass.\fi
%   \ifGERMAN Führe \prm{code} nur beim ersten Durchgang aus.\fi
%
%   \cmditem{frontlayer}{code}
%
%   \ifENGLISH Execute \prm{code} only once in the second pass.\fi
%   \ifGERMAN Führe \prm{code} nur beim zweiten Durchgang aus.\fi
% \end{ltxsyntax}
%
% \ifENGLISH
% In this example, the text is put on top of the frame although the text is
% defined first: 
% \fi
% \ifGERMAN In diesem Beispiel wird der Text über dem Rechteck angezeigt, obwohl
% der Text zuerst definiert wird:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1)
\begin{optexp}
  \frontlayer{\rput(1.5,0.5){front}}
  \backlayer{\psframe*[linecolor=DOrange!50](1,0)(2,1)}
\end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% 
% \ifGERMAN\chapter{Benutzerdefinierte Komponenten}\fi
% \ifENGLISH\chapter{Custom components}\fi
% \label{chap:custom}
%
% \ifGERMAN
% Das \LPack{pst-optexp}-Paket stellt zwei Makros zur Verfügung um
% eigene Komponenten zu zeichnen. Diese können z.B. aus Bildern oder
% eigenen Zeichnungen bestehen.
% \fi
% \ifENGLISH
% The \nxLPack{pst-optexp} package provides two commands which can use
% anything as optical components. This includes e.g. external images or
% your own drawings.
% \fi
% 
% \begin{ltxsyntax}
%    \xLdipole{optdipole}%
%    \compitem{optdipole}[options](in)(out){comp}{label}
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,3)
  \optdipole[labeloffset=1, beam](0,2)(3,1){%
    \rput(0,0){\rule{0.5cm}{1cm}}%
  }{label}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \xLdipole{opttripole}%
% \compitem{opttripole}[options](in)(center)(out){comp}{label}
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,3)
  \opttripole[beam](3,1.5)(1.5,2)(0,0){%
    \rput[b](0,0){text}%
  }{label}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% \end{ltxsyntax}
%
% \ifENGLISH
% These components can also be connected with beams and fibers, but do
% not provide full access to all options. \Lcomp{opttripole} defines a
% single reflective interface, whereas \Lcomp{optdipole} can have two
% transmittive interfaces:
% \fi
% \ifGERMAN
% Diese Komponenten können sowohl mit Fasern als auch mit Strahlen
% verbunden werden, können aber nicht deren volles Potential
% ausschöpfen. \Lcomp{opttripole} definiert eine einzelne reflektive
% Grenzfläche, \Lcomp{optdipole} kann zwei transmittive Grenzflächen haben:
% \fi
%
% \begin{optionlist}
%   \optitem[0 0]{optdipolesize}{\prm{width}[ \prm{height}]}
%   \ifGERMAN 
%   Hiermit können zwei transmittierende Grenzflächen für
%   \Lcomp{optdipole} definiert werden, die sich bei
%   $(\pm 0.5\text{\prm{width}}, 0)$ befinden.
%   \fi
%   \ifENGLISH
%   With this option you can define two transmittive interfaces for
%   \Lcomp{optdipole}, which are placed at $(\pm 0.5\text{\prm{width}}, 0)$.
%   \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]optdipolesize}]
\begin{pspicture}(3,2)
\pnodes(0,1){A}(3,1){B}
\optdipole[optdipolesize=1, showifcnodes](A)(B){%
  \psframe[fillstyle=solid,fillcolor=black!30](-0.5,-0.5)(-0.3,0.5)
  \psframe(-0.5,-0.5)(0.5,0.5)}{label}
\drawwidebeam[beamwidth=0.3, beaminside=false](A){}(B)
\drawbeam[beaminside=false, linecolor=red](A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Wenn zusätzlich eine Höhe \prm{height} ungleich Null
% angegeben wird, so wird diese als Apertur für das Raytracing genommen
% (siehe \Lkeyword{useNA}). Im folgenden Beispiel ist die Höhe gleich
% \opt{0.2} und damit kleiner als der aufgeweitete Strahl der deshalb
% anders als im vorangegangenen Beispiel nicht gezeichnet wird.
% \fi
% \ifENGLISH 
% If also a \prm{height} greater than zero is set, this is used as size
% of the numerical aperture for ray tracing (see \Lkeyword{useNA}). In
% the following example the height is set to \opt{0.2} which is smaller
% than the wide beam which is not drawn, in contrast to the previous
% example.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]optdipolesize}]
\begin{pspicture}(3,2)
\pnodes(0,1){A}(3,1){B}
\optdipole[optdipolesize=1 0.2, showifcnodes](A)(B){%
  \psframe[fillstyle=solid,fillcolor=black!30](-0.5,-0.5)(-0.3,0.5)
  \psframe(-0.5,-0.5)(0.5,0.5)}{label}
\drawwidebeam[beamwidth=0.3, beaminside=false](A){}(B)
\drawbeam[beaminside=false, linecolor=red](A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN  
% Weitere Beispiel sind \prettyref{ex:lclv} und
% \prettyref{ex:absspektr}.
% \fi
% \ifENGLISH 
% Further examples are \prettyref{ex:lclv} and
% \prettyref{ex:absspektr}.
% \fi
% 
% \optitem{optdipolecomp}{\prm{macros}}
% \ifGERMAN Mit dieser Option kann die Zeichnung einer Komponente
% definiert werden, um dann mit \Lcs*{newpsobject} basierend auf
% \Lcomp{optdipole} eine neuen Komponente zu definieren.
% \fi
% \ifENGLISH
% This option defines the drawing of a component, and can be used to
% define a new component based in \Lcomp{optdipole} with
% \Lcs*{newpsobject}.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]optdipolecomp}]
\begin{pspicture}(3,2)
\def\phasemodulatorcomp{%
  \psframe(-1,-0.4)(1,0.4)
  \psframe[fillstyle=hlines](-1.3,-0.5)(1.3,-0.4)
  \psframe[fillstyle=hlines](-1.3,0.5)(1.3,0.4)}
\newpsobject{phasemodulator}{optdipole}{optdipolesize=2 0.8, optdipolecomp={\phasemodulatorcomp}}
\pnodes(0,1){A}(3,1){B}
\phasemodulator(A)(B){LiNbO$_3$}
\drawwidebeam[beamwidth=0.3, beaminside=false](A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \optitem{opttripolecomp}{\prm{macros}}
% \ifGERMAN Mit dieser Option kann die Zeichnung einer Komponente
% definiert werden, um dann mit \Lcs*{newpsobject} basierend auf
% \Lcomp{opttripole} eine neuen Komponente zu definieren.
% \fi
% \ifENGLISH
% This option defines the drawing of a component, and can be used to
% define a new component based in \Lcomp{opttripole} with
% \Lcs*{newpsobject}.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]opttripolecomp}]
\begin{pspicture}(3,2)
\def\ampmodcomp{%
  \psframe*[linestyle=none](-0.5,0)(0.5,0.1)
  \psframe*[linestyle=none, linecolor=gray](-0.5,0.1)(0.5,0.2)}
\newpsobject{ampmod}{opttripole}{opttripolecomp={\ampmodcomp}}
\pnodes(0,0){A}(2,1.5){B}(3,0){C}
\ampmod(A)(B)(C){AM}
\drawwidebeam[beamwidth=0.3](A){}(C)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \end{optionlist}
%
% \ifGERMAN
% \section{Benutzerdefinierte Version existierender Komponenten}
% \fi
% \ifENGLISH
% \section{Customized versions of existing components}
% \fi
% \label{sec:customcomp}
% 
% \ifENGLISH
% You can define a customized version of an existing component using the
% \Lcs*{newpsobject} macro. With this you can define a new component using
% predefined objects with a set of options. These options serve only as default
% values and can be overridden when calling the macro.
% \fi
% \ifGERMAN
% Sie können eine benutzerdefinierte Version einer existierenden Komponente mit
% \Lcs*{newpsobject} definieren, die z.B. andere Voreinstellungen oder und ein
% anderes Aussehen hat.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{newpsobject}}]
\begin{pspicture}(3,1.7)
\newpsobject{sbn}{crystal}{%
  voltage, lamp, %
  fillstyle=solid, fillcolor=yellow!90!black}
\sbn[label=1.2 45, beam](0,1)(3,1){SBN:Ce}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[morekeywords={[21]{newpsobject}}]
\begin{pspicture}(3,1.7) 
\newpsobject{pumpcoupler}{wdmcoupler}{%
  coupleralign=top, addtoFiberIn2={ArrowInside=->, arrowscale=2}}
\pumpcoupler[label=0.5 180](0,1)(0,0)(3,1){Pumpcoupler}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[pos=t, morekeywords={[21]{newpsobject}}, caption={caption}]
\begin{pspicture}(10,2)
  \newpsobject{MOLensIn}{lens}{lens=0.5 0.5 0.5}
  \newpsobject{MOLensOut}{lens}{lens=1.5 1.5 1.5}
  \pnodes(0,1){A}(10,1){B}
  \MOLensIn[abspos=1](A)(B)\MOLensOut[abspos=2](A)(B)
  \optplate[plateheight=1.5](A)(B)
  \MOLensOut[abspos=8](A)(B)\MOLensIn[abspos=9](A)(B)
  \addtopsstyle{Beam}{n=1, fillstyle=solid, fillcolor=green, opacity=0.3}
  \psset{loadbeampoints}
  \drawwidebeam[beamwidth=0.2, stopinside](A){1}
  \drawwidebeam[beamdiv=-70]{1}{2}
  \drawwidebeam[stopinside]{2-4}
  \drawwidebeam[beamdiv=-70]{4}{5}
  \drawwidebeam{5}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH\section{Defining new objects}\fi
% \ifGERMAN\section{Neue Objekte definieren}\fi
% \label{sec:newobj}
%
% \ifENGLISH
% \nxLPack{pst-optexp} provides some high-level macros to allow very convenient
% definition of your own custom components. 
%
% Note, that this part of the documentation is not complete. It roughly
% describes the steps to define own components since version 3.0. Some parts may
% be subject to change which are not backward compatible.
% \fi
% \ifGERMAN
% \nxLPack{pst-optexp} stellt einige Benutzermakros zur Verfügung, mit denen
% sehr bequem neue, eigene Komponenten definiert werden können.
%
% Beachten Sie, dass dieser Teil der Dokumentation nicht vollständig ist. Die
% notwendigen Schritte zur Definition neuer Komponenten seit Version 3.0 werden
% grob beschrieben, können sich aber noch ändern und sind nicht zwangsläufig
% abwärtskompatibel.
% \fi
%
% \begin{ltxsyntax}
%   \xLcs{newOptexpDipole}\cmditem{newOptexpDipole}[fixopt]{name}{dftopt}
%   \xLcs{newOptexpTripole}\cmditem{newOptexpTripole}[fixopt]{name}{dftopt}
%   \xLcs{newOptexpFiberDipole}\cmditem{newOptexpFiberDipole}[fixopt]{name}{dftopt}
%   \xLcs{newOptexpElecDipole}\cmditem{newOptexpElecDipole}[fixopt]{name}{dftopt}
% \end{ltxsyntax}
%
% \ifENGLISH 
% These macros generate all organizing code for the component
% \textbackslash\prm{name} which handle the positioning, label
% placement, rotation and shifting, and the layering. In the simplest
% case you only have to define the actual drawing of the component
% outline. 
%
% With the argument \prm{fixopt} you can specify argument settings which
% will not be allowed to be overwritten, with \prm{dftopt} you can
% specify a set of default arguments which may be overwritten with the
% components optional argument. Both arguments \prm{fixopt} and
% \prm{dftopt} are optional and may be omitted.
%
% The macros \Lcs{newOptexpFiberDipole} and \Lcs{newOptexpElecDipole}
% only differ from the generic \Lcs{newOptexpDipole} in the connection
% settings, like the components in \prettyref{chap:fibercomp} and
% \prettyref{chap:electrcomp}, respectively.
%
% The actual process of creating a new component is split up in different parts,
% depending on the component complexity and user requirements:
% \begin{enumerate}
% \item The component drawing (see \prettyref{sec:newobj-comp}), this is the
%   only required part.
% \item Support for raytracing (optional)
% \item Optional support for \Lkeyword{rotateref}, \Lkeyword{extnode} and
%   \Lkeyword{position}\opt{=start|end} (optional).
% \end{enumerate}
% \fi
% \ifGERMAN
% Diese Makros erzeugen den Code für die Positionierung, Drehung,
% Beschriftung und die Ebenenverwaltung der neuen Komponente
% \textbackslash\prm{name}. Im einfachsten Fall müssen Sie lediglich die
% eigentliche Zeichnung der Komponente erstellen.
%
% Mit dem Argument \prm{fixopt} können Optionen voreingestellt werden,
% die später über das optionale Argument der Komponente nicht verändert
% werden können, \prm{dftopt} erlaubt Voreinstellungen zu machen, die
% überschrieben werden können. Beide Argumente \prm{fixopt} und
% \prm{dftopt} sind optional und können auch ganz weggelassen werden.
%
% Die Definition der neuen Komponenten kann in unterschiedliche Schritte
% eingeteilt werden, je nach Komplexität und Anforderung des Benutzers:
% \begin{enumerate}
% \item Die Zeichnung (siehe \prettyref{sec:newobj-comp}), das ist der einzige
%   erforderliche Schritt.
% \item Unterstützung von Raytracing (optional).
% \item Unterstützung für \Lkeyword{rotateref}, \Lkeyword{extnode} und
%   \Lkeyword{position}\opt{=start|end} (optional).
% \end{enumerate}
% \fi
%
% \ifGERMAN Die folgenden Abschnitte enthalten die Entwicklung einer
% einfachen Beispielkomponente \nxLcs{testcomp}.
% \fi
% \ifENGLISH The following section show the development of a simple
% example component \nxLcs{testcomp}.
% \fi
%
% \ifENGLISH\subsection{The component drawing}\fi
% \ifGERMAN\subsection{Die Zeichnung der Komponente}\fi
% \label{sec:newobj-comp}
%
% \ifENGLISH
% You must define a macro which is called e.g. \cs{\ldots @comp}, which
% contains the component drawings. See the following two examples for dipole and
% tripole which show the orientation and position of the component coordinate
% system.
% \fi
% \ifGERMAN Sie müssen ein Makro \cs{\ldots @comp} definieren, welches
% die Zeichnung enthält. In den folgenden Beispielen sehen Sie die Ausrichtung
% und Position des Koordinatensystems für einen Zweipol und einen Dreipol.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3.5,2.6)
\newOptexpDipole{mydipole}
\makeatletter
\def\mydipole@comp{%
  \psaxes[arrows=->](0,0)(0,-1.1)(1.3,1.3)[$x$,90][$y$,0]
}%
\makeatother
\mydipole(0,1)(3.5,1){\color{spot}label}
\drawbeam(0,1){}(3.5,1)
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}
\begin{pspicture}(3.5,3.7)
\newOptexpTripole{mytripole}{labelangle=-60}
\makeatletter
\def\mytripole@comp{%
  \psaxes[arrows=->](0,0)(-1.1,0)(1.3,1.3)[$x$,90][$y$,0]
}%
\makeatother
\mytripole(0,1)(2,1.7)(3,0){\color{spot}label}
\drawbeam(0,1){}(3,0)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Unsere Beispielkomponente und ihre Zeichnung wird also wie
% folgt definiert:
% \fi 
% \ifENGLISH Our example component and its drawing are defined as
% follows:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{testcomp@comp}}]
\begin{pspicture}(3, 2)
\newOptexpDipole{testcomp}
\makeatletter
\def\testcomp@comp{%
  \psframe[fillstyle=solid, fillcolor=black!30](-0.5,-0.5)(-0.3,0.5)
  \psframe(-0.5,-0.5)(0.5,0.5)
}%
\makeatother
\begin{optexp}
\testcomp[position=0.6, labelalign=l](0,1)(3,1){label}
\drawbeam[beaminside=false](0,1){}(3,1)
\end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN Die Positionierung der Komponente und der Beschriftung,
% sowie die Ebenen funktioniert also schon.
% \fi
% \ifENGLISH The positioning of the component and the label, and the
% layering is working already.
% \fi
%
% \ifENGLISH\subsection{Support for raytracing}\fi
% \ifGERMAN\subsection{Unterstützung von Raytracing}\fi
%
% \ifGERMAN Damit die Komponente Raytracing unterstützt, müssen die
% Grenzflächen mit ihren Eigenschaften definiert werden. Die Definition
% der Ebenen werden in einenm Makro \nxLcs{\prm{name}@nodes} definiert,
% damit sie auch in den unterschiedlichen Ebenen verfügbar sind.
%
% Die Definition der Ebenen erfolgt dann über das Makro \Lcs*{newOptexpComp}
%
% \begin{lstlisting}[gobble=2]
% \def\testcomp@nodes{%
%   \newOptexpComp{%
%     % Definition der ersten Grenzflaeche (GF)
%     {-0.5 0} % x- und y-Koordinate der GF-Mitte
%     {0 1}    % Richtungsvektor der GF (x und y)
%     -0.5 0.5 % Grenzen fuer die NA, gesehen als Faktoren des GF-Vektor
%     trans    % Verhalten der GF, kann 'trans', 'refl' oder 'abs' sein
%     {PlainIfc} % Art der GF
%     % Dasselbe fuer die rechte GF, nur die Mitte ist anders
%     {0.5 0} {0 1} -0.5 0.5 trans {PlainIfc}
%     \POE@key@n % Brechungsindex, koennte jede Zahl sein
%   }%
% }%
% \end{lstlisting}
% \fi
% \ifENGLISH To add support for ray-tracing, you must define the
% interface with their properties. The definitions are nested in a macro
% \nxLcs{\prm{name}@nodes} in order to be accessible in the different
% layers.
%
% The definitions are done with the macro \Lcs*{newOptexpComp}
%
% \begin{lstlisting}[gobble=2]
% \def\testcomp@nodes{%
%   \newOptexpComp{%
%     % definition of the first interface (IF)
%     {-0.5 0} % x- and y-coordinate of the IF center
%     {0 1}    % direction vector of the IF (x and y)
%     -0.5 0.5 % limits use for the NA as factor for IF vector.
%     trans    % behavior of the IF, can be 'trans', 'refl' or 'abs'
%     {PlainIfc} % type of IF
%     % the same for the right IF, only the center is different
%     {0.5 0} {0 1} -0.5 0.5 trans {PlainIfc}
%     \POE@key@n % refractive index, could be any number
%   }%
% }%
% \end{lstlisting}
% \fi
%
% \ifENGLISH So, in condensed form, our example component looks like
% this, and the beam is not drawn inside the component any more:
% \fi
% \ifGERMAN Unsere Komponent sieht also folgendermaßen aus, und der
% Strahl verläuft nicht mehr innerhalb der Komponente:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{testcomp@comp, testcomp@nodes}}]
\begin{pspicture}(3, 2)
\newOptexpDipole{testcomp}
\makeatletter
\def\testcomp@comp{%
  \psframe[fillstyle=solid, fillcolor=black!30](-0.5,-0.5)(-0.3,0.5)
  \psframe(-0.5,-0.5)(0.5,0.5)}%
\def\testcomp@nodes{%
  \newOptexpComp{%
    {-0.5 0} {0 1} -0.5 0.5 trans {PlainIfc}
    {0.5 0} {0 1} -0.5 0.5 trans {PlainIfc} \POE@key@n }}%
\makeatother
\begin{optexp}
\testcomp[position=0.6, labelalign=l](0,1)(3,1){label}
\drawbeam[beaminside=false](0,1){}(3,1)
\end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH\subsection{Support for external nodes}\fi
% \ifGERMAN\subsection{Unterstützung von externen Knoten}\fi
%
% \ifGERMAN Damit nun, als letzter Schritt auch externe Knoten mit \Lkeyword{extnode},
% Positionierung an den Anfang oder das Ende mit
% \Lkeyword{position}\opt{=start|end}, oder auch das Setzen eines
% anderen Drehpunktes mit \Lkeyword{rotateref} möglich wird, müssen die
% externen Dimensionen der Komponente bekannt gemacht werden. Dafür muss
% ein weiteres Makro mit dem Name \nxLcs{\prm{name}@ref} definiert
% werden, in dem auf Postscript-Ebene die Werte \opt{@@x} (halbe
% Breite), \opt{@@y} (halbe Höhe), und optional auch \opt{@@x0} und
% \opt{@@y0} (Verschiebung der Mitte) definiert werden müssen.
% \fi
% \ifENGLISH To enable, as last step, support for external nodes with
% \Lkeyword{extnode}, positioning at the start or end with
% \Lkeyword{position}\opt{=start|end}, and setting the rotation
% reference node with \Lkeyword{rotateref}, we need to provide the
% external dimensions of the component. For this we need to define a new
% macro \nxLcs{\prm{name}@ref}, which defines at Postscript level the
% values \opt{@@x} (half width), \opt{@@y} (half height), and optionally
% \opt{@@x0} and \opt{@@y0} (offset of the center). 
% \fi
% \begin{lstlisting}[gobble=2]
% \def\testcomp@ref{%
%   \POE@setref{ /@@x 0.5 def /@@y 0.5 def }%
% }%
% \end{lstlisting}
%
% \ifGERMAN Der Code für unsere Beispielkomponente \nxLcs{testcomp} ist
% damit vollständig, und sieht folgendermaßen aus:
% \fi
% \ifENGLISH This completes the code for our example component
% \nxLcs{testcomp}, which now looks like this:
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]{testcomp@comp, testcomp@nodes, testcomp@ref}}]
\begin{pspicture}(3, 2)
\newOptexpDipole{testcomp}
\makeatletter
\def\testcomp@comp{%
  \psframe[fillstyle=solid, fillcolor=black!30](-0.5,-0.5)(-0.3,0.5)
  \psframe(-0.5,-0.5)(0.5,0.5)}%
\def\testcomp@nodes{%
  \newOptexpComp{%
    {-0.5 0} {0 1} -0.5 0.5 trans {PlainIfc}
    {0.5 0} {0 1} -0.5 0.5 trans {PlainIfc} \POE@key@n }}%
\def\testcomp@ref{%
  \POE@setref{ /@@x 0.5 def /@@y 0.5 def }}%
\makeatother
\begin{optexp}
\testcomp[position=0.6, labelalign=l, extnode=tl](0,1)(3,1){label}
\drawbeam[beaminside=false](0,1){}(3,1)
\psdot(\oenodeExt{})
\end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
%   \subsection{Beispiele für benutzerdefinierte Komponenten}
% \fi
% \ifENGLISH
%   \subsection{Examples of custom components}
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(6,4)
  \newOptexpTripole{raindrop}
  \makeatletter
  \def\raindrop@nodes{%
    \newOptexpComp{%
      {0 -2} { 0 2 } -2 2 trans {CurvedIfc}
      {0 2} {0 -2} -2 2 refl {CurvedIfc}
      {0 -2} { 0 2 } -2 2 trans {CurvedIfc}
      \POE@key@n }}%
  \def\raindrop@comp{\pscircle(0,0){2}}%
  \raindrop(0,4)(4,2)(0,0)
  \psset{beamalign=abs, arrows=->, arrowscale=2}
  \drawbeam[linecolor=red](0,3){}(0,1)
  \drawbeam[n=*n*1.05, linecolor=blue](0,3){}(0,1)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifGERMAN
%   \chapter{Beispiele}
% \fi
% \ifENGLISH
%   \chapter{Examples}
% \fi
% \label{sec:examples}
% \iffalse
%<*ignore>
% \fi
\enlargethispage{1.5cm}
\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(0.1,0.4)(10,4.5)
  \psset[optexp]{lens=1 1 0.7, loadbeampoints}
  \pnodes(2,4){L}([Xnodesep=4]L){M}([Xnodesep=1.5]M){IRSpec}([offset=-2.5]M){OSA}
  \begin{optexp}
  \optbox[position=start, innerlabel, optboxwidth=1.8](L)(M){fs laser}
  \lens[abspos=1](L)(M)
  \optbox[abspos=1.85, optboxsize=0.7 0.15, fillstyle=solid, fillcolor=black](L)(M){sample}
  \lens[abspos=2.7](L)(M)
  \mirror[labelangle=45](L)(M)(OSA){flip mirror}
  \optbox[position=end, optboxsize=3.2 1, innerlabel, compshift=-0.2](M)(IRSpec){IR spectrometer}
  \lens[abspos=1](M)(OSA)
  \optplane[angle=90]([offset=-1.5]M)
  \optfiber[fiberloopradius=0.2, label=1, newFiber={linewidth=1.5\pslinewidth}]([offset=-1.5]M)(OSA){MM fiber}
  \optbox[position=end, innerlabel, optboxwidth=1.1](M)(OSA){OSA}
  \newpsstyle{Beam}{linestyle=none, fillcolor=red, fillstyle=solid, raytrace=false}
  \drawwidebeam[beamwidth=0.2, stopinside]{1-2}
  \drawwidebeam[beamdiv=-25]{2-3}
  \drawwidebeam[loadbeampoints=false, beamdiv=25]{3-4}
  \drawwidebeam[startinside]{4-5}
  \drawwidebeam[savebeampoints=false, beamalign=abs]{5-6}
  \drawwidebeam[stopinside]{5}{7}
  \drawwidebeam[beamdiv=-25]{7-8}
\end{optexp}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(-4.2,-1)(3,3)
\pnodes(-2,0){LOut}(0,0){Grat}(4;45){Out}(2.5;70){Mvar}
\newpsstyle{Beam}{linewidth=2\pslinewidth, linecolor=red!90!black}
\begin{optexp}
  \optbox[optboxwidth=2.2, labeloffset=0, position=start](LOut)(Grat){diode laser}
  \mirror[variable, label=0.5](Grat)(Mvar)(Grat){M$_\mathrm{var}$}
  \optretplate[position=0.3](LOut)(Grat){$\nicefrac{\lambda}{4}$}
  \optgrating(LOut)(Grat)(Out){grating}
  \drawbeam[arrows=->]{1}{3}{4}(Out)
  \drawbeam{2}{4}
\end{optexp}
\rput[l](-3,2){Littman setup}
\end{pspicture}
\end{LTXexample}
\bigskip

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(8.5,1.9)
\pnodes(1.4,1.3){Laser}(7.6,1.3){Diode}
\optbox[position=start, labeloffset=0](Laser)(Diode){Laser}%
\optbox[abspos=4, optboxsize=1 0.6, labeloffset=1, n=3,
        compname=PC, angle=-10, rotateref=l](Laser)(Diode){Photonic Crystal}
\optdetector[dettype=diode](\oenodeOut{PC})(Diode|\oenodeOut{PC}){PD}
\nodexn{(\oenodeIn{PC}) + (2;170)}{Angle1}
\psline[linestyle=dashed](\oenodeIn{PC})(Angle1)
\psarc{<->}(\oenodeIn{PC}){1.3}{330}{30}
\psarc[arcsep=1pt]{<->}(\oenodeIn{PC}){2}{170}{180}
\uput{2.1}[175](\oenodeIn{PC}){\small $\varphi$}
\drawbeam{-}
\end{pspicture}
\end{LTXexample}
\bigskip

\enlargethispage{2cm}
\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(10.4,1.7)
\pnodes(1.2,1){Start}(9.2,1){CCD}
\begin{optexp}
\optbox[position=end, label=0, optboxwidth=1.2](CCD)(Start){Laser}
\optbox[position=end, label=0, optboxwidth=1.2](Start)(CCD){CCD}
\polarization[poltype=perp,abspos=0.5](Start)(CCD)
\optretplate[abspos=1](Start)(CCD){$\nicefrac{\lambda}{2}$}
\lens[lens=0.4 0.4 0.5,abspos=2](Start)(CCD){$L_1$}
\lens[abspos=4](Start)(CCD){$L_2$}
\optplate[abspos=6, platelinewidth=3\pslinewidth](Start)(CCD){SLM}
\optplate[abspos=6.5, labelangle=180](Start)(CCD){PF}
\polarization[abspos=6.7](Start)(CCD)
\lens[abspos=7](Start)(CCD){$L_3$}
\drawbeam[linewidth=2\pslinewidth]{1}{2}
\end{optexp}
\end{pspicture}
\end{LTXexample}
\medskip

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(10.4,1.7)
\pnodes(1.2,1){Start}(9.2,1){CCD}
\begin{optexp}
\optbox[position=start, label=0, optboxwidth=1.2](Start)(CCD){Laser}
\polarization[poltype=perp,abspos=0.5](Start)(CCD)
\optretplate[abspos=1](Start)(CCD){$\nicefrac{\lambda}{2}$}
\lens[lens=0.4 0.4 0.5,abspos=2](Start)(CCD){$L_1$}
\pinhole[phwidth=0.05, abspos=2.35, labelangle=180](Start)(CCD){iris}
\lens[abspos=4](Start)(CCD){$L_2$}
\optplate[abspos=6,platelinewidth=3\pslinewidth](Start)(CCD){SLM}
\optplate[abspos=6.5,labelangle=180](Start)(CCD){PF}
\lens[abspos=7](Start)(CCD){$L_3$}
\optbox[position=end, label=0, optboxwidth=1.2](Start)(CCD){CCD}
\polarization[abspos=6.7, polsize=0.8](Start)(CCD)
\addtopsstyle{Beam}{fillstyle=solid, fillcolor=green!40!white, loadbeampoints}
\drawwidebeam[beamwidth=0.1, stopinside]{1}{4}
\drawwidebeam[beamdiv=-20]{4}{6}
\drawwidebeam[stopinside]{6-9}
\drawwidebeam[beamdiv=-30]{9-10}
\end{optexp}
\end{pspicture}
\end{LTXexample}
\bigskip

\enlargethispage{2.5cm}
\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[pos=t, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\arxivurl{1112.5270v2}}]
\begin{pspicture}(0.3,0.4)(5.5,8.3)
\pnodes(2,7){L}(2,5.8){Pbs}([Xnodesep=1]Pbs){Blk1}(2,2.3){Bs}
\pnodes([Xnodesep=-1]Bs){Blk2}([Xnodesep=3.5]Bs){Out}(2,1.3){Slm}
\begin{optexp}
  \optbox[position=end, innerlabel, optboxsize=1.2 0.6](Pbs)(L){Laser}
  \psset{labelalign=r, mirrortype=extended}
  \newpsstyle{ExtendedMirror}{fillstyle=solid, fillcolor=black}
  \optretplate[position=0.4](L)(Pbs){HWP}
  \beamsplitter[labelangle=-90](L)(Pbs)(Blk1){PBS}
  \mirror[label=. -90 c](Pbs)(Blk1)(Pbs){B}
  \lens[abspos=0.8, lens=0.7 0.7 0.7, n=2](Pbs)(Bs){MO}
  \pinhole[phwidth=0.15, abspos=1.2](Pbs)(Bs){PH}
  \lens[abspos=2.6, lensradius=1.4](Pbs)(Bs){L}
  \psset{labelalign=c}
  \beamsplitter[labelangle=-135](Pbs)(Bs)(Blk2){BS}
  \mirror[labeloffset=0.4](Bs)(Blk2)(Bs){B}
  \lens[abspos=1, lensradius=1.4](Bs)(Out){L}
  \lens[abspos=2.8, lens=0.7 0.7 0.7, n=2](Bs)(Out){L}
  \opttripole(Bs)(Slm)(Bs){%
    \psframe[fillstyle=solid,fillcolor=gray!50](-0.3,0)(0.3,0.2)
    \psline(-0.3,0.1)(-0.5,0.1)(-0.5,0.5)(0.5,0.5)(0.5,0.1)(0.3,0.1)}{SLM}
  \addtopsstyle{Beam}{linestyle=none, fillstyle=solid, fillcolor=green!70!black}
  \drawwidebeam[beamwidth=0.1]{1-4}
  \drawwidebeam[beamwidth=0.1, beaminsidefirst, beaminsidelast]{3}{5-8}
  \psset{savebeampoints=false, loadbeampoints}
  \drawwidebeam{8-11}(Out)\drawwidebeam[beaminsidefirst]{8}{12}
\end{optexp}
\end{pspicture}
\end{LTXexample}
\endgroup

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(6.4,3.2)
\addtopsstyle{Fiber}{linecolor=red}\psset{fiber=none}
\pnodes(2.3,2.3){Lin}([Xnodesep=4.5]Lin){Det}
\optbox[label=0.2, position=start, compname=L, extnode=b](Lin)(Det){%
  \psGauss[yunit=0.03,sigma=0.03]{-0.5}{0.5}}
\optbox[label=0, compname=EAM, extnode=b, abspos=1.5](Lin)(Det){EAM}
\optfiber[labeloffset=0.3, abspos=3.2](Lin)(Det){fibre}
\optdetector(Lin)(Det){OSA}
\pnode([Xnodesep=-0.5,offset=-1]\oenodeExt{L}){Osc}
\elecsynthesizer[wire=none](Osc)(\oenodeExt{EAM}|Osc){10\,GHz}
\optarrowcomp[arrowcompsize=0.8 0.6, arrowscale=1.5](Osc)(\oenodeExt{EAM}|Osc){$\tau$}
\drawfiber{1-4}
\addtopsstyle{Wire}{arrows=->, arrowinset=0, arrowscale=1.5}
\drawwire{5}{6}\psset[optexp]{wireangleB=90}
\drawwire{6}(\oenodeExt{EAM})\drawwire{5}(\oenodeExt{L})
\end{pspicture}
\end{LTXexample}

\enlargethispage{1cm}
\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(0.2,0.6)(8.2,3.5)
\pnodes(2,3){Laser}(2,1){PwMeter}(6,3){CplTop}(6,1){CplBot}
\psset{arrowscale=1.5, arrowinset=0}
\optbox[position=start, optboxsize=1.8 1, labeloffset=0](Laser)([Xnodesep=0.1]Laser){%
  \begin{tabular}{@{}c@{}}Nd:YAG\\[-0.4ex]cw laser\end{tabular}}
\optcoupler[addtoFiberIn1={ArrowInside=->}, addtoFiberIn2={ArrowInside=-<},
            labeloffset=0.4](Laser)(PwMeter)(CplTop)(CplBot){WDM}
\optfiber[addtoFiberOut={ncurv=1, angleB=0}, addtoFiberIn={ncurv=1, angleA=0}, 
          compshift=-1, label=0.2 . l](CplBot)(CplTop){fiber}
\optdetector[dettype=diode]([Xnodesep=0.1]PwMeter)(PwMeter){power meter}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(0.9,0.9)(10.4,6.1)
\psset{arrowscale=1.5, arrowinset=0}
\pnodes(2,5){PC1in}(4,5){PC1out}(6,5){PC2in}(8,5){PC2out}(2,2){CplSig}
\pnodes(5,2){CplIn}(2,1){CplOut}(10,4.5){Pump}(8,2){PumpSig}
\optisolator[compshift=0.8, addtoFiberIn={angleA=180}, 
             addtoFiberOut={angleB=180}, label=0.5 . l]%
             (CplSig)(PC1in){isolator}
\polcontrol[addtoFiberIn={arrows=|-}](PC1in)(PC1out)
\optfiberpolarizer[labeloffset=0.6](PC1out)(PC2in){polarizer}
\polcontrol[addtoFiberOut={arrows=-|}](PC2in)(PC2out)
\wdmsplitter[labeloffset=0.3, coupleralign=bottom, addtoFiberIn={arrows=|-}, 
             addtoFiberOut1={arrows=->}, addtoFiberOut2={arrows=-|}]%
             (CplIn)(CplOut)(CplSig){95/5}
\wdmcoupler[addtoFiberIn1={ArrowInside=->}, addtoFiberIn2={angleA=0}, 
            addtoFiberOut={angleB=0,arrows=-|}, ncurv=0.9, 
            coupleralign=bottom, compshift=0.8](Pump)(PC2out)(PumpSig){pump}
\optbox[position=start, innerlabel, optboxwidth=1.6](Pump)([offset=-0.1]Pump){980~nm}
\optfiber[fiberloops=2, labeloffset=0.4](CplIn)(PumpSig){Er$^+$-doped}
\end{pspicture}
\end{LTXexample}
\bigskip

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(1,1.2)(6.2,5)
\pnodes(1,4){SigIn}(3,4){BS}(3,5){LO}(5,4){Det1}(3,2){Det2}
\begin{optexp}
  \optplane[compname=LO, angle=90](LO)
  \beamsplitter[compname=BS](SigIn)(BS)(Det2)
  \lens[abspos=0.5, compname=L2, n=2.1](Det2)(BS){$L_2$}
  \lens[abspos=0.5, compname=L1, n=2.1](Det1)(BS){$L_1$}
  \psset[optexp]{extnodealign=rel, extnode=r}
  \optdetector[compname=Det1](BS)(Det1){PD1}
  \optdetector[compname=Det2](BS)(Det2){PD2}
  \addtopsstyle{Beam}{beamwidth=0.2, fillstyle=solid, 
                        fillcolor=green, opacity=0.2}
  \drawwidebeam(SigIn){BS}{L2}{Det2}
  \drawwidebeam[beaminsidefirst]{BS}{L1}{Det1}
  \newpsstyle{Beam}{linecolor=red, linestyle=dashed, linewidth=1.5\pslinewidth}
  \drawbeam{LO}{BS}{L1}{Det1}
  \drawbeam[beaminsidefirst]{BS}{L2}{Det2}
\end{optexp}
\cnodeput[framesep=5pt]([Xnodesep=0.5, offset=-0.5]\oenodeExt{Det1}|\oenodeExt{Det2}){M}{\rule{2.5mm}{1pt}}
\psset{arrows=<-, arrowscale=1.5, arrowinset=0}
\nccurve[angleA=90]{M}{\oenodeExt{Det1}}
\nccurve[angleA=180, angleB=-90]{M}{\oenodeExt{Det2}}
\end{pspicture}
\end{LTXexample}
\bigskip

\begin{LTXexample}[pos=t, caption={caption}, label={ex:lclv}]
\begin{pspicture}(-0.2,0)(9,5)
\psset[optexp]{lens=1.2 0 1.2, n=1.72}
\addtopsstyle{Beam}{fillstyle=solid, fillcolor=green, opacity=0.3}
\pnodes(2.4,1){BS1}([offset=3]BS1){M1}([Xnodesep=5.5]M1){PP}(PP|BS1){BS2}
\begin{optexp}
  \optbox[label=0, position=start, optboxwidth=1.6]([Xnodesep=-1]BS1)(BS1){Nd:YAG}
  \beamsplitter[compname=BS](BS2)(BS1)(M1){BS}
  \optdipole[position=0.2, compname=LCLV, optdipolesize=0.28 1](BS1)(BS2){%
    \psframe[fillstyle=solid,fillcolor=black,dimen=outer](-0.14,-0.5)(-0.02,0.5)
    \psframe[fillstyle=solid,fillcolor=gray!50,dimen=outer](-0.02,-0.5)(0.14,0.5)
  }{LCLV}
  \optretplate(BS1)(M1){P}
  \mirror(BS1)(M1)(PP){M}
  \lens[position=0.2](M1)(PP){L}
  \pinhole(M1)(PP)
  \lens[position=0.2](PP)(M1){L}
  \pentaprism(M1)(PP)(BS2){PP}
  \beamsplitter(PP)(BS2)(BS1){BS}
  \doveprism[compname=Dove, position=0.27, n=2.3](BS2)(BS1){Dove}
  \lens[n=2.5](BS2)(BS1){L}
  \drawwidebeam[beamwidth=0.3]{1-3}
  \drawwidebeam[loadbeampoints]{3}{2}{4-}{3}
\end{optexp}
\end{pspicture}
\end{LTXexample}

\enlargethispage{1cm}
\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(0,-0.2)(8.6,5.6)
\pnodes(1.5,5){Laser}(4,5){PBS}(6.5,5){PBS2}(6.5,5.7){piezo}(4,2){BSFwd}
\pnodes(6.5,2){BSBwd}(2,2){BS4f}(2,0.5){M4f3}(8,2){M4f1}(8,0.5){M4f2}(1,2){CCD}
\psset{mirrorwidth=0.6, plateheight=0.7, outerheight=0.7, labeloffset=0.7, labelstyle=\scriptsize, lens=1.2 1.2 0.8, bssize=0.5} 
\optbox[position=start, optboxsize=1.5 0.7, innerlabel]% 
   (Laser)(PBS){\parbox{1.5cm}{\centering Nd:YAG\\ 532\,nm}}
\lens[lensheight=0.5, position=0.2](Laser)(PBS){MO}
\pinhole[position=0.3,labelangle=180](Laser)(PBS){PH}
\lens[position=0.5](Laser)(PBS){L}
\optretplate[position=0.8](Laser)(PBS){$\nicefrac{\lambda}{2}$}
\beamsplitter(Laser)(PBS)(BSFwd){PBS}
\optretplate[position=0.4](PBS)(BSFwd){$\nicefrac{\lambda}{2}$}
\polarization(PBS)(BSFwd)\polarization(PBS2)(BSBwd)
\lens[position=0.8](PBS)(BSFwd){L}
\optretplate(PBS)(PBS2){$\nicefrac{\lambda}{2}$}
\beamsplitter(PBS)(PBS2)(piezo){PBS}
\optretplate[abspos=0.5](PBS2)(piezo){$\nicefrac{\lambda}{4}$}
\mirror[mirrortype=piezo,labelangle=90](PBS2)(piezo)(PBS2){PZ}
\lens[position=0.8,labelangle=180](PBS2)(BSBwd){L}
\crystal[crystalsize=1 0.5, voltage, lamp, fillstyle=solid, fillcolor=yellow!90!black, labeloffset=0.8](BSFwd)(BSBwd){SBN:Ce}
\beamsplitter(PBS)(BSFwd)(BSBwd){BS}
\beamsplitter[labelangle=-90](PBS2)(BSBwd)(BSFwd){BS}
\mirror(BSBwd)(M4f1)(M4f2){M}\mirror(M4f1)(M4f2)(M4f3){M}
\lens[labelangle=180](M4f2)(M4f3){L}\mirror(M4f2)(M4f3)(BS4f){M}
\beamsplitter(M4f3)(BS4f)(CCD){BS}
\optbox[position=end, label=0, optboxwidth=1](BS4f)(CCD){CCD}
\lens[abspos=0.7](BS4f)(BSFwd){L}\lens[abspos=0.7](BSBwd)(M4f1){L}
\addtopsstyle{Beam}{linewidth=2\pslinewidth, linejoin=2}
\drawbeam{1-6}{11-14}{13}{12}{15}{18}{16}{17}{25}{23}{24}
\drawbeam[beaminsidefirst]{6}{7}{10}{17}{16}{18}{26}{19-24}
\end{pspicture}
\end{LTXexample}

\bgroup
\psset{unit=0.9}
\begin{LTXexample}[pos=t, caption={caption}, label=ex:transmission-loop]
\begin{pspicture}(13,5.5)
\psset{optboxwidth=1, labelstyle=\footnotesize, fiber=none}
\pnodes(1,5){LD}([Xnodesep=5.5]LD){CPLin1}([offset=-2]CPLin1){CPLin2}
\pnodes([Xnodesep=2.5]CPLin1){CPLout1}([Xnodesep=2.5]CPLin2){CPLout2}
\pnode([Xnodesep=3]CPLout1){RX}
\optbox[position=start, label=0](LD)(CPLin1){LD}
\optmzm[abspos=0.8](LD)(CPLin1){MZM}
\optamp[abspos=2](LD)(CPLin1){EDFA}
\optfilter[abspos=3](LD)(CPLin1){BPF}
\optswitch[abspos=4](LD)(CPLin1){SW}
\polcontrol[abspos=5, fiber=out](LD)(CPLin1)
\drawfiber{1-6}
\optcoupler[couplertype=none, fiber](CPLin1)(CPLin2)(CPLout1)(CPLout2)
\optamp[abspos=0.8, fiber=in](CPLout1)(RX){EDFA}
\optfilter[abspos=2](CPLout1)(RX){BPF}
\optbox[position=end](CPLout1)(RX){RX}
\drawfiber{8-10}
\pnodes([Xnodesep=-0.5]LD|CPLin2){TL}(RX|TL){TR}([offset=-2.5]TR){BR}(TL|BR){BL}
\optamp[fiber=i](CPLout2)(TR){EDFA}
\optfiber[label=0.3 . t, position=0.85](BL)(BR){SSMF 89.8~km}
\drawfiber[fiberstyle=angle, arm=1.2, linearc=0.5, startnode=N]{11}{12}
\optamp[position=0.3](BR)(BL){EDFA}
\optfilter[position=0.55, labelangle=180](BL)(BR){BPF}
\optfiber[fiberloops=1, label=0.3 . t, position=0.35](BL)(BR){DCF 16.2~km}
\optamp[position=0.85](BR)(BL){EDFA}
\optfilter[position=0.2](TL)(CPLin2){BPF}
\optswitch(TL)(CPLin2){SW}
\polcontrol[position=0.8, fiber=out](TL)(CPLin2)
\drawfiber{12-16}\drawfiber{17-19}
\drawfiber[fiberstyle=angle, arm=0.5, linearc=0.5, stopnode=1]{16}{17}
\end{pspicture}
\end{LTXexample}
\egroup

\enlargethispage{1cm}
\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(12, 4)
  \psset{labeloffset=0.3, fiber=none}
  \pnodes(1.6,2){In}(12, 2){Ref}
  \optplate[linestyle=dashed, plateheight=3, position=1, compname=RefPlane](In)(Ref)
  \addtopsstyle{Beam}{linestyle=none, beamdiv=20, beaminside=false, fillstyle=solid, fillcolor=red, opacity=0.3}
  \multido{\i=1+1, \ii=165+10}{4}{%
    \rput(Ref){\pnode(6;\ii){A\i}}
    \optbox[optboxsize=0.5 0.3, position=end, compname=Box\i, extnode=l](Ref)(A\i)
    \lens[lens=0 -0.6 0.6, abspos=0.5, compname=L\i](A\i)(Ref)
    \lens[lens=1.2 1.2 0.8, abspos=1.1, n=1.65, compname=LC\i](A\i)(Ref)
    \drawwidebeam{Box\i}{L\i}{LC\i}{RefPlane}
  }%
  \optcoupler[abspos=1](In)(In)(Ref)(Ref)
  \wdmsplitter[abspos=2.5, compshift=1](In)(Ref)(Ref)
  \wdmsplitter[abspos=2.5, compshift=-1](In)(Ref)(Ref)
  \optbox[compshift=-1, position=start, label=0](In)(Ref){Laser1}
  \optbox[compshift=1, position=start, label=0](In)(Ref){Laser2}
  \drawfiber{17}{14}{15}{Box1}\drawfiber{15}{Box2}
  \drawfiber{18}{14}{16}{Box3}\drawfiber{16}{Box4}
\end{pspicture}
\end{LTXexample}
\medskip

\begin{LTXexample}[caption={caption}]
\begin{pspicture}(0.5,0)(2.2,4)
  \pnodes(0,1){A}(1,1){BS}(2,1){G}(1,4){B}
  \beamsplitter(G)(BS)(B)  \optgrating(BS)(G)(BS)
  \lens[lens=2 2 1.5, compshift=0.1, n=2.25](BS)(B)
  \pinhole[phwidth=0.05, innerheight=0.05, position=0.8, compshift=0.18](BS)(B)
  \optplane[angle=90](B)
  \addtopsstyle{Beam}{linestyle=none, beamwidth=0.2, fillstyle=solid}
  \drawwidebeam[fillcolor=red!25!white](A){1-2}{1}{3-5}
  \drawwidebeam[fillcolor=red!50!white, beamangle=-5]{2}{1}{3-5}
\end{pspicture}
\end{LTXexample}

\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[pos=t, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\href{http://de.wikipedia.org/w/index.php?title=Datei:Czerny-turner.png}{Wikipedia}}, label={ex:czerny-turner}]
\begin{pspicture}(0,-1)(8.5,4)
\psframe[fillstyle=solid,fillcolor=gray!90,linestyle=none](0,-1)(8.5,4)
\addtopsstyle{OptComp}{linecolor=white}
\newpsstyle{Beam}{ArrowInside=->, linejoin=2, arrowscale=1.3, arrowinset=0}
\addtopsstyle{ExtendedMirror}{hatchcolor=white, hatchsep=0.5\pslinewidth}
\pnodes(0,3){A}(8,3){B}(3,1.5){C}(8,0){D}(0,0){E}%
\psset{linewidth=1.5\pslinewidth, mirrorradius=13,  mirrorwidth=1.5, gratingwidth=1.3, mirrortype=extended, phwidth=0.1, outerheight=1.5}%
\begin{optexp}
  \pinhole[position=0.2](A)(B)%
  \mirror(A)(B)(C)
  \optgrating[reverse, angle=15, variable](B)(C)(D)
  \mirror(C)(D)(E)
  \pinhole[position=0.8](D)(E)
  \drawwidebeam[ArrowInsidePos=0.3, beamwidth=0.2, linecolor=white, beamdiv=-7.15](A){1-3}
  \psset{loadbeampoints, savebeampoints=false}%
  \drawwidebeam[ArrowInsidePos=0.6, beamangle=3, linecolor=blue!60!white]{3-5}(E)
  \drawwidebeam[ArrowInsidePos=0.7, linecolor=green!60!white, arrows=->, ArrowInsideMinLength=2]{3-5}(E)
  \drawwidebeam[ArrowInsidePos=0.8, beamangle=-3, linecolor=red!60!white]{3-5}(E)
\end{optexp}
\end{pspicture}
\end{LTXexample}
\endgroup

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(0,0.7)(9.4,3.3)
  \psset[optexp]{couplertype=rectangle, fiber=none, detsize=0.5 0.6}
  \multido{\i=1+1}{3}{%
    \optbox[optboxsize=1.5 0.6, innerlabel,position=start](1.5,\i)(7,\i){Laser \i}
    \wdmsplitter[position=0.2](1.5,\i)(7,\i)(7,\i)
    \wdmcoupler[position=0.8](1.5,\i)(1.5,\i)(7,\i)
    \optdetector[label=0.4 90 l](1.5,\i)(7,\i){Detector \i}
  }%
  \drawfiber[linecolor=blue, startnode=N]{1}{2}{7}
  \drawfiber[linecolor=blue]{2}{11}
  \drawfiber[linecolor=green, stopnode=1]{5}{6}{11}
  \drawfiber[linecolor=green, stopnode=2]{6}{3}
  \drawfiber[linecolor=red]{9}{10}{3}
  \drawfiber[linecolor=red, startnode=2]{10}{7}
  \drawfiber[linecolor=cyan]{11}{12}
  \drawfiber[linecolor=magenta]{7}{8}
  \drawfiber[linecolor=yellow]{3}{4}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[caption={caption}]
\psset{unit=1.5}
\begin{pspicture}(0,1)(2.2,4.2)
  \pnodes(0,2){In}(1,2){G}(1,4){M1}(2,2){M2}(1,1){S}
  \mirror[mirrortype=semitrans](In)(G)(M1)
  \optbox[optboxwidth=0.15, angle=45, style=SemitransMirror](G)(M1)
  \mirror[mirrortype=extended](G)(M1)(G)
  \mirror[mirrortype=extended](G)(M2)(G)
  \optplate[position=end](G)(S)
  \newpsstyle{Beam}{linecolor=red, ArrowInside=->, ArrowInsidePos=0.4, arrowscale=1.5}
  \drawbeam(In){1}{4}{1}{5}
  \drawbeam(In){1-3}{2}{1}{5}
\end{pspicture}
\end{LTXexample}

\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[vsep=10mm, pos=t, caption={\ifENGLISH Adapted from \fi\ifGERMAN Angepasst von \fi\href{http://www.semibyte.de/wp/graphicslibrary/gl-physics/versuchsaufbauten-f-praktikum/}{semibyte.de}}]
\begin{pspicture}(13.6,2.6)
  \psset[optexp]{labeloffset=1, mirrorwidth=0.5, optboxwidth=2}
  \pnodes(2,1){Laser}(12,2){Film}(Film|Laser){Ref}
  \begin{optexp}
    \optbox[position=start](Laser)(Ref){HeNe-Laser}
    \pinhole[abspos=0.8](Laser)(Ref){Blende}
    \optbox[abspos=2.5](Laser)(Ref){Raumfilter}
    \lens[fillstyle=solid, fillcolor={[rgb]{0.87,0.91,0.93}}](Laser)(Ref){Linse}
    \mirror[label=1 30]([offset=0.2]Laser)([offset=0.2]Ref)(Film){%
      \begin{tabular}{c}Spiegel\\(fest)\end{tabular}}
    \opttripole[label=0.4](Ref)(Film)(Ref){%
      \psframe(0.5,1\pslinewidth)(-0.5,5\pslinewidth)
      \psline[linewidth=2\pslinewidth](0.5,0)(-0.5,0)
    }{Film}
    \newpsstyle{Beam}{linewidth=2\pslinewidth, linecolor=red!90!black, beamalign=absolute}
    \drawbeam{1-4}
    \drawbeam[beampos=0.2]{4-6}
    \mirror[variable, label=0.8 -30]([offset=-0.2]Laser)([offset=-0.2, Xnodesep=-0.7]Ref)(Film){var. Spiegel}
    \drawbeam[beampos=-0.2]{4}{7}{6}
  \end{optexp}
\end{pspicture}
\end{LTXexample}
\endgroup

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(0,0.2)(6.6,3.1)
  \psset{mirrorwidth=0.6, useNA=false, beaminsidefirst}
  \pnodes(0,2){In}(1,2){BS}(1,0.5){M1}(2,1){M2}(6,1.5){Det}
  \mirror[mirrortype=semitrans, n=1](In)(BS)(M1)
  \mirror[label=0.6 180 . absolute, compname=M](BS)(M1)(M2|M1)
  \mirror(M1)(M2|M1)(M2)
  \mirror(M2|M1)(M2)([Xnodesep=1]M2)
  \optbox[optboxsize=2 1, abspos=2, label=0, allowbeaminside=false](BS)([offset=0.5]Det){%
    \parbox{1.6\psxunit}{spectral\\filter ($\Omega$)}}
  \lens[lens=4 4 2, n=3.3]([Xnodesep=-3]Det)(Det)
  \optbox[optboxsize=0.2 0.6, n=1, label=-1.2](\oenodeOut{6})(Det){%
    \begin{tabular}{@{}c@{}}nonlinear\\ crystal\end{tabular}}
  \optplate[linestyle=none](\oenodeOut{7})(Det)
  \optdetector[detsize=0.6 0.6, fillstyle=solid, fillcolor=blue](\oenodeOut{6})(Det)
  \newpsstyle{Beam}{linewidth=1.5\pslinewidth}
  \drawbeam[linecolor=blue]{7-9}
  \addtopsstyle{Beam}{linecolor=red}
  \drawbeam(In){1-4}{6-8}
  \drawbeam{1}{5-8}
  \rput[r](\oenodeLabel{M}){$\tau$
    \psline[arrows=<->, arrowinset=0](0.15,0.25)(0.15,-0.15)}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t, caption={caption}, label={ex:glan-thompson}]
\begin{pspicture}(-1,-0.5)(8,1.5)
  \newpsobject{perppol}{polarization}{poltype=perp, linecolor=green, polsize=1}
  \newpsobject{parpol}{polarization}{poltype=parallel, linecolor=red, polsize=0.8}
  \newpsstyle{Polarization}{arrowinset=0, arrowscale=1.2}
  \pnodes(0,1){A}(8,1){B}(4,-0.5){C}
  \glanthompson[glanthompsongap=0.2, glanthompsonsize=2 1](A)(B)
  \optplane(B)\optplane[angle=90](C)
  \drawbeam(A){1-2}
  \drawbeam[linestyle=dashed, dash=2pt 2pt, linecolor=red, arrows=->](A){1}{3}
  \parpol[abspos=1](A)(B)\perppol[abspos=1](A)(B)
  \nodexn{(\oenodeBeam{})-1.5(!\oeBeamVec{})}{D}
  \perppol[abspos=7](A)(B)\parpol(D)(\oenodeBeam{})
\end{pspicture}
\end{LTXexample}
\enlargethispage{1.5cm}
\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(13.7,2.9)
\newpsstyle{Wire}{arm=0.1, arrows=->}
\psset[optexp]{optboxsize=1.2 0.8, optmzmsize=1.2 0.8, fiber=none, label=0.7}
\pnodes(2,1){L}([Xnodesep=11]L){A}
\optbox[position=start, optboxwidth=2, label=0](L)(A){DFB-Laser}
\optbox[abspos=1, label=0, compname=Eam, extnode=t](L)(A){EAM}
\optmzm[abspos=4.5, compname=Mzm1, extnode=t](L)(A){MZM}
\optmzm[abspos=6, compname=Mzm2, extnode=t](L)(A){MZM}
\optamp[abspos=9](L)(A){EDFA}
\drawfiber{1-5}\drawfiber[arrows=->]{}(A)
\pnode([offset=1.5]\oenodeExt{Eam}){Osci}
\elecsynthesizer[compname=Syn, position=0.5, wire=o, label=0.5 . r](Osci)(\oenodeExt{Eam}){10\,GHz}
\psset[optexp]{label=0, wire, optboxsize=0.8 1.2}
\optbox[compname=Ppg1](\oenodeExt{Mzm1}|Osci)(\oenodeExt{Mzm1}){PPG}
\optbox[compname=Ppg2](\oenodeExt{Mzm2}|Osci)(\oenodeExt{Mzm2}){PPG}
\drawwire[arrows=-, wireangleB=-90]{Syn}(\oenodeExt{Mzm2}|Osci)
\rput([offset=0.5, Xnodesep=-0.3]A){Faserschleife}
\end{pspicture}
\end{LTXexample}

\enlargethispage{110pt}
\begingroup
\captionsetup[lstlisting]{format=poecaption}%
\begin{LTXexample}[pos=t, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\doiurl{10.1364/OL.37.000930}}]
\begin{pspicture}(0,0.2)(13.5,4.7)
\psset[optexp]{optboxsize=1 0.8, label=0, fiber=none}
\pnodes(1,3.2){Scan}\pnode([offset=-1.6]Scan){Sat}
\pnode([Xnodesep=5]Scan){ScanCpl}\pnode(ScanCpl|Sat){SatCpl}
\pnode([Xnodesep=1.5,offset=-0.8]ScanCpl){Cpl}\pnode([Xnodesep=5]Cpl){PD}
\pnode([Xnodesep=2.5, offset=-1.4]Cpl){Pump}
\optbox[position=start](Scan)(ScanCpl){Scan}
\optmzm[abspos=1, compname=M1, extnode=t](Scan)(ScanCpl)
\optmzm[abspos=2.5, compname=M2, extnode=t](Scan)(ScanCpl)
\optamp[abspos=3.7](Scan)(ScanCpl)
\polcontrol[abspos=4.5, fiber=o](Scan)(ScanCpl)
\drawfiber{1-5}
\optbox[position=start, compname=S, extnode=b](Sat)(SatCpl){Sat}
\optmzm[abspos=1.75, compname=M3, extnode=b](Sat)(SatCpl)
\optamp[abspos=3.7](Sat)(SatCpl)
\polcontrol[abspos=4.5, fiber=o](Sat)(SatCpl)
\drawfiber{6-9}
\wdmcoupler[fiber=i](ScanCpl)(SatCpl)(Cpl)
\optisolator[position=0.1](Cpl)(Pump|Cpl)
\optfiber[position=0.6](Cpl)(Pump|Cpl)
\addtopsstyle{OptCircArrow}{arrows=<-}
\optcirculator[optcircangle=0 -90](Cpl)(PD)(Pump)
\wdmsplitter[position=0.8, coupleralign=t](Cpl)(PD)
\optbox[position=end, compname=Pd, extnode=t](Cpl)(PD){PD}
\optbox[position=end, compshift=-1.5](Cpl)(PD){OSA}
\optamp[fiber](Pump)(\oenodeIfc{2}{13})
\optbox[position=start, optboxsize=0.6 1.2](Pump)(Pump|Cpl){Pump}
\drawfiber{10-15}\drawfiber{14}{16}
\optbox[compshift=0.7, optboxsize=2.5 0.8](\oenodeExt{M2})(\oenodeExt{Pd}|\oenodeExt{M2}){Lock-In Amp}
\addtopsstyle{Wire}{arm=0.1}
\drawwire[wireangleA=90, linearc=0.3](\oenodeExt{M2}){}
\drawwire[wireangleB=90, linearc=0.3]{}(\oenodeExt{Pd})
\elecsynthesizer([offset=0.2]\oenodeExt{M1})(\oenodeExt{M1})
\psset[optexp]{synthshape=rectangle}
\elecsynthesizer[synthtype=sawtooth](\oenodeExt{S}|Pump)(\oenodeExt{S})
\elecsynthesizer[synthtype=triangle](\oenodeExt{M3}|Pump)(\oenodeExt{M3})
\end{pspicture}
\end{LTXexample}
\endgroup

\enlargethispage{100pt}
\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[pos=t, caption={\ifENGLISH Adapted from \fi\ifGERMAN Angepasst von \fi\href{http://www.semibyte.de/wp/graphicslibrary/gl-physics/versuchsaufbauten-f-praktikum/}{semibyte.de}}, label={ex:absspektr}]
\begin{pspicture}(0.2,0.5)(9,7.4)
  \pnode(1,2){DL}\pnode([offset=0.5]DL){OAP}\pnode([Xnodesep=2]OAP){ST}
  \pnode([offset=-1.4]ST){SP4}\pnode([Xnodesep=4]SP4){SP3}
  \pnode([offset=3]SP3){JL}\pnode([Xnodesep=1]SP3|ST){SP1}
  \pnode([Xnodesep=1]ST|JL){SP2}\pnode([Xnodesep=1.5,offset=3]SP2){Det}
  \psset[optexp]{optboxsize=1.5 0.9, labeloffset=0.6}
  \begin{optexp}
    \optbox[position=start, innerlabel](DL)(OAP){\parbox{1.5\psunit}{\centering Dioden-\\laser}}
    \psset[optexp]{mirrortype=extended}
    \mirror[mirrorradius=2](DL)(OAP)(ST){OAP}
    \psset[optexp]{variable}
    \beamsplitter[bssize=0.4, labelangle=-45](SP4)(ST)(SP1){ST}
    \optplate[abspos=1, plateheight=0.7](ST)(SP1){CP}
    \mirror(ST)(SP1)(SP2){SP1}\mirror(SP1)(SP2)(Det){SP2}
    \optdipole[label=-0.7 . b relative, optdipolesize=2, position=0.6](SP2)(Det){%
      \psframe[dimen=outer](-1,-0.6)(1,0.6)
      \psset{fillstyle=solid, fillcolor=blue!40, linestyle=none}
      \psframe(-1,-0.5)(-0.9,0.5)\psframe(0.9,-0.5)(1,0.5)}{Plasmareaktor}
    \optdetector[label=. 30 l](SP2)(Det){Detektor}
    \optbox[position=end, innerlabel](SP3)(JL){\parbox{1.5\psunit}{\centering Justage-\\laser}}
    \mirror(SP4)(SP3)(JL){SP3}\mirror(ST)(SP4)(SP3){SP4}
    \psset{linewidth=2\pslinewidth}
    \drawbeam[linecolor=blue, beampos=0.03]{1-2}
    \drawbeam[beamalign=abs, loadbeampoints, linecolor=blue]{2-8}
    \drawbeam[linecolor=red, beampos=-0.03]{9-11}{3-8}
  \end{optexp}
  \pnode([Xnodesep=1.2,offset=-0.6]\oenodeIn{8}){NaCl}
  \psset{linestyle=dashed, arrows=->, arrowscale=1.5}
  \ncline[nodesepA=0.1, nodesepB=0.2]{NaCl}{\oenodeIn{7}}
  \ncline[nodesepA=0.1, nodesepB=0.3]{NaCl}{\oenodeOut{7}}
  \rput[l](NaCl){NaCl-Fenster}
\end{pspicture}
\end{LTXexample}
\endgroup

\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[pos=t, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\doiurl{10.1364/AOP.1.000308}, \ifGERMAN Abb. \fi\ifENGLISH Fig. \fi 8}, label={ex:autocorrelation}]
\begin{pspicture}(5.7,2.8)
\psset{mirrorwidth=0.7, bsstyle=plate, bssize=0.5, arrowinset=0, arrowscale=1.2}
\newpsobject{splitterplate}{beamsplitter}{linewidth=2\pslinewidth, linecolor=gray!50}
\pnodes(2.3,0){In}([offset=0.5]In){STM1}([Xnodesep=-2]STM1){M1}
\pnodes([offset=1]M1){M2}([offset=2]STM1){M3}([Xnodesep=-1]M3){M4}(M4|M2){STM2}
\splitterplate(In)(STM1)(M1)
\mirror(STM1)(M1)(M2)
\mirror(M1)(M2)(M3|M2)
\mirror(STM1)(M3)(M4)
\mirror[label=0.6 180 . absolute](M3)(M4)(STM2)
\rput[r](\oenodeLabel{}){$\tau$
  \psline[arrows=<->](0.15, 0.4)(0.15, -0.2)}
\splitterplate[compoffset=0.2, compname=STM2](M4)(STM2)([Xnodesep=1]STM2)
\pnode(\oenodeCenter{STM2}){STM2C}
\pnode([Xnodesep=4]STM2C){Out}
\lens[n=2](STM2C)(Out)
\optbox[position=0.65, optboxsize=0.1 0.6](STM2C)(Out)
\optplate[linestyle=none, position=0.75](STM2C)(Out)
\pinhole[position=0.95, outerheight=0.6](STM2C)(Out)
\optdetector[detsize=0.5 0.6](STM2C)(Out)
\drawbeam[linecolor=blue]{8-}
\newpsstyle{Beam}{ArrowInside=->, linecolor=red, ArrowInsideMinLength=1, arrows=>-}
\drawbeam[ArrowInsidePos=0.835](In){1-3}{7-9}
\drawbeam[ArrowInsidePos=0.74](In){1}{4-9}
\end{pspicture}
\end{LTXexample}
\endgroup

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(13.8,3.8)
  \pnode(2.3,2){Signal}
  \pnode([Xnodesep=1.5,offset=0.8]Signal){UpIn}
  \pnode([Xnodesep=1.5, offset=-0.8]Signal){LowIn}
  \pnode([Xnodesep=3.5]UpIn){UpOut}
  \pnode(UpOut|LowIn){LowOut}
  \pnode([Xnodesep=1.5]UpOut){UpIn2}
  \pnode([Xnodesep=3]UpIn2){UpOut2}
  \pnode([Xnodesep=1.5]LowOut){LowIn2}
  \pnode(UpOut2|LowIn2){LowOut2}
  \psset{labelstyle=\footnotesize}
  \psset{fiber=none}\addtopsstyle{Fiber}{linecolor=red}
  \psset{wire=none}\addtopsstyle{Wire}{arm=0.1, arrows=->}
  \optbox[position=start, label=0, optboxsize=2.3 0.8](Signal)([Xnodesep=0.1]Signal){2.5\,ps, 10\,GHz}
  \wdmsplitter[label=0.4](Signal)(UpIn)(LowIn){50\%}
  \optfiber[fiberloops=4, label=0.4, position=0.3](LowIn)(LowOut){L$_2$}
  \optswitch[position=0.7](LowIn)(LowOut){AOM}
  \optfiber[fiberloops=2, label=0.4, position=0.2](UpIn)(UpOut){L$_1$}
  \optswitch[position=0.7](UpIn)(UpOut)
  \optcoupler[label=0.4, position=0.3](UpOut)(LowOut)(UpIn2)(LowIn2){50\%}
  \optbox[optboxsize=2 0.8, position=end, label=0, extnode=t](LowIn2)(LowOut2){Messsystem}
  \drawfiber{1-4}{7}(LowIn2)\drawfiber[arrows=->](LowIn2){8}
  \optdetector[abspos=0.4, detsize=0.6 0.8](UpIn2)(UpOut2){PD}
  \optbox[optboxsize=0.8 0.8, label=0, position=0.44](UpIn2)(UpOut2){$\div 8$}
  \optamp[position=0.8](UpIn2)(UpOut2)
  \optbox[position=end, extnode=b, label=0, optboxsize=2 0.8](UpIn2)(UpOut2){Faserkamm}
  \drawfiber{2}{5-7}(UpIn2)\drawfiber[arrows=->](UpIn2){9}
  \drawwire{9-12}
  \drawfiber[arrows=->](\oenodeExt{12})(\oenodeExt{8})
\end{pspicture}
\end{LTXexample}

\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[pos=t, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\doiurl{10.1103/PhysRevLett.105.263904}}, label={ex:wgm-pdc}]
\begin{pspicture}(0.6,2.8)(6.8,7.8)
\pnodes(1,6){Laser}(1,5){M}(3,4){PR}(5,5){PT}(6,7){D1}
\newpsstyle{Glass}{fillcolor=blue, fillstyle=solid, opacity=0.15, linecolor=blue!30!white}
\begin{optexp}
  \optbox[position=start, innerlabel, optboxwidth=1.8](Laser)(M){Nd:YAG}
  \optprism[style=Glass, compname=P, n=1, prismtype=reflective, prismangle=60, labeloffset=1.2](M)(PR)(PT){\begin{tabular}{@{}c@{}}diamond\\ prism\end{tabular}}
  \mirror(Laser)(M)(\oenodeIfc{2}{P})%
  \lens[abspos=1.05, style=Glass](\oenodeIfc{2}{P})(M)%
  \optprism[compname=PDet, style=Glass](\oenodeIfc{2}{P})(PT)(D1)%
  \lens[abspos=1.05, style=Glass](\oenodeIfc{2}{P})(\oenodeOut{PDet})%
  \newpsstyle{Beam}{linestyle=none, fillstyle=solid}%
  \drawwidebeam[fillcolor=green, beamwidth=0.2, beaminsidelast, beampathcount=5]{1}{3}{4}{2}%
  \drawwidebeam[fillcolor=orange, beaminsidefirst, startinsidecount=1, loadbeam, beaminsidelast]{2}{6}%
  \psset{savebeam=false, loadbeam, beamnodealign=vector}%
  \drawwidebeam[fillcolor=orange]{6}{5}%
  \drawwidebeam[fillcolor=green, n=1.2, beampathskip=1, savebeam=2]{6}{5}(D1)
  \drawwidebeam[fillcolor=red, beampathskip=1, n=1.4, savebeam=3]{6}{5}(D1)
  \drawwidebeam[fillcolor=red!50!black, beampathskip=1, n=1.57, savebeam=4]{6}{5}(D1)
  \multido{\i=2+1}{3}{%
    \backlayer{%
      \pnode(!\oeBeamCenter{\i}){Det\i}
      \nodexn{(Det\i)-(!\oeBeamVecMedian{\i})}{Det\i'}}
    \optdetector[detsize=0.6 0.5](Det\i')(Det\i)}
\end{optexp}
\pscircle[style=Glass]([offset=-0.5]\oenodeIfc{2}{P}){0.5}
\rput[l]([offset=-0.5,Xnodesep=0.7]\oenodeIfc{2}{P}){WGM}
\end{pspicture}
\end{LTXexample}
\endgroup

\begin{LTXexample}[caption={caption}]
\begin{pspicture}(2.2,2.2)
\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}%
\pnode(0,0.5){In}\pnode(2,0.5){G1}
\pnode([Xnodesep=-1.5, offset=1.3]G1){G2}\pnode(G1|G2){MG}
\begin{optexp}
  \optgrating[angle=40, gratingalign=c](In)(G1)(G2)
  \optgrating[reverse, angle=40, gratingalign=c](G1)(G2)(MG)
  \mirror[mirrorwidth=1, mirrortype=extended](G2)(MG)(G2)
  \drawbeam[linecolor=red](In){1}
  \multido{\i=0+1}{40}{%
    \pstVerb{\i\space 650 400 sub 39 div mul 400 add 
             tx@addDict begin wavelengthToRGB end }%
    \drawbeam[linecolor=bl, beamangle=\i\space 16 sub 0.2 mul]{1-2}%
    \drawbeam[linecolor=bl, loadbeampoints]{2-3}
  }%
\end{optexp}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(5.6,3)
\pnodes(0,0.5){S1}(2,2.5){S2}(3,1.5){S3}(4,0.5){S4}(4.5,1){S5}
\psset{prismangle=30, mirrortype=extended}
\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}%
\begin{optexp}
  \optprism(S1)(S2)(S3)\optprism(S3)(S4)(S5)
  \mirror[compshift=-0.07](\oenodeIn{2})([offset=1,Xnodesep=1]\oenodeIn{2})(\oenodeIn{2})
  \drawbeam[linecolor=orange, ArrowInside=->, ArrowInsidePos=0.2, arrowscale=1.5](S1){1}
  \addtopsstyle{Beam}{linecolor=bl, linewidth=0.35\pslinewidth, beampathskip=1}
  \multido{\r=0+0.5}{120}{%
    \pstVerb{\r\space 620 590 sub 59 div mul 590 add 
             tx@addDict begin wavelengthToRGB end }%
    \drawbeam[n=3.42 -0.002 \r\space mul add, beampos=\r\space 60 sub 0.0002 mul](S1){1-3}
  }%
\end{optexp}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t, caption={caption}, label=ex:dsotm]
\begin{pspicture}(3,1.7)
\pnodes(-1,0){A}(1,1){B}(3,0){C}
\psframe*(0,0)(3,1.7)
\begin{optexp}
  \optplane(0,0.7)
  \optprism[prismalign=center, linecolor=white](A)(B)(C)
  \optplane(C)
  \addtopsstyle{Beam}{linecolor=white}
  \drawbeam[ArrowInside=->]{1-2}
  \definecolor[ps]{bl}{rgb}{%
    tx@addDict begin Red Green Blue end}%
  \addtopsstyle{Beam}{linestyle=fade, beaminsidelast, fadeto=black}
  \multido{\i=0+1}{60}{%
    \drawbeam[n=1.5 \i\space 0.003 mul add, linecolor=white, beampathskip=1, fadefuncname=gauss]{1-2}
    \pstVerb{\i\space 650 400 sub 59 div mul 400 add 
      tx@addDict begin wavelengthToRGB end }%
    \drawbeam[n=1.5 \i\space 0.003 mul add, linecolor=bl, beampathskip=2, linewidth=0.3\pslinewidth]{-}%
  }%
\end{optexp}   
\end{pspicture}  
\end{LTXexample}

\begin{LTXexample}[pos=t, caption={\ifENGLISH Adapted from \fi\ifGERMAN Angepasst von \fi\href{https://tex.stackexchange.com/q/581952}}, label=ex:multi-input-coupler]
\begin{pspicture}(10,6)
  \begin{optexp}
    \psset[optexp]{usefiberstyle, couplersize=0.25, couplersep=0.07}
    \newpsstyle{Fiber}{linecolor=orange, linewidth=2\pslinewidth}
    \pnodes(2,1){PumpDiode}(2,5){UpperPumpDiode}(1,3){SignalIsolatorIn}(4, 3){SignalIsolatorOut}(1,3){SignalIn}(10,3){SignalCombinerOut}
    \pnodes(7,3){FiberIn}(9,3){FiberOut}(9,3){AmpOut}
    \optdiode[compname=PumpDiode, position=start](PumpDiode)([Xnodesep=1]PumpDiode){Pump diode}
    \optdiode[compname=UpperPumpDiode, position=start](UpperPumpDiode)([Xnodesep=1]UpperPumpDiode){Pump diode}
    \optisolator[compname=SignalIsolator, fiber=none](SignalIsolatorIn)(SignalIsolatorOut)%
        {\begin{tabular}{@{}c@{}}Signal\\Isolator\end{tabular}}
    \wdmcoupler[compname=SignalPumpCombiner](UpperPumpDiode)(\oenodeOut{SignalIsolator})(PumpDiode)(FiberIn)%
        {\begin{tabular}{@{}c@{}}Signal/Pump\\light combiner\end{tabular}}
    \optfiber[
        compname=ActiveFiber,
        position=start,
        addtoFiberOut={arrows=->}](FiberIn)(FiberOut)%
        {\begin{tabular}{@{}c@{}}Active\\fiber\end{tabular}}
    \drawfiber[ArrowInside=->](SignalIn){SignalIsolator}
  \end{optexp}
  \nput{75}{AmpOut}{\begin{tabular}{@{}c@{}}Amplifier\\Output\end{tabular}}
  \nput{-90}{SignalIn}{\begin{tabular}{@{}c@{}}Signal\\Input\end{tabular}}         
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t, linerange={1-1}, caption={caption}]

\psset{unit=1.1, usefiberstyle=false}
\begin{pspicture}(9.3,6.1)
  \psset{labeloffset=0.5, optboxsize=1 0.8, arrowscale=1.2, arrowinset=0}
  \newpsstyle{Fiber}{linecolor=red!70!black, linewidth=1.5\pslinewidth}
  \pnode(1, 3.7){LD}\pnode([Xnodesep=3.2]LD){LoopIn}\pnode([offset=-1.2]LoopIn){LoopInsIn}
  \pnode([Xnodesep=2]LoopInsIn){LoopInsOut}\pnode(LoopInsOut|LoopIn){LoopOut}
  \optswitch[compname=LSw, label=. 180 b, abspos=2.7, fiber=o](LD)(LoopIn){load switch}
  \optcoupler[addtoFiber={ArrowInside=->, ArrowInsidePos=0.7}](LoopIn)(LoopInsIn)(LoopOut)(LoopInsOut){50/50}
  \optbox[labelstyle=\footnotesize, position=end, fiber, label=0, optboxsize=1.6 1.2](LoopOut)([Xnodesep=0.1]LoopOut){\parbox{1.4\psxunit}{\centering Linear\\Optical\\Sampling}}%
  \pnode([Xnodesep=2.8]LoopInsOut){TR}
  \pnode([offset=-2]TR){BR}
  \pnode([Xnodesep=-1.5]LoopInsIn){TL}
  \pnode(TL|BR){BL}
  \psset[optexp]{fiber=none}
  \optisolator[isolatorsize=0.5, abspos=0.6](LoopInsOut)(TR){isolator}% 4
  \optbox[label=0, extnode=t, compname=PM, abspos=2](LoopInsOut)(TR){PM}
  \drawfiber(LoopInsOut){4}{5}
  \optfiber[label=0.2 . t, abspos=4](BL)(BR){fiber}
  \drawfiber[fiberstyle=bar, angleA=0, startnode=N, linearc=0.5, armA=0.6]{5}{6}
  \optamp[labelalign=b, abspos=3.8](BR)(BL){EDFA}
  \optfilter[label=. 180 b, usefiberstyle, abspos=1](BL)(BR){OBPF}
  \drawfiber{6-8}
  \optswitch[labelalign=t, abspos=1, fiber=o](TL)(LoopInsIn){unload switch}
  \drawfiber[angleA=180, linearc=0.5, armA=1, startnode=1, fiberstyle=bar]{8}{9}
  \optbox[extnode=t, compname=Mod, innerlabel, abspos=0.7](LD)(LoopIn){MOD}
  \optbox[position=start, innerlabel](LD)(LoopIn){LD}
  \drawfiber{}{Mod}
  \drawfiber[arrows=->]{Mod}{LSw}
  \pnode([offset=1.2, Xnodesep=-0.7]\oenodeExt{Mod}){Osci}\pnode(\oenodeExt{PM}|Osci){Tmp}
  \psset{wire=none, fiber=none, label=0.5 180 b}
  \elecsynthesizer(Osci)(Tmp){SYN}
  \elecsynthesizer[synthshape=rectangle, synthtype=pulse, abspos=0.7, compname=Pg, extnode=b](Osci)(Tmp){PG}
  \optfilter[abspos=2](Osci)(Tmp){BPF}
\rput[r]([offset=0.4, Xnodesep=0.2]\oenodeOut{}){\psplot[plotpoints=200]{0}{1}{360 3.14159 div x 6 mul mul sin 2 exp 0.3 mul 0.15 sub}}
  \drawwire[arm=0]{12-14}\drawwire[wireangleB=-90, arrows=->]{14}(\oenodeExt{PM})
  \psline[style=Wire, arrows=->](\oenodeExt{Pg})(\oenodeExt{Mod})
  \rput([Xnodesep=0.1, offset=0.2]\oenodeOut{Mod}){%
    \psplot[plotpoints=200, unit=0.7]{0}{1}{2.7182818 x 0.5 sub 0.08 div 2 exp neg exp 0.5 mul}%
  }%
\end{pspicture}
\end{LTXexample}

\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[pos=t, linerange={1-1}, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\doiurl{10.1364/OL.37.000797}}, label={ex:ratchet}]

\begin{pspicture}(12.3,8.8)
\newpsobject{laser}{optbox}{position=start, innerlabel}
\psset[optexp]{lens=2, phwidth=0.07, outerheight=0.6}
\pnode(1,7){L}\pnode([offset=-6]L){PSLM}
\pnode([Xnodesep=2,offset=1]L){ASLM}\pnode([offset=-0.5,Xnodesep=9]L){MRef}
\pnode([offset=-7]ASLM){ML}\pnode([Xnodesep=8.5]ML){Cam}
\begin{optexp}
  \laser[optboxsize=1.6 0.6](L)(PSLM){Nd:YAG}
  \beamsplitter[bssize=0.4, labelangle=-90](L)(L|MRef)(MRef){BS}
  \lens[abspos=1.2, lens=0.5 0.5 0.4, n=2.5, labelangle=-10](L)(PSLM){MO}
  \pinhole[abspos=1.4, labelangle=10](L)(PSLM){PH}
  \lens[abspos=2.3](L)(PSLM){L}
  \opttripole[label=0.5](L)(PSLM)(ASLM){\psframe[dimen=outer](-0.5,0)(0.5,0.1)}{PSLM}
  \lens[label=0.6 -40](PSLM)(ASLM){L}
  \opttripole[label=0.5](PSLM)(ASLM)(ML){\psframe[dimen=outer](-0.5,0)(0.5,0.1)}{ASLM}
  \lens[position=0.45, labelangle=180](ASLM)(ML){L}
  \optretplate[labelangle=180, position=0.55](ASLM)(ML){$\lambda/2$}
  \optplate[labelangle=180, position=0.62](ASLM)(ML){P}
  \mirror[labeloffset=0.4](ASLM)(ML)(Cam){M}
  \newpsstyle{Beam}{fillcolor=green!80!black, opacity=0.5, fillstyle=solid, linestyle=none, beaminside=false}
  \drawwidebeam[beamwidth=0.1, stopinside]{1-5}
  \psset{loadbeampoints}
  \drawwidebeam[stopinside, savebeampoints=2]{5-7}
  \drawwidebeam[loadbeampoints=2, beamdiv=-8.5]{7-8}
  \drawwidebeam[loadbeampoints=2, beamdiv=-8.5, beamangle=-4]{7-8}
  \drawwidebeam[beamdiv=-8.5, beamangle=-4.5]{8-9}
  \drawwidebeam[loadbeampoints=2, beamdiv=-8.5, beamangle=4]{7-8}
  \drawwidebeam[beamdiv=-8.5, beamangle=4.5]{8-9}
  \lens[abspos=2](ML)(Cam){L}
  \lens[abspos=4](ML)(Cam){L}
  \crystal[abspos=6, voltage, crystalsize=1 0.6, fillcolor=yellow!90!black, fillstyle=solid](ML)(Cam){SBN}
  \beamsplitter[bssize=0.6](MRef)(MRef|Cam)(Cam){BS}
  \lens[n=2.4](MRef|Cam)(Cam){L}
  \optbox[optboxsize=0.8 0.6, position=end](ML)(Cam){Cam}
  \drawwidebeam[savebeampoints=2, stopinside]{9-13}
  \drawwidebeam[loadbeampoints=2, beamdiv=-16, beamangle=5, stopinside]{13-14}
  \drawwidebeam[beamangle=-5]{14-18}
  \drawwidebeam[loadbeampoints=2, beamdiv=-16, beamangle=-5, stopinside]{13-14}
  \drawwidebeam[beamangle=5]{14-18}
  \lens[lens=0.5 0.5 0.4, n=2](L|MRef)(MRef){MO}
  \pinhole[position=0.53, labelangle=180](L|MRef)(MRef){PH}
  \lens[position=0.65](L|MRef)(MRef){L}
  \optplate[position=0.7](L|MRef)(MRef){S}
  \mirror[labeloffset=0.4](L|MRef)(MRef)(MRef|Cam){M}
  \addtopsstyle{Beam}{fillcolor=red!70}
  \drawwidebeam[loadbeampoints=false, beamwidth=0.1, savebeampoints]{2}{19-21}
  \drawwidebeam{21-23}{16-18}
\end{optexp}
\end{pspicture}
\end{LTXexample}
\endgroup

\begingroup
\captionsetup[lstlisting]{format=poecaption}
\begin{LTXexample}[pos=t, linerange={1-1}, caption={\ifGERMAN Angepasst von \fi\ifENGLISH Adapted from \fi\doiurl{10.1364/AOP.1.000308}, \ifGERMAN Abb. \fi\ifENGLISH Fig. \fi 37}]

\begin{pspicture}(-2,-0.2)(8.3,5.9)
  \scriptsize
  \definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}%
  \addtopsstyle{SemitransMirror}{linestyle=solid, linewidth=0.7\pslinewidth}
  \newpsstyle{ExtendedMirror}{style=SemitransMirror}
  \psset[optexp]{mirrortype=extended, mirrorwidth=0.7, n=1, gratingalign=c}
  \newpsstyle{Beam}{linecolor=red!80!black, linewidth=1.5\pslinewidth, beaminside=false}
  \pnode(-2,0.5){In}\pnode(8,0.5){G1}\pnode([Xnodesep=-1.5, offset=1.3]G1){G2}\pnode(G1|G2){MG}
  \pnode([Xnodesep=1,offset=1]In){M1}
  \pnode([Xnodesep=5]In){M}
  \begin{optexp}
  \mirror[mirrortype=semitrans, mirrorlinewidth=0.7\pslinewidth, label=0.6 -90, compname=Et](In)([Xnodesep=-3]G1)(M1){Etalon}
  \optgrating[angle=40](In)(G1)(G2)
  \optgrating[reverse, angle=40](G1)(G2)(MG)
  \mirror[mirrorwidth=1, label=1 135](G2)(MG)(G2){Stretcher}
  \multido{\i=0+1}{40}{%
    \pstVerb{%
      \i\space 650 400 sub 39 div mul 400 add 
      tx@addDict begin wavelengthToRGB end }%
      \drawbeam[linecolor=bl, beamangle=\i\space 16 sub 0.2 mul]{2-3}%
      \drawbeam[linecolor=bl, loadbeampoints]{3-4}
  }%
  \newpsstyle{Beam}{fillstyle=solid, fillcolor=red!90!black, beamwidth=0.1, linestyle=none}
  \drawwidebeam(In){1-2}
  \pnode([offset=4]M1){M2}\pnode([Xnodesep=3]M2){M3}
  \pnode([offset=0.2,Xnodesep=0.2]M|M1){M4}
  \pnode([Xnodesep=4, offset=4]M){CM}
  \pnode([Xnodesep=-1,offset=-2]M3){SM}
  \pnode([offset=0.5]SM){S}
  \mirror[compname=M1](\oenodeIn{Et})(M1)(M2)
  \mirror(M1)(M2)(M3)
  \mirror(M2)(M3)(M4)
  \mirror[compname=M4, angle=1.5](M3)(M4)(CM)
  \mirror[mirrorradius=3.5 0, angle=2, compname=CM](M4)(CM)(SM)
  \mirror(G1)(M)(CM)
  \optretplate[plateheight=0.5, abspos=1.5, label=0.6](M)(CM){$\lambda/2$}
  \optbox[optboxsize=0.3 0.5, position=0.25, fillstyle=solid, fillcolor=yellow!90!black](CM)(SM){\begin{tabular}{@{}c@{}}nonlinear\\crystal\end{tabular}}
  \pinhole[phwidth=0.1, position=0.35](CM)(SM)
  \lens[lens=0.7 0.7 0.7, position=0.5, n=1.25](CM)(SM)
  \lens[lens=0.7 0.7 0.7, position=0.9, n=1.31](CM)(SM)
  \mirror[compname=SM](CM)(SM)(S)
  \optbox[position=end, optboxsize=0.8 1.9, compshift=0.6, label=0](SM)(S){Spectrometer}
  \drawwidebeam{Et}{5-8}\backlayer{\pnode(\oenodeBeamLow{}){BeamA}}
  \drawwidebeam[loadbeam]{8-9}\backlayer{\pnode(\oenodeBeamUp{}){BeamB}}
  \drawwidebeam[loadbeam]{9}{12-13}
  \drawwidebeam[beamangle=-1.9, beaminsidelast]{10-11}\backlayer{\pnode(\oenodeBeamLow{}){BeamC}}
  \drawwidebeam[loadbeam]{11}{9}\backlayer{\pnode(\oenodeBeamLow{}){BeamD}}
  \drawwidebeam[loadbeam]{9}{12-13}
  \addtopsstyle{Beam}{fillcolor=blue!40}
  \drawwidebeam[beamwidth=0, beamdiv=8, stopinside]{12-14}\backlayer{\pnode(\oenodeBeamUp{}){BeamE}}
  \drawwidebeam[loadbeam]{14-15}\backlayer{\pnode(\oenodeBeamUp{}){BeamF}}
  \drawwidebeam[loadbeam, startinside]{15-17}
  \end{optexp}
  % now put the pulses
  \def\mypulse{\psplot[style=Pulse]{-0.3}{0.3}{2.7182818 x 0.1 div 2 exp neg exp 0.8 mul}}%
  \newpsstyle{Pulse}{linecolor=red!90!black, linewidth=1.5\pslinewidth, plotpoints=200}
  \newpsstyle{Arrow}{arrowinset=0, arrowscale=1.2, linewidth=2\pslinewidth, linecolor=red!90!black}
  \rput([Xnodesep=0.3,offset=0.1]In){%
    \mypulse\psline[arrows=->, style=Arrow](0.3,0.2)(1,0.2)}%
  \rput([Xnodesep=1.5,offset=-0.3]\oenodeCenter{Et}){\psline[arrows=<->, style=Arrow](-0.7,0)(0.7,0)}
  \nlput[nrot=:U](\oenodeIn{M1})(\oenodeIn{Et}){2}{%
    \psline[arrows=->, style=Arrow](-0.3,0.25)(-1,0.25)%
    \rput(0,0.1){\psset{unit=0.7}\mypulse\rput(0.8,0){\mypulse}}}%
  \nlput[nrot=:U](BeamA)(BeamB){1}{%
    \psline[arrows=->, style=Arrow](1,0.25)(1.7,0.25)%
    \rput(0,0.05){\psset{unit=0.7}\mypulse\rput(0.8,0){\mypulse}}}%
  \nlput[nrot=:U](BeamD)(BeamC){2}{%
    \psline[arrows=->, style=Arrow](-1,0.25)(-1.7,0.25)%
    \psplot[style=Pulse]{-1}{1}{2.7182818 x 1 div 2 exp neg exp 0.5 mul 0.1 sub}}%
  \nlput[nrot=:U](BeamF)(BeamE){1.9}{%
    \rput(0,0.05){\addtopsstyle{Pulse}{linecolor=blue!50!red!50}\mypulse
    \rput(-0.7,0){\addtopsstyle{Pulse}{linecolor=blue!50}\mypulse}}}%
\end{pspicture}
\end{LTXexample}
\endgroup

\begin{LTXexample}[pos=t, linerange={1-1}, caption={caption}]

\begin{pspicture}(-0.5,-0.4)(13,11)
\psset{%
  optboxsize=0.8 0.6, 
  arrowcompsize=0.8 0.5,
  optmzmsize=0.8 0.6,
  isolatorsize=0.8 0.5,
  filtersize=0.6,
  detsize=0.5 0.6,
  fiber=none, wire=none,
  usefiberstyle=false,
  labeloffset=0.5, labelstyle=\footnotesize
}
\footnotesize
\newpsobject{elecfilter}{optfilter}{usewirestyle}
\addtopsstyle{Wire}{arrowscale=1.2, arrows=->, linewidth=1.5\pslinewidth}
\newpsstyle{FiberComp}{linecolor=red!80!black}
\newpsstyle{Fiber}{style=FiberComp, arrows=->, linewidth=1.5\pslinewidth}
  \pnode(1,10){Syn}\pnode([Xnodesep=8]Syn){Pm}
  \elecsynthesizer[compname=Syn, labelalign=t](Syn)(Pm){10\,GHz}
  \fiberdelayline[compname=Voa1, abspos=2.5, label= 0.6 . t](Syn)(Pm){VOA}
  \optbox[compname=Am, abspos=4, innerlabel, extnode=b](Syn)(Pm){AM}
  \fiberdelayline[compname=DelayPm, abspos=5.5, label=0.6 . t](Syn)(Pm){DLY}
  \optbox[fiber, addtoFiber={arrows=->}, style=FiberComp, label=0, compname=Pm, extnode=t, optboxheight=0.7]([offset=-1]Pm)([offset=1]Pm){PM}
  \elecsynthesizer[synthtype=rectangle, synthrectwidth=0.3, wire, addtoWire={arrows=->}, label=. -45 l]([offset=-0.5]\oenodeExt{Am})(\oenodeExt{Am}){AWG}
  \pnode([offset=-0.5, Xnodesep=-1]\oenodeIn{Voa1}){A}
  \pnode([offset=-1.5]A){B}
  \eleccoupler[eleccouplertype=directional, eleccouplerinput=right, compname=Cpl](B)(A)
  \pnode([Xnodesep=-1.2]\oenodeIn{}){EamIn}
  \pnode([Xnodesep=0.5,offset=-0.3]\oenodeIfc{2}{}){N1}
  \pnode([offset=-1.3]N1){N2}
  \optisolator[label=0.4 . r, compname=Iso1](N1)(N2){Isolator}
  \optarrowcomp[compname=DelayPpg, labelalign=l]([offset=-1.4]N2)(N2){DLY}
  \fiberbox[position=start, 
            label=0, 
            fiberboxsize=0.7 1, 
            fiberboxcount=2x1,
            fiberboxsepin=0.2, 
            compname=Ppg]([offset=-0.4]\oenodeIn{DelayPpg})(\oenodeIn{DelayPpg}){PPG}
  \pnode([offset=-0.5,Xnodesep=-0.5]\oenodeIn{Ppg}){MzmAmp1}
  \pnode([offset=-0.5,Xnodesep=0.5]\oenodeIfc{2}{Ppg}){MzmAmp2}
  \pnode([offset=-1.5,Xnodesep=-0.9]MzmAmp1){MzmIn}
  \pnode([offset=-1.5,Xnodesep=0.9]MzmAmp2){MzmOut}
  \optamp[abspos=0.5, compname=MzmAmp1](MzmAmp1)(MzmAmp1|MzmIn)
  \optamp[abspos=0.5, compname=MzmAmp2](MzmAmp2)(MzmAmp2|MzmIn)
  \optmzm[abspos=0.9, usefiberstyle, style=FiberComp, compname=Mzm1, extnode=t, labelalign=t](MzmIn)(MzmOut){MZM}
  \optmzm[abspos=2.3, usefiberstyle, style=FiberComp, compname=Mzm2, extnode=t, labelalign=t](MzmIn)(MzmOut){MZM}
  \rput(\oenodeCenter{Ppg}|[offset=-0.2]\oenodeCenter{MzmAmp1}){AMP}
  \pnode([Xnodesep=-1]\oenodeIn{Mzm1}){Eam}
  \optbox[style=FiberComp, 
          label=0, 
          optboxsize=1 0.6, 
          compname=Eam, 
          extnode=t]([Xnodesep=-1]Eam)([Xnodesep=0.8]Eam){EAM}
  \drawfiber[style=FiberComp, arrows=->]([Xnodesep=-1.2]Eam){Eam}{Mzm1}{Mzm2}(MzmOut)
  \pnode([Xnodesep=8]N2){N3}
  \optfilter[abspos=2, label=. 180 b, compname=Bpf1](N2)(N3){\parbox{\widthof{10\,GHz}}{\centering BPF\\[-1pt] 10\,GHz}}
  \makeatletter\edef\mystart{\the\POE@cnt}\makeatother
  \optbox[label=0, 
          abspos=3.2, 
          optboxsize=0.6 0.6](N2)(N3){$\div 8$}
  \makeatletter\edef\mystartb{\the\POE@cnt}\makeatother
  \optamp[abspos=4.7, label=. 180 b](N2)(N3){AMP}
  \optbox[label=0, 
          abspos=6, 
          optboxsize=0.6 0.6, 
          compname=Div5](N2)(N3){$\div 5$}
  \optfilter[abspos=7.3, label=. 180 b](N2)(N3){\parbox{\widthof{250\,MHz}}{\centering BPF\\[-1pt] 250\,MHz}}
  \pnode([offset=-1]N3){N4}
  \pnode([offset=-2.4]N4){Mixer}
  \optamp[abspos=0.4, label=. 0 l global](N4)(Mixer){AMP}
  \optfilter[innercompalign=abs,
             filtertype=lowpass, 
             abspos=1.4, 
             compname=Bpf,
             extnode=t,
             label=. 0 l global](N4)(Mixer){%
    \parbox{\widthof{300\,MHz}}{LPF\\[-1pt]300\,MHz}%
  }
  \pnode([Xnodesep=-4]Mixer){MixerI}
  \pnode([offset=-2.5]Mixer){MixerR}
  \elecmixer[compname=Mixer, elecmixersize=0.7, labelalign=l](Mixer)(MixerR)(MixerI){Mixer}
  \pnode([Xnodesep=-9.8]MixerR){Menlo}
  \optbox[position=start, 
          compname=Lo, 
          innerlabel, 
          style=FiberComp](Menlo)(MixerR){LO}
  \optdetector[extnode=r, 
               labelalign=t,
               compname=Pd](Menlo)([Xnodesep=0.5]Menlo){\parbox{\widthof{2\,GHz}}{\centering PD\\[-1pt]2\,GHz}}
  \optfilter[abspos=1.5, labelalign=t,
             compname=LoBpf](\oenodeExt{Pd})(MixerR){\parbox{\widthof{250\,MHz}}{\centering BPF\\[-1pt]250\,MHz}}
  \optamp[abspos=3, labelalign=t,
          compname=LoAmp](\oenodeExt{Pd})(MixerR){AMP}
  \drawfiber[arrows=->]{Lo}{Pd}
  \drawwire(\oenodeExt{Pd}){LoBpf}{LoAmp}
  \drawwire[stopnode=N]{LoAmp}{Mixer}
  \optfilter[filtertype=lowpass, 
             abspos=1, 
             label=1.1 180 t, 
             compname=LpfP2](MixerI)(\oenodeIfc{2}{Mixer}){%
               \parbox{\widthof{500\,kHz}}{\centering LPF\\[-1pt]500\,kHz}%
  }
  \optfilter[filtertype=lowpass, 
             abspos=2.7, 
             label=1.1 180 t, 
             compname=LpfP1](MixerI)(\oenodeIfc{2}{Mixer}){%
               \parbox{\widthof{10.7\,MHz}}{\centering LPF\\[-1pt]10.7\,MHz}%
  }
  \optbox[compname=T0,
          extnode=b,
          position=start,
          optboxsize=2.2 0.8,
          innerlabel](MixerI)(\oenodeIfc{2}{Mixer}){$T_0$-Messung}
  \drawwire[wirealign=center]{Mixer}{LpfP1}{LpfP2}{}
  \psline[style=Wire](\oenodeExt{T0}|Menlo)(\oenodeExt{T0})
  \uput{0.4}[-60](\oenodeExt{T0}){\rput[l](0,0){Takt}}
  \drawwire[arrows=<-](\oenodeExt{Eam}){Cpl}
  \drawwire{Syn}{Voa1}{Am}{DelayPm}(\oenodeExt{Pm})
  \drawwire{Syn}{Cpl}{Iso1}{DelayPpg}{Ppg}{MzmAmp1}(\oenodeExt{Mzm1})
  \drawwire{Ppg}{MzmAmp2}(\oenodeExt{Mzm2})
  \drawwire{Iso1}{Bpf1}
  \multido{\i=\mystart+1,\ii=\mystartb+1}{7}{%
    \drawwire{\i}{\ii}}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t, caption={caption}]
\begin{pspicture}(10,3)
\makeatletter
\newOptexpTripole{roughsurface}
\def\roughsurface@nodes{%
  \pssavepath[linestyle=none, arrows=-,ArrowInside=-]{\oenode@Path{A}}{%
    \code{0 srand}
    \moveto(!-3 Rand 0.5 sub 0.1 mul)
    \multido{\r=-2.7+0.3}{20}{%
      \lineto(!\r\space Rand 0.5 sub 0.1 mul)}%
  }%
  \newOptexpComp{%
    {0 0} tx@IntersectDict /\PIT@name{\oenode@Path{A}} get 0 0 refl {PathIfc}
    1 }%
}%
\def\roughsurface@comp{%
  \pstracecurve{\oenode@Path{A}}
}%
\makeatother
\optplane[angle=90](1,3)
\roughsurface(0,3)(5,0)(10,3)
\addtopsstyle{Beam}{beamalign=abs, beamangle=-45, arrows=->, arrowscale=2}
\multido{\r=0+0.3}{6}{%
\drawbeam[beampos=\r]{1}{2}{1}}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \ifGERMAN\chapter{Zusatzinformationen}\fi
% \ifENGLISH\chapter{Additional information}\fi
%
% \ifENGLISH\section{Internal component structure}\fi
% \ifGERMAN\section{Interne Struktur der Komponenten}\fi
% 
% \begin{optionlist}
% \boolitem[false]{showifcnodes}
% \styleitem[dotstyle=x, dotscale=1.5, linecolor=blue]{IfcNodeStyle}
% \end{optionlist}
%
% \ifENGLISH
% Every component consists internally of interfaces which are defined by a node
% on the optical axis, a plane vector or a curvature radius, and by its optical
% characteristics (reflective or transmittive, or both e.g. for
% \Lcomp{beamsplitter}). The interface nodes can be visualized for each component
% with the \Lkeyword{showifcnodes} parameter.
% \fi
% \ifGERMAN
% Jede Komponente besteht aus Grenzflächen, die über einen Knoten auf der
% optischen Achse, einen Ebenevektor bzw. einen Krümmungsradius, und ihre
% optische Eigenschaft (reflektiv oder transmittiv, oder beides für
% z.B. \Lcomp{beamsplitter}) definiert ist. Die Grenzflächenknoten können mit
% \Lkeyword{showifcnodes} angezeigt werden.
% \fi
% 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(4,3)
  \psset{showifcnodes}
  \optbox(0,2.5)(4,2.5)
  \doveprism(0,1.5)(4,1.5)
  \lens(0,0.5)(4,0.5)
  \mirror(0,0.5)(3.5,0.5)(3.5,3)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \medskip
%
% \ifENGLISH 
% \nxLcs{draw*beam}\xLcs{drawbeam}\xLcs{drawwidebeam} calculates the distance
% between the interface nodes of two components and connects the two nearest
% to each other.
% \fi
% \ifGERMAN
% \nxLcs{draw*beam}\xLcs{drawbeam}\xLcs{drawwidebeam} berechnet den Abstand
% zwischen den Grenzflächenknoten zweier Komponenten und verbindet die beiden
% nächstgelegenen. 
% \fi
% 
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(-3,-3)(3,3)
  \psset{optboxsize=0.6 0.5, labeloffset=0}
  \multido{\i=0+60,\ii=1+1}{6}{%
    \pnode(2.5;\i){A}
    \optbox([Xnodesep=-1]A)([Xnodesep=1]A){\ii}
  }
  \optbox[compname=ref](-1,0)(1,0){ref}
  \addtopsstyle{Beam}{arrows=->}
  \multido{\i=1+1}{6}{\drawbeam{ref}{\i}}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \begin{optionlist}
% \boolitem[false]{showinterfaces}
% \ifGERMAN Zeigt alle Grenzflächen einer Komponente an.\fi
% \ifENGLISH Visualizes all interfaces of a component.\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \psset[optexp]{showinterfaces, aomgratingcount=6}
  \addtopsstyle{IfcStyle}{linewidth=2\pslinewidth}
  \pnodes(0,1.5){A}(3,0.5){B}(3,1.5){C}
  \optaom[aomalign=symmetric](A)(B)(C){symmetric}
  \addtopsstyle{Beam}{arrows=->, linewidth=4\pslinewidth}
  \drawbeam[linecolor=red!50](A){}(C)
  \drawbeam[linecolor=red](A){}(B)
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}
\begin{pspicture}(3,1.5)
  \psset[optexp]{showinterfaces, aomgratingcount=6}
  \addtopsstyle{IfcStyle}{linewidth=2\pslinewidth}
  \pnodes(0,1){A}(3,1){B}(3,1.5){C}
  \optaom[aomalign=straight](A)(B)(C){straight}
  \addtopsstyle{Beam}{arrows=->, linewidth=4\pslinewidth}
  \drawbeam[linecolor=red!50](A){}(C)
  \drawbeam[linecolor=red](A){}(B)
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \styleitem[linestyle=dashed, dash=1pt 1pt, linecolor=red!70!black]{IfcStyle}
% \ifGERMAN
% Bestimmt das Aussehen der mit \Lkeyword{showinterfaces} angezeigten
% Grenzflächen.
% \fi
% \ifENGLISH
% Determines the appearance of the interfaces, which are shown with
% \Lkeyword{showinterfaces}.
% \fi
% \end{optionlist}
%
% \ifENGLISH\section{Overview of special nodes}\fi
% \ifGERMAN\section{Übersicht der Spezialknoten}\fi
%
% \ifENGLISH In this section you find overviews of all special nodes which
% each component provides. The possible positions for external and rotation
% reference nodes, and the interface nodes.
% \fi
% \ifGERMAN
% In diesem Abschnitt finden sie Übersichten für alle Spezialknoten, die von
% allen Komponenten bereitgestellt werden: die möglichen Positionen für externe
% und Rotationsknoten, und die Grenzflächenknoten.
% \fi
%
% \ifENGLISH\subsection{External and rotation reference nodes}\fi
% \ifGERMAN\subsection{Externe und Rotationsreferenzknoten}\fi
% \label{sec:overview-extnode}
%
% \ifENGLISH
% Here, you find all possible external (\prettyref{sec:extnode}) and rotation
% reference nodes (\prettyref{sec:rotrefnode}) for all components. Displayed are
% all possible combinations of \opt{t}, \opt{c}, or \opt{b} with \opt{l},
% \opt{c}, or \opt{r}. Not all components support all combinations, e.g. a plain
% \Lcomp{mirror} ignores \opt{t} and \opt{b} and an \Lcomp{optplate} ignores \opt{l}
% and \opt{r}.
%
% Instead of these values also fractional parts can be used: \opt{t}
% corresponds to $+1\cdot\Delta y$, \opt{b} corresponds to
% $-1\cdot\Delta y$, \opt{l} corresponds to $-1\cdot\Delta x$, and
% \opt{r} corresponds to $+1\cdot\Delta x$. This can be especially
% useful for round outer shapes, as the following examples shows.
% \fi
% \ifGERMAN
% Hier finden Sie eine Übersicht über alle möglichen externen Knoten
% (\prettyref{sec:extnode}) und Rotationsknoten (\prettyref{sec:rotrefnode})
% aller Komponenten. Angezeigt werden die Positionen für alle möglichen
% Kombinationen von \opt{t}, \opt{c} oder \opt{b} mit \opt{l}, \opt{c} oder
% \opt{r}. Es sind nicht immer alle Möglichkeiten vorhanden, so können \opt{t}
% und \opt{b} ignoriert werden (z.B. bei \Lcomp{mirror}), oder auch \opt{r} und
% \opt{l} (z.B. bei \Lcomp{optplate}).
% 
% Anstelle dieser Werte können auch Bruchteile davon verwendet werden:
% \opt{t} entspricht $+1\cdot\Delta y$, \opt{b} entspricht
% $-1\cdot\Delta y$, \opt{l} entspricht $-1\cdot\Delta x$ und \opt{r}
% entspricht $+1\cdot\Delta x$. Das kann gerade im Fall einer runden
% Außenform sehr hilfreich sein, wie das folgende Beispiel zeigt.
% \fi
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[morekeywords={[21]extnode}]
\begin{pspicture}(2,1)
  \elecsynthesizer[extnode={-0.707,0.707}](1,0.5)(2,0.5)
  \psdot(\oenodeExt{})
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
% 
% \newpsstyle{ExtNodeStyle}{dotstyle=B+, dotangle=45, linewidth=2\pslinewidth, linecolor=DOrange}
% \makeatletter
% \newcommand{\testextnodes}[3][]{%
%   \begin{pspicture}(3,2.2)
%   \@nameuse{#2}[#1]#3
%   \rput[t](1.5,0.9){\ttfamily\small
%     \ifx\\#1\\\relax
%     \begin{tabular}{@{}c@{}}\textbackslash #2\end{tabular}
%     \else\begin{tabular}{@{}c@{}}\textbackslash #2\\ #1\end{tabular}\fi}
%   \POE@extnodes[style=ExtNodeStyle,#1]{#2}
%   \end{pspicture}
% }%
% \makeatother
%
% \ifENGLISH\subsubsection*{Free-ray components}\fi
% \ifGERMAN\subsubsection*{Freistrahlkomponenten}\fi
%
% \testextnodes{lens}{(0,1.5)(3,1.5)}
% \testextnodes[lensradius=-1]{lens}{(0,1.5)(3,1.5)}
% \testextnodes{optplate}{(0,1.5)(3,1.5)}
% \testextnodes{optretplate}{(0,1.5)(3,1.5)}
% \testextnodes[phwidth=0.2]{pinhole}{(0,1.5)(3,1.5)}
% \testextnodes{optbox}{(0,1.5)(3,1.5)}
% \testextnodes{crystal}{(0,1.5)(3,1.5)}
% \testextnodes{optdetector}{(0,1.5)(2,1.5)}
% \testextnodes[dettype=diode]{optdetector}{(0,1.5)(2,1.5)}
% \testextnodes{optdiode}{(0,1.5)(3,1.5)}
% \testextnodes{doveprism}{(0,1.5)(3,1.5)}
% \testextnodes[glanthompsongap=0.15]{glanthompson}{(0,1.5)(3,1.5)}
% \bgroup
% \addtopsstyle{PiezoMirror}{unit=1.5}
% \testextnodes[mirrortype=piezo]{mirror}{(0,1.5)(2,1.5)(2,0)}
% \egroup
% \bgroup\psset{mirrordepth=0.25}
% \testextnodes[mirrortype=extended]{mirror}{(0,1.5)(2,1.5)(2,0)}
% \testextnodes{mirror}{(0,1.5)(2,1.5)(2,0)}
% \testextnodes[mirrortype=semitrans]{mirror}{(0,1.5)(2,1.5)(2,0)}
% \egroup
% \testextnodes{optprism}{(0,1.5)(1.5,1.5)(3,1)}
% \testextnodes{optgrating}{(0,1.5)(2,1.5)(2,0)}
% \testextnodes{beamsplitter}{(0,1.5)(2,1.5)(2,0)}
% \testextnodes[bsstyle=plate]{beamsplitter}{(0,1.5)(2,1.5)(2,0)}
% \testextnodes{rightangleprism}{(0,1.5)(2.5,1)(0,0.5)}
% \testextnodes{pentaprism}{(0,1.3)(2,1.3)(2,0)}
% \testextnodes{optarrowcomp}{(0,1.5)(3,1.5)}
% \testextnodes{optbarcomp}{(0,1.5)(3,1.5)}
% \begin{pspicture}(3,2)
%   \optdipole[optdipolesize=1](0,1.5)(3,1.5){}
%   \rput[t](1.5,0.9){\ttfamily\small
%     \begin{tabular}{@{}c@{}}\textbackslash optdipole\end{tabular}}
%   \makeatletter
%   \POE@extnodes[style=ExtNodeStyle, optdipolesize=1]{optdipole}
%   \makeatother
% \end{pspicture}
% \begin{pspicture}(3,2)
%   \transmissiongrating(0,1.5)(1.5,1.5)(3,1)
%   \rput[t](1.5,0.9){\ttfamily\small
%     \begin{tabular}{@{}c@{}}\textbackslash transmissiongrating\end{tabular}}
%   \makeatletter
%   \POE@extnodes[style=ExtNodeStyle]{transmissiongrating}
%   \makeatother
% \end{pspicture}
%
% \ifENGLISH\subsubsection*{Fiber components}\fi
% \ifGERMAN\subsubsection*{Faserkomponenten}\fi
%
% \testextnodes{optfiber}{(0,1)(3,1)}
% \testextnodes{optamp}{(0,1.5)(3,1.5)}
% \testextnodes{optmzm}{(0,1.5)(3,1.5)}
% \testextnodes{optfilter}{(0,1.5)(3,1.5)}
% \testextnodes{polcontrol}{(0,1.5)(3,1.5)}
% \testextnodes{optisolator}{(0,1.5)(3,1.5)}
% \testextnodes{optswitch}{(0,1.5)(3,1.5)}
% \testextnodes{fiberdelayline}{(0,1.5)(3,1.5)}
% \testextnodes{optfiberpolarizer}{(0,1.5)(3,1.5)}
% \testextnodes{fibercollimator}{(0,1.5)(3,1.5)}
% \testextnodes{optcirculator}{(0,1.6)(3,1.6)(1.5,0.9)}
% \testextnodes[couplersize=0.5 0.3]{optcoupler}{(0,2)(0,1)(3,2)(3,1)}
% \testextnodes{fiberbox}{(0,1.75)(0,1.25)(3,1.75)(3,1.25)}
%
% \ifENGLISH\subsubsection*{Electrical components}\fi
% \ifGERMAN\subsubsection*{Elektrische Komponenten}\fi
%
% \testextnodes{eleccoupler}{(0,2)(0,1)(3,2)(3,1)}
% \testextnodes{elecmixer}{(0,1.6)(3,1.6)(1.5,0.9)}
% \testextnodes{elecsynthesizer}{(1,1.5)(3,1.5)}
%
%
% \ifENGLISH\subsection{Interface nodes}\fi
% \ifGERMAN\subsection{Grenzflächenknoten}\fi
% \label{sec:overview-ifcnode}
%
% \ifENGLISH
% Here, all available components and their interface nodes are listed. If
% a node is labeled as «1, N», it means that both nodes are equal.
% \fi
% \ifGERMAN Hier sind alle Komponenten und deren Grenzflächenknoten
% aufgelistet. Ist ein Knoten mit «1, N» beschriftet, dann fallen beide
% Knoten zusammen.
% \fi
%
% \ifENGLISH\subsubsection*{Free-ray components}\fi
% \ifGERMAN\subsubsection*{Freistrahlkomponenten}\fi
%
% \begingroup
% \addtopsstyle{Beam}{arrows=->, arrowinset=0, arrowscale=1.5}
% \newcommand{\showdipoleifc}[1]{%
%   \begin{pspicture}(0,-0.5)(3,1) 
%     \pnode(0,0.5){A}\pnode(3,0.5){B}
%     \csname #1\endcsname(A)(B)
%     \drawbeam(A){}(B)
%     \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1}
%     \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
%     \rput[bl](0,-0.4){\ttfamily\textbackslash #1}
%   \end{pspicture}
% }%
% \newcommand{\showdipoleoneifc}[1]{%
%   \begin{pspicture}(0,-0.5)(3,1) 
%     \pnode(0,0.5){A}\pnode(3,0.5){B}
%     \csname #1\endcsname(A)(B)
%     \drawbeam(A){}(B)
%     \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1, N}
%     \rput[bl](0,-0.4){\ttfamily\textbackslash #1}
%   \end{pspicture}
% }%
% \showdipoleifc{lens}\hspace{\fill}%
% \showdipoleoneifc{optplate}\hspace{\fill}%
% \showdipoleifc{optretplate}%
% \bigskip
%
% \noindent\showdipoleoneifc{pinhole}\hspace{\fill}%
% \showdipoleifc{optbox}\hspace{\fill}%
% \showdipoleifc{crystal}
% \bigskip
%
% \noindent
% \begin{pspicture}(0, -0.5)(3,1)
%   \pnode(0,0.5){A}\pnode(2,0.5){B}
%   \optdetector(A)(B)
%   \drawbeam(A){}
%   \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1}
%   \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash optdetector}
% \end{pspicture}%
% \hspace{\fill}%
% \bgroup
% \addtopsstyle{Beam}{beaminside=false}%
% \showdipoleifc{optdiode}\egroup%
% \hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1) 
%   \pnode(0,0.5){A}\pnode(3,0.5){B}
%   \doveprism(A)(B)
%   \drawbeam[raytrace=false](A){}(B)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[90](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeOut{})\uput[45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash doveprism}
% \end{pspicture}%
%
% \begin{pspicture}(3,1.5)
%   \pnode(0,1){A}\pnode(2.5,1){B}\pnode(2.5,0){C}
%   \mirror(A)(B)(C)
%   \drawbeam(A){}(C)
%   \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1, N}
%   \rput[bl](0,0){\ttfamily\textbackslash mirror}
% \end{pspicture}%
% \hspace{\fill}%
% \begin{pspicture}(3,1.5) 
%   \pnode(0,1){A}\pnode(1.5,1){B}\pnode(3,0){C}
%   \optprism(A)(B)(C)
%   \drawbeam[raytrace=false](A){}(C)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeOut{})\uput[45](\oenodeOut{}){N}
%   \rput[bl](0,0){\ttfamily\textbackslash optprism}
% \end{pspicture}%
% \hspace{\fill}% 
% \begin{pspicture}(3,1.5) 
%   \pnode(0,1.5){A}\pnode(1.5,1){B}\pnode(3,1.5){C}
%   \optprism[prismtype=reflective](A)(B)(C)
%   \drawbeam[raytrace=false](A){}(C)
%   \psdot(\oenodeIn{})\uput[110](\oenodeIn{}){1}
%   \psdot(\oenodeOut{})\uput[70](\oenodeOut{}){N}
%   \psdot(\oenodeIfc{2}{})\uput[90](\oenodeIfc{2}{}){2}
%   \rput[tl](0,0.42){\ttfamily\begin{tabular}{@{}l@{}}\textbackslash optprism\\prismtype=reflective\end{tabular}}
% \end{pspicture}%
%
% \begin{pspicture}(3,1.5)
%   \pnode(0,1){A}\pnode(2.5,1){B}\pnode(2.5,0){C}
%   \optgrating(A)(B)(C)
%   \drawbeam(A){}(C)
%   \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1, N}
%   \rput[bl](0,0){\ttfamily\textbackslash optgrating}
% \end{pspicture}%
% \hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.7) 
%   \pnode(0,0.7){A}\pnode(3,0.7){B}
%   \glanthompson[glanthompsonsize=1.8 1, glanthompsongap=0.2](A)(B)
%   \drawbeam(A){}(B)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[45](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeIfc{3}{})\uput[30](\oenodeIfc{3}{}){3,C}
%   \psdot(\oenodeIfc{4}{})\uput[150](\oenodeIfc{4}{}){4}
%   \psdot(\oenodeOut{})\uput[45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash glanthompson}
% \end{pspicture}%
% \hspace{\fill}%
% \showdipoleifc{optarrowcomp}%
% 
% \showdipoleifc{optbarcomp}\hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.7)
%   \pnode(0,0.7){A}\pnode(3,0.7){B}
%   \optdipole[optdipolesize=1](A)(B){}
%   \drawbeam(A){}(B)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeOut{})\uput[45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash optdipole}
% \end{pspicture}%
% \hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.7)
%   \pnode(0,0.7){A}\pnode(1.5,0.7){B}\pnode(3,0.4){C}
%   \transmissiongrating(A)(B)(C)
%   \drawbeam(A){}(C)
%   \psdot(\oenodeIn{})\uput[45](\oenodeIn{}){1, N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash transmissiongrating}
% \end{pspicture}%
%
% \noindent\begin{pspicture}(3,2.5)
%   \pnode(0,1.5){A}\pnode(2.5,1.5){B}\pnode(2.5,0.4){C}
%   \beamsplitter[bssize=1.2](A)(B)(C)
%   \drawbeam(A){}(C)
%   \psdot(\oenodeIfc{1}{})\uput[135](\oenodeIfc{1}{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[-45](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeIfc{3}{})\uput[60](\oenodeIfc{3}{}){3,C}
%   \psdot(\oenodeIfc{4}{})\uput[0](\oenodeIfc{4}{}){4}
%   \psdot(\oenodeIfc{N}{})\uput[90](\oenodeIfc{N}{}){N}
%   \rput[bl](0,0){\ttfamily\textbackslash beamsplitter}
% \end{pspicture}%
% \hspace{\fill}%
% \begin{pspicture}(3,2.5)
%   \pnode(0,2){A}\pnode(2.5,1.5){B}\pnode(0,1){C}
%   \rightangleprism[raprismsize=2](A)(B)(C)
%   \drawbeam[arrows=->, arrowinset=0, arrowscale=1.5](A){}(C)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[45](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeIfc{3}{})\uput[-45](\oenodeIfc{3}{}){3}
%   \psdot(\oenodeOut{})\uput[-135](\oenodeOut{}){N}
%   \rput[bl](0,0){\ttfamily\textbackslash rightangleprism}
% \end{pspicture}%
% \hspace{\fill}%
% \begin{pspicture}(3,2.5) 
%   \pnode(0,1.5){A}\pnode(2.1,1.5){B}\pnode(2.1,0.4){C}
%   \pentaprism[pentaprismsize=1](A)(B)(C)
%   \drawbeam[arrows=->, arrowinset=0, arrowscale=1.5](A){}(C)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[0](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeIfc{3}{})\uput[90](\oenodeIfc{3}{}){3}
%   \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
%   \rput[bl](0,0){\ttfamily\textbackslash pentaprism}
% \end{pspicture}%
% \endgroup
%
% \ifENGLISH\subsubsection*{Fiber components}\fi
% \ifGERMAN\subsubsection*{Faserkomponenten}\fi
%
% \newcommand{\showfdipoleifc}[1]{%
%   \begin{pspicture}(0,-0.5)(3,1) 
%     \pnode(0,0.5){A}\pnode(3,0.5){B}
%     \csname #1\endcsname(A)(B)
%     \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1}
%     \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
%     \rput[bl](0,-0.4){\ttfamily\textbackslash #1}
%   \end{pspicture}%
% }%
% \begingroup
% \addtopsstyle{Fiber}{ArrowInside=->, ArrowInsidePos=0.6, arrowscale=1.5, arrowinset=0}
% \vspace*{5mm}%
% \showfdipoleifc{optfiber}\hspace{\fill}%
% \showfdipoleifc{optamp}\hspace{\fill}%
% \showfdipoleifc{optmzm}%
% \bigskip
%
% \noindent\showfdipoleifc{optfilter}\hspace{\fill}%
% \showfdipoleifc{polcontrol}\hspace{\fill}%
% \showfdipoleifc{optisolator}%
% \bigskip
%
% \noindent\showfdipoleifc{optswitch}\hspace{\fill}%
% \showfdipoleifc{fiberdelayline}\hspace{\fill}%
% \showfdipoleifc{optfiberpolarizer}%
% \bigskip
%
% \bgroup\psset{beam}
% \noindent\showfdipoleifc{fibercollimator}\egroup
% \hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.5)
%   \pnode(0,1){A}\pnode(3,1){B}\pnode(1.2,-0.1){C}
%   \optcirculator(A)(B)(C)
%   \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[-45](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash optcirculator}
% \end{pspicture}\hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.5)
%   \fiberbox[fiberboxcount=2x3](0,0.95)(0,0.45)(3,1.2)(3,0.2)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[-135](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeIfc{3}{})\uput[45](\oenodeIfc{3}{}){3}
%   \psdot(\oenodeIfc{4}{})\uput[0](\oenodeIfc{4}{}){4}
%   \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash fiberbox}
% \end{pspicture}
% \bigskip
%
% \noindent
% \begin{pspicture}(0,-0.5)(3,1.5)
%   \pnode(0,0.75){A}\pnode(3,1.5){B}\pnode(3,0){C}
%   \wdmsplitter[couplersize=0.5, couplersep=0.2](A)(B)(C)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[90](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeOut{})\uput[-90](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash wdmsplitter}
% \end{pspicture}%
% \hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.5)
%   \pnode(0,1.5){A}\pnode(0,0){B}\pnode(3,0.75){C}
%   \wdmcoupler[couplersize=0.5, couplersep=0.2](A)(B)(C)
%   \psdot(\oenodeIn{})\uput[90](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[-90](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeOut{})\uput[45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash wdmcoupler}
% \end{pspicture}%
% \hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.5)
%   \pnode(0,1.5){A}\pnode(0,0){B}\pnode(3,1.5){C}\pnode(3,0){D}
%   \optcoupler[couplersize=0.5, couplersep=0.2](A)(B)(C)(D)
%   \psdot(\oenodeIn{})\uput[90](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[-90](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeIfc{3}{})\uput[90](\oenodeIfc{3}{}){3}
%   \psdot(\oenodeOut{})\uput[-90](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash optcoupler}
% \end{pspicture}%
% \endgroup
%
% 
% \ifENGLISH\subsubsection*{Electrical components}\fi
% \ifGERMAN\subsubsection*{Elektrische Komponenten}\fi
% \begingroup
% \addtopsstyle{Wire}{arrows=->, arrowscale=1.5, arrowinset=0, arm=0.6}
% \noindent\begin{pspicture}(0, -0.5)(3,1.7)
%   \pnode(2,1.2){A}\pnode(3,1.2){B}
%   \elecsynthesizer(A)(B)
%   \psdot(\oenodeIn{})\uput[135](\oenodeIn{}){1}
%   \psdot(\oenodeOut{})\uput[45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash elecsynthesizer}
% \end{pspicture}\hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.7)
%   \pnode(0,1.2){A}\pnode(3,1.2){B}\pnode(1.2,0.1){C}
%   \elecmixer(A)(B)(C)
%   \psdot(\oenodeIn{})\uput[-135](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[-45](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeOut{})\uput[-45](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash elecmixer}
% \end{pspicture}\hspace{\fill}%
% \begin{pspicture}(0,-0.5)(3,1.7)
%   \pnode(0,1.7){A}\pnode(0,0.2){B}\pnode(3,1.7){C}\pnode(3,0.2){D}
%   \eleccoupler(A)(B)(C)(D)
%   \psdot(\oenodeIn{})\uput[120](\oenodeIn{}){1}
%   \psdot(\oenodeIfc{2}{})\uput[-120](\oenodeIfc{2}{}){2}
%   \psdot(\oenodeIfc{3}{})\uput[60](\oenodeIfc{3}{}){3}
%   \psdot(\oenodeOut{})\uput[-60](\oenodeOut{}){N}
%   \rput[bl](0,-0.4){\ttfamily\textbackslash eleccoupler}
% \end{pspicture}%
% \endgroup
%
% \ifGERMAN
%   \section{Abwärtskompatibilität}
% \fi
% \ifENGLISH
%   \section{Backward compatibility}
% \fi\label{sec:bwd-comp}
% 
% \ifENGLISH In this section you find a comprehensive listing of the behaviour
% which changed in a version compared to the previous one and which is not
% backward compatible. Here you find also information on what you must note when
% upgrading and how you must change old documents to work correctly with the
% newer version.
% \fi
% \ifGERMAN
% In diesem Abschnitt finden Sie eine umfangreiche Auflistung aller Änderungen
% in einer Version bezüglich der Vorgängerversion, die nicht abwärts kompatibel
% sind. Sie finden ebenfalls Informationen was Sie bei einem Wechsel zur neuen
% Version beachten müssen, und was sie bei älteren Dokumenten gegebenenfalls
% ändern müssen um mit der neuen Version korrekt zu funktionieren.  \fi
%
%
% \subsection{Version 4.3a}\label{sec:bwd-comp-4.3a}
%
% \begin{optionlist}
% \poeitem{prismtype}
% \ifGERMAN Die Option \Lkeyword{prismtype} war immer noch
% «zusammengeschustert» und die automatische Positionierung war recht
% willkürlich. Dies sollte nun endlich korrigiert sein, unter
% Option \Lkeyword{prismalign} ist ein entsprechendes Beispiel zu sehen.
% \fi
% \ifENGLISH The option \Lkeyword{prismtype} was still not correctly
% implemented, die automatic alignment was somewhat arbitrary. This
% should be finally fixed, an example is shown for option
% \Lkeyword{prismalign}.
% \fi
%
% \poeitem{\cs{optprism}}
% \ifGERMAN Die Positionierung der Beschriftung war nicht konsistent mit
% anderen Komponenten, der Bezugspunkt war nicht der Mittelpunkt und
% auch nicht fest. Das ist jetzt behoben, könnte aber leichte
% Korrekturen an bestehenden Skizzen erfordern.
% \fi
% \ifENGLISH The positioning of the label was not consistent with other
% components, the reference point was not the center point and did also
% depend on the component rotation. This is fixed now, but could mean
% little corrections for existing images.
% \fi
% 
% \end{optionlist} 
%
% \subsection{Version 4.3}\label{sec:bwd-comp-4.3}
%
% \begin{optionlist}
% \poeitem{\cs{rightangleprism}}
% \ifGERMAN Die Ausrichtung des \Lcomp{rightangleprism} und die
% Positionierung der Beschriftung war falsch. Das kommt aber nur zum
% tragen, wenn Eingangs- und Ausgangsvektor sehr unterschiedliche Längen
% haben.
% \fi
% \ifENGLISH The alignment of the \Lcomp{rightangleprism} and the
% positioning of the label was wrong. This became apparent only if the
% input and output vectors had very different lenghts. 
% \fi
% \end{optionlist}
% 
% \subsection{Version 4.2}\label{sec:bwd-comp-4.2}
%
% \begin{optionlist}
%   \poeitem{prismtype}
%   \ifGERMAN
%   Die in Version 4.1 eingeführte Option \Lkeyword{prismtype} benötigte
%   immer eine zusätzliche Drehung der Komponente um 180\textdegree. Das
%   entfällt nun, da die Komponentenausrichtung korrigiert wurde,
%   erfordert aber gegebenenfalls eine Korrektur von Skizzen, die mit
%   Version 4.1 erstellt wurden.
%   \fi
%   \ifENGLISH
%   The option \Lkeyword{prismtype}, introduced in version 4.1, always
%   needed an additional angle rotation of 180\textdegree. This is not
%   necessary anymore, the component behavior was corrected, but this may
%   require adjustment of drawings created with version 4.1.
%   \fi
% \end{optionlist}
% 
% \subsection{Version 4.0}\label{sec:bwd-comp-4.0}
% 
% \ifGERMAN Die Option \Lkeyword*{conn} und das alte, fehlerhafte
% Verfahren Strahlverbindungen zu zeichnen, wurde nun entfernt. Zur
% Migration älterer Dokumente siehe
% \prettyref{sec:bwd-comp-3.0-conn}. Damit wurde auch die Option
% \Lkeyword*{connjoin} überflüssig und wurde entfernt.
% \fi
% \ifENGLISH The option \Lkeyword*{conn} and the old, buggy code for beam
% connections was finally removed. To update older documents, see
% \prettyref{sec:bwd-comp-3.0-conn}. With this change also option
% \Lkeyword*{connjoin} became useless.
% \fi
%
% \ifENGLISH 
% The appearance of \Lcomp{optfiber} changed slightly, because the old
% implementation was buggy and the separation between the loops depended
% on the number of loops (see example below). Note, that to achieve a
% similar default look, the default value for \Lkeyword{fiberloopsep}
% was changed from 0.3 to 0.2. Therefore, the interface nodes are a bit
% closer together.
% \fi
% \ifGERMAN 
% Das Aussehen von \Lcomp{optfiber} hat sich etwas geändert, da in der
% vorherigen Implementierung der Abstand zwischen zwei Schleifen von der
% Anzahl der Schleifen abhing (siehe das Beispiel unten). Beachten Sie,
% dass die Voreinstellung für \Lkeyword{fiberloopsep} von 0.3 auf 0.2
% geändert wurde um ein ähnliches Aussehen bei Verwendung der
% Voreinstellungen zu erhalten. Dadurch sitzen die Eingangs- und
% Ausgangsknoten jedoch etwas näher zusammen (siehe unten).
% \fi
%
% \makeatletter
% \begin{pspicture}[showgrid](0,-0.3)(6,1.4)
% \newOptexpFiberDipole{optfiber@old}
% \def\optfiber@old@ref{%
%   \POE@setref{/@@x 0.3 \POE@key@fiberloops\space 1 sub mul 0.5 mul def }%
% }%
% \def\optfiber@old@nodes{%
%   \newOptexpFiberComp{{@@x neg 0} {@@x 0}}%
% \ignorespaces}%
% \def\optfiber@old@comp{%
%   \edef\@f@cnt{\POE@key@fiberloops\space}%
%   \edef\@f@r{0.4 }%
%   \edef\@f@sep{0.3 }%
%   \parametricplot[plotpoints=200, style=Fiber]{0}{1}{%
%     t 360 mul \@f@cnt mul sin \@f@r mul \@f@sep
%     \@f@cnt 1 sub mul t 0.5 sub mul add
%      1 t 360 mul \@f@cnt mul cos sub \@f@r mul
%   }%
% \ignorespaces}%
% \psset[optexp]{label=0.5 . b, showifcnodes}
% \optfiber@old[fiberloops=2](0,0.5)(2,0.5)
% \optfiber@old[fiberloops=3](2,0.5)(4,0.5){old}
% \optfiber@old[fiberloops=4](4,0.5)(6,0.5)
% \end{pspicture}
% \makeatother
% \hspace{\fill}
% \begin{pspicture}[showgrid](0,-0.3)(6,1.4)
% \psset[optexp]{label=0.5 . b, showifcnodes}
% \optfiber[fiberloops=2](0,0.5)(2,0.5)
% \optfiber[fiberloops=3](2,0.5)(4,0.5){new}
% \optfiber[fiberloops=4](4,0.5)(6,0.5)
% \end{pspicture}
% 
% \ifGERMAN Das Makro \Lcs*{newOptexpDipoleNolabel} wurde entfernt und
% kann ohne weitere Änderungen durch \Lcs{newOptexpDipole} ersetzt werden.
% \fi
% \ifENGLISH The macro \Lcs*{newOptexpDipoleNolabel} was removed and can
% be replaced by \Lcs{newOptexpDipole} without any further changes.
% \fi
%
% \ifGERMAN The alte Syntax mit \nxLcs{mycomp@iii} zur Definition eigener
% Komponenten wird nicht mehr unterstützt.
% \fi
% \ifENGLISH The old syntax of defining own components with
% \nxLcs{mycomp@iii} is not supported anymore.
% \fi
%
% \subsection{Version 3.3}\label{sec:bwd-comp-3.3}
%
% \begin{optionlist}
%   \poeitem{\textbackslash opttripole}
%   \ifGERMAN Der Ausgangswinkel für die Beschriftung des
%   \Lcomp{opttripole} wurde um 180° geändert um konsistent zu den anderen
%   Dreipolen zu sein.
%   \fi
%   \ifENGLISH Changed the reference angle for the label of the
%   \Lcomp{opttripole} to be consistent with the other tripoles.
%   \fi
% \end{optionlist}
%
% \ifGERMAN\subsubsection{Strahlknoten}\fi
% \ifENGLISH\subsubsection{Beam nodes}\fi
%
% \ifGERMAN Vor Version 3.3 sind the Strahlknoten \Lcs{oenodeBeamUp} und
% \Lcs{oenodeBeamLow} nicht korrekt ausgerichtet gewesen, «upper» und
% «lower» war immer relativ zur Strahlrichtung (analog zu
% \Lkeyword{extnodealign}\opt{=relative}).
%
% Das konnte zu Problemen führen wenn \Lkeyword{loadbeampoints} zusammen
% mit \Lkeyword{beamdiv} verwendet wurde, da das Vorzeichen von
% \Lkeyword{beamdiv} nicht eindeutig kontrahierenden bzw. expandierenden
% Strahlen zugeordnet war.
%
% Seit Version 3.3 werden die Strahlknoten analog zu
% \Lkeyword{extnodealign}\opt{=absolute} definiert und die Zuordnung
% eines negativen \Lkeyword{beamdiv} mit kontrahierenden Strahlen sowie
% positiven \Lkeyword{beamdiv} mit expandierenden Strahlen ist immer
% gültig. In den folgenden beiden Beispielen ist immer der
% \Lcs{oenodeBeamUp} gekennzeichnet.
% \fi
% \ifENGLISH Before version 3.3 the beam nodes 
% \Lcs{oenodeBeamUp} and \Lcs{oenodeBeamLow} were not swapped correctly
% and the orientation of «upper» and «lower» was only relative to the
% beam direction (equivalent to
% \Lkeyword{extnodealign}\opt{=relative}). 
%
% This could lead to problems when using \Lkeyword{loadbeampoints} with
% \Lkeyword{beamdiv}. In that case the sign of \Lkeyword{beamdiv} was
% not unambiguously associated with contracting or expanding beam.
% 
% As of version 3.3 the beam nodes are arranged according to
% \Lkeyword{extnodealign}\opt{=absolute} and the association of negative
% \Lkeyword{beamdiv} with a contracting and positive \Lkeyword{beamdiv}
% with an expanding beam is always valid. In the following two examples
% all \Lcs{oenodeBeamUp} are marked.
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}
\begin{pspicture}(-2,-2)(2,2)
  \addtopsstyle{Beam}{fillstyle=solid, fillcolor=green!40}
  \multido{\i=0+90,\ia=1+2,\ib=2+2}{4}{%
    \optplate[position=end](0.3;\i)(1;\i)
    \optplate[position=end, plateheight=1.5](1;\i)(2;\i)
    \drawwidebeam[beamwidth=0.2](0.3;\i){\ia}
    \pnode(\oenodeBeamUp{}){Up}
    \drawwidebeam[loadbeampoints, beamdiv=45]{\ia-\ib}
    \psdot(Up)\psdot(\oenodeBeamUp{})
  }
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}
\begin{pspicture}(-2,-2)(2,2)
  \addtopsstyle{Beam}{fillstyle=solid, fillcolor=green!40}
  \multido{\i=0+90,\ia=1+2,\ib=2+2}{4}{%
    \optplate[position=end](0.3;\i)(1;\i)
    \optplate[position=end](1;\i)(2;\i)
    \drawwidebeam[beamwidth=0.2](0.3;\i){\ia}
    \pnode(\oenodeBeamUp{}){Up}
    \drawwidebeam[loadbeampoints, beamdiv=-45]{\ia-\ib}
    \psdot(Up)\psdot(\oenodeBeamUp{})
  }
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \subsection{Version 3.0}\label{sec:bwd-comp-3.0}
%
% \ifENGLISH The changes in version 3.0 compared to version 2.1 which are not
% backward compatible.
% \fi
% \ifGERMAN Die Änderungen in Version 3.0 gegenüber Version 2.1, die nicht
% abwärtskompatibel sind.
% \fi
%
% \ifENGLISH\subsubsection{General parameters}\fi
% \ifGERMAN\subsubsection{Allgemeine Parameter}\fi
%
% \begin{optionlist}
%   \optitem*[new]{namingscheme}{old, new} 
%   \ifGERMAN
%   In Version 2.1 mussten spezielle Komponentenknoten über ihren expliziten
%   Namen angesprochen werden. Wenn Sie das alte Namensschema benötigen, da Sie
%   direkt auf die Knoten zugegriffen haben, so müssen Sie
%   \nxLkeyword{namingscheme=old} verwenden. Seit Version 3.0 werden Makros für
%   den Zugriff auf die Komponentenknoten bereitgestellt, so dass das
%   eigentlichen Namensschema unerheblich ist, siehe \prettyref{sec:objnodes}
%   \fi
%   \ifENGLISH
%   In version 2.1 special component nodes had to be accessed by their explicit
%   name. If you need the old naming scheme, because you accessed internal nodes
%   directly, then you must set \nxLkeyword{namingscheme=old}. Since version 3.0
%   explicit macros are provided to access all special component nodes, so that
%   the actual naming scheme does not matter, see \prettyref{sec:objnodes}.
%   \fi
%
%   \poeitem{\smash{\begin{tabular}[t]{@{}r@{}}endbox\\angle\\rotateref\end{tabular}}}
%   \ifENGLISH These options now affect all components.\fi
%   \ifGERMAN Diese Parameter wirken sich jetzt auf alle Komponenten aus.\fi
%   \vspace*{1cm}
%
%   \poeitem{extnode}
%   \ifENGLISH
%   Some components now provide more possible positions for
%   \Lkeyword{extnode}. \Lcomp{optdetector} had only one possible external node,
%   which was accessible for any value of \Lkeyword{extnode}, now this node can
%   be accessed only with \Lkeyword{extnode}\opt{=r}. All other values give
%   different node positions.
%   \fi
%   \ifGERMAN 
%   Einigen Komponenten stellen nun mehr mögliche Positionen für
%   \Lkeyword{extnode} zur Verfügung. So muss war z.B. für \Lcomp{optdetector} nur
%   ein Knoten möglich, der für jeden Wert von \Lkeyword{extnode} zugänglich
%   war, jetzt aber nur mit \Lkeyword{extnode}\opt{=r}. Alle anderen Werte
%   setzen den Knoten an andere Stellen.
%   \fi
%
%   \poeitem{\textbackslash optbox}
%   \ifENGLISH An \Lcomp{optbox} does always have the input and output
%   nodes at the respective interfaces, whereas in version 2.1 the input
%   and output nodes where at the same position for
%   \Lkeyword{endbox}\opt{=true}.
%   \fi
%   \ifGERMAN Eine \Lcomp{optbox} hat immer einen Eingangs- und
%   Ausgangsknoten an den entsprechenden Grenzflächen. In Version 2.1
%   fielen Eingangs- und Ausgangsknoten zusammen falls \Lkeyword{endbox}
%   auf \opt{true} gesetzt war.
%   \fi
%
%   \poeitem{\textbackslash fibercollimator}
%   \ifENGLISH The \Lcomp{fibercollimator} has only a fiber connection by
%   default, the beam must be drawn manually or with \Lkeyword{beam}
%   option.
%   \fi
%   \ifGERMAN Der \Lcomp{fibercollimator} hat in den Voreinstellungen nur
%   eine Faserverbindung, der Strahl muss manuell oder durch Angabe des
%   \Lkeyword{beam} Parameters gezeichnet werden.
%   \fi
% \end{optionlist}
%
% \ifENGLISH\subsubsection{Beam connections}\fi
% \ifGERMAN\subsubsection{Strahlverbindungen}\fi
% \label{sec:bwd-comp-3.0-conn}
%
% \ifENGLISH
% In version 2.1, beam connections could be internal, that is the connections
% were specified together with the compent (\Lkeyword{beam} or
% \Lkeyword*{conn}), or external with an additional call of \Lcs{drawbeam}. The
% main reason for internal connections was the aesthetic aspect of drawing the
% beam behind the component, but also convenience played a role. Drawing the
% beam behind the component is possible with layering (\prettyref{sec:layers})
% since 3.0.
%
% Some of the variants of internal beam connections can be used also in 3.0:
% \fi
% \ifGERMAN
% In Version 2.1 konnten Strahlverbindungen intern sein, d.h. die Verbindung
% wurde zusammen mit der Komponenten definiert (z.B. mit \Lkeyword{beam}, oder
% \Lkeyword*{conn}) oder extern über einen separaten Aufruf von \Lcs{drawbeam}.
% Der Hauptgrund für die internen Verbindungen war der ästhetische Aspekt,
% zuerst die Verbindung und dann die Komponente darüber zu zeichnen, aber
% Bequemlichkeit spielte auch eine Rolle. Seit Version 3.0 kann die Reihenfolge
% von Verbindungen und Komponenten über Ebenen geregelt werden
% (\prettyref{sec:layers}).
%
% Manche Varianten für interne Strahlverbindungen können auch in 3.0 verwendet
% werden:
% \fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-3,5-5}]
\begin{pspicture}(3,2)
  \pnode(0,1){A}\pnode(3,1){B}
  \optbox[beam](A)(B)
  \rput[b]([offset=-0.9]\oenodeCenter{}){\ttfamily conn=o-i, conn=i-o}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[linerange={1-3,5-5}]
\begin{pspicture}(3,2)
  \pnode(0,1){A}\pnode(3,1){B}
  \optbox[beam, beaminside=false](A)(B)
  \rput[b]([offset=-0.9]\oenodeCenter{}){\ttfamily conn=o-o}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
% \ifENGLISH
% Other internal connections need an additional \Lcs{drawbeam} call, and if you
% want to move the beam behind the component, the code must be wrapped in a
% \Lenv{optexp} environment. Except for this, external connection are equivalent:
% \fi
% \ifGERMAN
% Andere Verbindungen können nur über einen zusätzlichen \Lcs{drawbeam} Aufruf
% erreicht werden, falls die Verbindung dann hinter der Komponente sein soll,
% musst der beteiligte Code in eine \Lenv{optexp}-Umgebung geschachtelt
% werden. Außer diesem Aspekt sind die separaten Verbindungen äquivalent:
%\fi
%
% \iffalse
%<*ignore>
% \fi
\begin{LTXexample}[linerange={1-4,6-6}]
\begin{pspicture}(3,2)
  \pnode(0,1){A}\pnode(3,1){B}
  \optbox(A)(B)
  \drawbeam(A){}
  \rput[b]([offset=-0.9]\oenodeCenter{}){\ttfamily conn=o-, conn=a-}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[linerange={1-3,5-6}]
\begin{pspicture}(3,2)
  \pnode(0,1){A}\pnode(3,1){B}
  \optbox(A)(B)
  \rput[b]([offset=-0.9]\oenodeCenter{}){\ttfamily conn=-o, conn=-b}
  \drawbeam{}(B)
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[linerange={1-4,6-8}]
\begin{pspicture}(3,2)
  \pnode(0,1){A}\pnode(3,1){B}
  \begin{optexp}
    \optbox(A)(B)
    \rput[b]([offset=-0.9]\oenodeCenter{}){\ttfamily conn=i-, A-}
    \drawbeam[beaminsidelast](A){}
  \end{optexp}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[linerange={1-4,6-8}]
\begin{pspicture}(3,2)
  \pnode(0,1){A}\pnode(3,1){B}
  \begin{optexp}
    \optbox(A)(B)
    \rput[b]([offset=-0.9]\oenodeCenter{}){\ttfamily conn=-i, conn=-B}
    \drawbeam[beaminsidefirst]{}(B)
  \end{optexp}
\end{pspicture}
\end{LTXexample}
% \iffalse
%</ignore>
% \fi
%
%
% \makeatletter
% \bgroup
% \newcommand*{\index@preamble}{}
% \let\index@preamble=\relax
% \renewcommand{\setindexpreamble}[1]{\def\index@preamble{#1}}
% \renewcommand*{\idx@heading}{%
%   \addchap{\indexname}%
%   \@mkboth{\indexname}{\indexname}%
% }
% \renewenvironment{theindex}{%
%   \idx@heading%
%   \index@preamble\par\nobreak
%   \thispagestyle{\indexpagestyle}\parindent\z@
%   \setlength{\parskip}{\z@ \@plus .3\p@}%
%   \setlength{\parfillskip}{\z@ \@plus 1fil}%
%   \let\item\@idxitem
% }{%
%  \clearpage
% }
% \renewcommand*\@idxitem{\par\hangindent 40\p@}
% \renewcommand*\subitem{\@idxitem \hspace*{20\p@}}
% \renewcommand*\subsubitem{\@idxitem \hspace*{30\p@}}
% \renewcommand*\indexspace{%
%   \par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax
% }
% \renewcommand*\indexname{Index}
% \printindex[doc]
% \egroup
% \makeatother
%
% \appendix
%
% \ifGERMAN
% \chapter{Versionsgeschichte}
%
% Diese Versionsgeschichte ist eine Liste von Änderungen, die für den Nutzer des
% Pakets von Bedeutung sind. Änderungen, die eher technischer Natur sind und für
% den Nutzer des Pakets nicht relevant sind und das Verhalten des Pakets nicht
% ändern, werden nicht aufgeführt. Wenn ein Eintrag der Versionsgeschichte ein
% Feature als \emph{improved} oder \emph{extended} bekannt gibt, so bedeutet
% dies, dass eine Modifikation die Syntax und das Verhalten des Pakets nicht
% beeinflusst, oder das es für ältere Versionen kompatibel ist. Einträge, die
% als \emph{deprecated}, \emph{modified}, \emph{renamed}, oder \emph{removed}
% deklariert sind, verlangen besondere Aufmerksamkeit. Diese bedeuten, dass eine
% Modifikation Änderungen in existierenden Dokumenten mit sich ziehen kann. Die
% Zahlen an der rechten Seite stehen für die relevante Stelle dieser
% Dokumentation, zusätzliche Informationen zur Migration von älteren Dokumenten
% sind in \prettyref{sec:bwd-comp} zu finden.
% \fi
% \ifENGLISH
% \chapter{Revision history}
%
% This revision history is a list of changes relevant to users of this
% package. Changes of a more technical nature which do not affect the
% user interface or the behavior of the package are not included in the
% list. If an entry in the revision history states that a feature has
% been \emph{improved} or \emph{extended}, this indicates a modification
% which either does not affect the syntax and behavior of the package or
% is syntactically backwards compatible (such as the addition of an
% optional argument to an existing command). Entries stating that a
% feature has been \emph{deprecated}, \emph{modified}, \emph{fixed},
% \emph{renamed}, or \emph{removed} demand attention. They indicate a
% modification which may require changes to existing documents. The
% numbers on the right indicate the relevant section of this manual,
% more information regarding backward compatibility can be found in
% \prettyref{sec:bwd-comp}.  \fi
%
% \begin{changelog}
% \patchcmd{\release}{\setlength{\itemsep}{0pt}}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}}{}{}
%   \begin{release}{6.0}{2021-02-26}
%   \item Modified \cs{wdmcoupler} to handle an arbitrary number of input nodes\see{comp:wdmcoupler}
%   \item Modified \cs{wdmsplitter} to handle an arbitrary number of output nodes\see{comp:wdmsplitter}
%   \item Removed deprecated \opt{lampscale}, use style \opt{CrystalLamp}.
%   \item Removed deprecated \opt{pollinewidth}, use style \opt{Polarization}.
%   \item Removed deprecated \cs{optgrid}, use \cs{optgrating}.
%   \item Removed deprecated \opt{optgridwidth}, use \opt{gratingwidth}.
%   \item Removed deprecated \opt{optgridheight}, use \opt{gratingheight}.
%   \item Removed deprecated \opt{optgriddepth}, use \opt{gratingdepth}.
%   \item Removed deprecated \opt{optgridcount}, use \opt{gratingcount}.
%   \item Removed deprecated \opt{optgridtype}, use \opt{gratingtype}.
%   \item Removed deprecated \opt{optgridlinewidth}, use \opt{gratinglinewidth}.
%   \item Removed deprecated \opt{align}, use \opt{coupleralign}.
%   \item Removed deprecated \opt{namingschema}.
%   \end{release}
%   \begin{release}{5.2}{2014-11-26}
%   \item Added component \cs{asphericlens}\see{comp:asphericlens}
%   \item Added component \cs{axicon}\see{comp:axicon}
%   \item Added component \cs{optwedge}\see{comp:optwedge}
%   \end{release}
%   \begin{release}{5.1}{2014-11-19}
%   \item Added component \cs{oapmirror}\see{comp:oapmirror}
%   \item Added support for filled beams with path interfaces.
%   \end{release}
%   \begin{release}{5.0}{2014-10-30}
%   \item Added support for arbitrary interface shapes (experimental,
%     requires the \opt{pst-intersect} package and \opt{pstricks}
%     version 2.53).
%   \item Added component \cs{parabolicmirror}\see{comp:parabolicmirror}
%   \end{release}
%   \begin{release}{4.10}{2014-06-04}
%   \item Added value \opt{firstcomp} to parameter \opt{beamalign}\see{prm:beamalign}
%   \item Modified \cs{optsource} to handle also the beam alignment\see{comp:optsource}
%   \end{release}
%   \begin{release}{4.9}{2014-06-03}
%   \item Added new component \cs{optsource}\see{comp:optsource}
%   \item Improved naming of the last component name, which can now be
%     accessed also by its number besides using \opt{N}.
%   \item Fixed bug related to \opt{extnodes} together with \opt{compname}
%   \end{release}
%   \begin{release}{4.8}{2014-02-28}
%   \item Added component \cs{optaom}\see{comp:optaom}
%   \item Added option \opt{beammode}\see{prm:beammode}
%   \item Added option \opt{showinterfaces}\see{prm:showinterfaces}
%   \end{release}
%   \begin{release}{4.7}{2014-01-12}
%   \item Added syntax \opt{<}\prm{num} for accessing relative component
%     IDs\see{sec:namingobj}
%   \end{release}
%   \begin{release}{4.6}{2013-11-27}
%   \item Added option \opt{extnodes}\see{prm:extnodes}
%   \item Added option \opt{optdipolecomp}\see{prm:optdipolecomp}
%   \item Added option \opt{opttripolecomp}\see{prm:opttripolecomp}
%   \end{release}
%   \begin{release}{4.5}{2013-07-21}
%   \item Added option \opt{usewirestyle}\see{prm:usewirestyle}
%   \item Added line style \opt{fade}, with options \opt{fadeto},
%     \opt{fadepoints}, \opt{fadefunc}, and
%     \opt{fadefuncname}\see{prm:fade}.
%   \end{release}
%   \begin{release}{4.4}{2013-07-14}
%   \item Added component \cs{transmissiongrating}\see{comp:transmissiongrating}
%   \item Modified \opt{innerlabel} to explicitly set \opt{labelalign=c}
%   \item Fixed trailing spaces in \opt{savebeampoints} (and \opt{savebeam}).
%   \item Allow Postscript code in \opt{angle}.
%   \end{release}
%   \begin{release}{4.3a}{2013-07-02}
%   \item Fixed tripole alignment bugs introduced in version 4.3.
%   \item Again fixed the alignment of reflective \cs{optprism}\see{prm:prismalign}
%   \item Fixed improper alignment of \cs{optprism} label\see{sec:bwd-comp-4.3a}
%   \end{release}
%   \begin{release}{4.3}{2013-06-28}
%   \item Added option \opt{raprismalign}\see{prm:raprismalign}
%   \item Fixed alignment of \cs{rightangleprism} and rotation of its
%     label.
%   \end{release}
%   \begin{release}{4.2}{2013-06-07}
%   \item Added option \opt{startinsidecount}\see{prm:startinsidecount}
%   \item Added option \opt{stopinsidecount}\see{prm:stopinsidecount}
%   \item Added option \opt{beampathcount}\see{prm:beampathcount}
%   \item Added option \opt{beamnodealign}\see{prm:beamnodealign}
%   \item Added \cs{oeBeamVecMedian}\see{cs:oeBeamVecMedian}
%   \item Added \cs{oeBeamCenter}\see{cs:oeBeamCenter}
%   \item Modified the orientation of a reflective
%     \cs{optprism}\see{sec:bwd-comp-4.2}
%   \item Fixed bug of \cs{optprism} and \cs{rightangleprism} inside
%     an \env{optexp} environment.
%   \item Fixed bug of wrong \cs{rightangleprism} rotation in special
%     cases.
%   \item Fixed buggy handling of multiple saved beams\see{prm:savebeam}
%   \end{release}
%   \begin{release}{4.1}{2013-05-21}
%   \item Added option \opt{prismtype}\see{prm:prismtype}
%   \end{release}
%   \begin{release}{4.0}{2013-04-15}
%   \item Added electrical components\see{chap:electrcomp}
%   \item Added wire connections with \cs{drawwire}\see{sec:drawwire}
%   \item Added component \cs{optarrowcomp}\see{comp:optarrowcomp}
%   \item Added component \cs{optbarcomp}\see{comp:optbarcomp}
%   \item Improved \cs{optdetector}\see{comp:optdetector}
%   \item Extended \cs{drawfiber} to support component
%     ranges\see{cs:drawfiber}
%   \item Extended \opt{couplersep} to support automatic
%     calculation\see{prm:couplersep}
%   \item Fixed appearance of \cs{optfiber}\see{sec:bwd-comp-4.0}
%   \item Fixed \opt{extnodealign} to affect also
%     multipoles\see{prm:extnodealign}
%   \item Fixed \opt{pswarning}.
%   \item Removed old, buggy beam connection code\see{sec:bwd-comp-4.0}
%   \item Removed option \opt{conn}\see{sec:bwd-comp-4.0}
%   \item Removed option \opt{connjoin}\see{sec:bwd-comp-4.0}
%   \item Removed \cs{newOptexpDipoleNolabel}\see{sec:bwd-comp-4.0}
%   \end{release}
%   \begin{release}{3.6}{2013-03-20}
%   \item Added option \opt{compoffset}\see{prm:compoffset}
%   \item Added option \opt{beampathskip}\see{prm:beampathskip}
%   \item Added option \opt{innercompalign}\see{prm:innercompalign}
%   \item Fixed some bugs in the raytracing and beam code.
%   \end{release}
%   \begin{release}{3.5}{2013-02-22}
%   \item Added option \opt{filterangle}\see{prm:filterangle}
%   \item Fixed wrong output fiber style in \cs{optcoupler}
%   \item Fixed strange Postscript error which occured with some
%     interpreters.
%   \end{release}
%   \begin{release}{3.4}{2013-02-03}
%   \item Fixed bugs when using \opt{fillstyle} for some components.
%   \item Extended option \opt{switchsize}\see{comp:optswitch}
%   \item Modified coupler center node to be on the base
%     line\see{sec:centernode}
%   \item Extended error checking for \cs{drawbeam} and
%     \cs{drawfiber}\see{sec:accessobj}
%   \item Fixed some bugs in the connection code.
%   \end{release}
%   \begin{release}{3.3a}{2012-09-18}
%   \item Fixed bug which was exposed by an update of pst-node.
%   \item Fixed trailing spaces.
%   \end{release}
%   \begin{release}{3.3}{2012-08-17}
%   \item Extended \cs{opttripole} and \cs{optdipole}\see{comp:optdipole}
%   \item Modified reference angle for label of
%     \cs{opttripole}\see{sec:bwd-comp-3.3}
%   \item Added option \opt{optdipolesize} to support two interfaces for
%     \cs{optdipole}\see{prm:optdipolesize}
%   \item Added option \opt{gratingalign}\see{prm:gratingalign}
%   \item Added option \opt{forcebeaminside}\see{prm:forcebeaminside}
%   \item Extended option \opt{mirrorradius}\see{prm:mirrorradius}
%   \item Improved \cs{drawbeam} and \cs{drawwidebeam} to be able to use
%     \opt{ArrowInside} without linestyle\see{prm:ArrowInsideMaxLength}
%   \item Fixed orientation of \cs{oenodeBeamUp} and
%     \cs{oenodeBeamLow}\see{cs:oenodeBeamUp}
%   \item Fixed a bug related to \opt{beaminside} and ambiguous
%     components.
%   \item Fixed some trailing spaces.
%   \item Added more examples\see{sec:examples}
%   \end{release}
%   \begin{release}{3.2}{2012-07-26}
%   \item Added component \cs{glanthompson}\see{comp:glanthompson}
%   \item Added access to beam vectors with \cs{oeBeamVec},
%     \cs{oeBeamVecUp} and \cs{oeBeamVecLow}\see{cs:oeBeamVec}
%   \item Fixed wrong computation of node distance in \cs{fiberbox}
%   \item Fixed bug in \cs{wdmsplitter} for \opt{coupleralign=b} and
%     \opt{couplertype=none}
%   \item Fixed bug when filling components placed with
%     \opt{position=end}/\opt{start}
%   \item Added value \opt{absolute} to parameter
%     \opt{labelref}\see{prm:labelref}
%   \item Added examples\see{sec:examples}
%   \end{release}
%   \begin{release}{3.1}{2012-07-17}
%   \item Added component \cs{fiberbox}\see{comp:fiberbox}
%   \item Extended connection macros to not required curly braces around
%     node parenthesis any more\see{sec:namingobj}
%   \item Modified \cs{fibercollimator} to have
%     \opt{allowbeaminside=false} by default\see{comp:fibercollimator}
%   \item Extended fiber couplers to allow using only two
%     nodes\see{sec:coupler}
%   \item Fixed a bug concerning node expressions with \cs{drawfiber}
%   \end{release}
%   \begin{release}{3.0}{2012-07-09}
%   \item Modified beam connections with \cs{drawbeam} to support
%     raytracing\see{cs:drawbeam}
%   \item Added wide beams with \cs{drawwidebeam}\see{cs:drawwidebeam}
%   \item Added \cs{drawfiber} for fiber connections\see{cs:drawfiber}
%   \item Added \opt{optexp} environment for layering of components and
%     connections\see{sec:layers}
%   \item Added german documentation.
%   \item Modified naming of component nodes\see{sec:objnodes}
%   \item Modified \opt{extnode} to work with more
%     components\see{prm:extnode}
%   \item Modified \opt{angle} and \opt{rotateref} to affect all
%     components\see{sec:rotshift}
%   \item Modified \opt{endbox} to affect all
%     components\see{sec:positioning}
%   \item Extended \opt{position} by values \opt{start} and
%     \opt{end}\see{sec:positioning}
%   \item Extended \opt{abspos} by values \opt{start} and
%     \opt{end}\see{sec:positioning}
%   \item Removed deprecated lens code which used \opt{lenswidth} and
%     \opt{lensheight} for construction\see{comp:lens}
%   \item Added option \opt{platesize}\see{prm:platesize}
%   \item Added option \opt{phwidth}\see{comp:pinhole}
%   \item Modified option \opt{caxislength}\see{comp:crystal}
%   \item Deprecated option \opt{lampscale}\see{comp:crystal}
%   \item Added style \opt{CrystalCaxis}\see{comp:crystal}
%   \item Added style \opt{CrystalLamp}\see{comp:crystal}
%   \item Added option \opt{optboxsize}\see{comp:optbox}
%   \item Extended option \opt{detsize}\see{comp:optdetector}
%   \item Added style \opt{DetectorStyle}\see{comp:optdetector}
%   \item Removed deprecated \cs{detector}, use
%     \cs{optdetector}\see{comp:optdetector}
%   \item Extended option \opt{doveprismsize}\see{comp:doveprism}
%   \item Added style \opt{Polarization}\see{comp:polarization}
%   \item Deprecated option \opt{pollinewidth}\see{comp:polarization}
%   \item Removed option \opt{polwidth}\see{comp:polarization}
%   \item Removed option \opt{pol}\see{comp:polarization}
%   \item Added style \opt{VariableStyle}\see{comp:mirror}
%   \item Added mirror type \opt{semitrans}\see{prm:mirrortype}
%   \item Renamed \cs{optgrid} to \cs{optgrating}\see{comp:optgrating}
%   \item Renamed \opt{optgridwidth} to
%     \opt{gratingwidth}\see{comp:optgrating}
%   \item Renamed \opt{optgridheight} to
%     \opt{gratingheight}\see{comp:optgrating}
%   \item Renamed \opt{optgriddepth} to
%     \opt{gratingdepth}\see{comp:optgrating}
%   \item Renamed \opt{optgridcount} to
%     \opt{gratingcount}\see{comp:optgrating}
%   \item Renamed \opt{optgridtype} to
%     \opt{gratingtype}\see{comp:optgrating}
%   \item Renamed \opt{optgridlinewidth} to
%     \opt{gratinglinewidth}\see{comp:optgrating}
%   \item Added option \opt{prismalign}\see{comp:optprism}
%   \item Modified faulty alignment of
%     \cs{rightangleprism}\see{comp:rightangleprism}
%   \item Extended option \opt{optampsize}\see{comp:optamp}
%   \item Extended option \opt{optmzmsize}\see{comp:optmzm}
%   \item Added option \opt{polcontroltype}\see{comp:polcontrol}
%   \item Extended option \opt{isolatorsize}\see{comp:optisolator}
%   \item Added style \opt{IsolatorArrow}\see{comp:optisolator}
%   \item Extended option \opt{fdlsize}\see{comp:fiberdelayline}
%   \item Added style \opt{FdlArrow}\see{comp:fiberdelayline}
%   \item Extended option \opt{fiberpolsize}\see{comp:optfiberpolarizer}
%   \item Added component \cs{optcirculator}\see{comp:optcirculator}
%   \item Extended option \opt{couplersize}\see{comp:optcoupler}
%   \item Extended option \opt{couplertype}\see{comp:optcoupler}
%   \item Renamed option \opt{align} to
%     \opt{coupleralign}\see{comp:optcoupler}
%   \item Added style \opt{VariableCoupler}\see{comp:optcoupler}
%   \item Added style \opt{FilterStyle}\see{comp:optfilter}
%   \item Extended option \opt{fibercolsize}\see{comp:fibercollimator}
%   \item Removed deprecated option \opt{labelrelative}\see{sec:labels}
%   \item Removed deprecated option \opt{iwidth}\see{comp:pinhole}
%   \item Removed deprecated option \opt{owidth}\see{comp:pinhole}
%   \item Removed deprecated option \opt{bswidth}\see{comp:beamsplitter}
%   \item Deprecated \cs{newOptexpDipoleNolabel}, use
%     \cs{newOptexpDipole}\see{sec:newobj}
%   \item Deprecated option
%     \opt{refractiveindex}\see{prm:refractiveindex}
%   \item Deprecated option \opt{conn}\see{sec:drawbeam}
%   \item Extended option \opt{fiber}\see{prm:fiber}
%   \end{release}
%   \begin{release}{2.1}{2009-11-05}
%   \item Added component
%     \cs{optfiberpolarizer}\see{comp:optfiberpolarizer}
%   \item Added option \opt{compshift}\see{prm:compshift}
%   \item Added option \opt{label}\see{prm:label}
%   \item Added option \opt{connjoin}
%   \item Added options \opt{addtoBeam} and
%     \opt{newBeam}\see{sec:drawbeam}
%   \item Added style \opt{OptComp} and related options
%     \opt{addtoOptComp} and \opt{newOptComp}\see{sec:appearance}
%   \item Added option \opt{bsstyle}\see{comp:beamsplitter}
%   \item Extended \cs{fibercollimator} to use up to four reference
%     nodes\see{comp:fibercollimator}
%   \item Improved \opt{thicklens} to work also with plain
%     lenses\see{prm:thicklens}
%   \item Use pst-doc class for the documentation.
%   \end{release}
%
%   \begin{release}{2.0}{2008-07-27}
%     \item Added fiber-optical components\see{chap:fibercomp}
%     \item Added component \cs{optdiode}\see{comp:optdiode}
%     \item Added component \cs{pentaprism}\see{comp:pentaprism}
%     \item Added component
%       \cs{rightangleprism}\see{comp:rightangleprism}
%     \item Added component \cs{doveprism}\see{comp:doveprism}
%     \item Added component \cs{optprism}\see{comp:optprism}
%     \item Added \cs{drawbeam}\see{sec:drawbeam}
%     \item Added component connections (options \opt{fiber}, \opt{conn}
%       and \opt{beam})\see{chap:connecting}
%     \item Added option \opt{compname}\see{prm:compname}
%     \item Added option \opt{extnode}\see{prm:extnode}
%     \item Renamed \cs{detector} to
%       \cs{optdetector}\see{comp:optdetector}
%   \end{release}
%   \begin{release}{1.2}{2008-06-17}
%   \item Modified lens design to use interface curvatures\see{comp:lens}
%   \item Added options \opt{lensradiusleft} and
%     \opt{lensradiusright}\see{comp:lens}
%   \item Added option \opt{thicklens}\see{comp:lens}
%   \item Added option \opt{lenstype}\see{comp:lens}
%   \item Added option \opt{mirrorradius} (curved
%     mirrors)\see{comp:mirror}
%   \item Added option \opt{optgridtype} (binary
%     gratings)\see{comp:optgrating}
%   \item Added \cs{newOptexpDipole}\see{sec:newobj}
%   \item Added \cs{newOptexpDipoleNolabel}\see{sec:newobj}
%   \item Added \cs{newOptexpTripole}\see{sec:newobj}
%   \item Added \cs{newOptexpFiberDipole}\see{sec:newobj}
%   \item General improvements of \TeX{} and Postscript code
%   \end{release}
%   \begin{release}{1.1}{2007-09-06}
%   \item Improved labeling features\see{sec:labels}
%   \item Added parameter \opt{labelref}\see{sec:labels}
%   \item Replaced \opt{labelrelative} by
%     \opt{labelref=relative}\see{sec:labels}
%   \item Renamed \cs{polarisation} to
%     \cs{polarization}\see{comp:polarization}
%   \item Renamed \opt{polwidth} to \opt{polsize}\see{comp:polarization}
%   \item Renamed \opt{pol} to \opt{poltype}\see{comp:polarization}
%   \item Renamed \opt{bswidth} to \opt{bssize}\see{comp:beamsplitter}
%   \item Renamed \opt{iwidth} to \opt{innerheight}\see{comp:pinhole}
%   \item Renamed \opt{owidth} to \opt{outerheight}\see{comp:pinhole}
%   \item Added support for fillstyle for all components
%   \end{release}
%
%   \begin{release}{1.0}{2007-07-18}
%   \item First CTAN version
%   \end{release}
% \end{changelog}
%
% \StopEventually{}
%
%   \begin{otherlanguage}{english}
%    \printindex[idx]
%  \end{otherlanguage}
%
% \chapter{The \LaTeX/\TeX\ implementation}
%<*stylefile>
% \section{Requirements}
%    \begin{macrocode}
\RequirePackage{ifthen}
\RequirePackage{pstricks}
\RequirePackage{pst-xkey}
\RequirePackage{pst-node}
\RequirePackage{pst-plot}
\RequirePackage{multido}
\RequirePackage{pst-eucl}
\RequirePackage{pst-intersect}
\RequirePackage{pstricks-add}
\RequirePackage{environ}
%    \end{macrocode}
% Add the Postscript header file.
%    \begin{macrocode}
\@addtofilelist{pst-optexp.pro}{}%
\pst@addfams{optexp}
\pstheader{pst-optexp.pro}
%    \end{macrocode}
% This holds a comma-separated list of all component names which are
% defined in a \nxLenv{pspicture} environment. The list is cleared when
% leaving the \nxLenv{pspicture} environment.
%    \begin{macrocode}
\gdef\POE@complist{}%
%    \end{macrocode}
% This hold a comma-separated list of the numbers of all saved beam end
% points in a \nxLenv{pspicture} environment. The list is used to delete
% all remaining Postscript information about the saved beams when
% leaving the current \nxLenv{pspicture}, as they may cause problems
% inside any following optexp-drawing.
%    \begin{macrocode}
\gdef\POE@beamlist{1}%
\g@addto@macro{\endpspicture}{%
%    \end{macrocode}
% Undefine all beam nodes at the end of the \nxLenv{pspicture}.
%    \begin{macrocode}
  \expandafter\XKV@for@n\expandafter{\POE@beamlist}\POE@temp{%
    \POE@Verb{%
      /lastBeamPointUp\POE@temp\space 
      /lastBeamPointLow\POE@temp\space 
      /lastBeamPoint\POE@temp\space 
      3 { currentdict exch undef } repeat 
      /N@\oenodeBeam{\POE@temp} 
      /N@\oenodeBeamUp{\POE@temp} 
      /N@\oenodeBeamLow{\POE@temp}
      3 { tx@NodeDict exch undef } repeat
    }%
  }%
%    \end{macrocode}
% Reset the component list.
%    \begin{macrocode}
  \gdef\POE@complist{}\gdef\POE@beamlist{1}\global\POE@cnt=0\relax
}%
%    \end{macrocode}
% Some convenience definitions.
%    \begin{macrocode}
\def\pst@optexpdict{tx@OptexpDict begin }
\def\POE@dict#1{\pst@optexpdict #1 end}
\def\POE@Verb#1{\pst@Verb{\pst@optexpdict #1 end }}%
%    \end{macrocode}
% Save the pstricks-add line definition for use with the beams
%    \begin{macrocode}
\let\POE@tx@Line\tx@Line
\SpecialCoor
%    \end{macrocode}
%
% \section{Basic definitions}
% \subsection{Switches for the boolean keys}
% See respective key definitions for explanation.
%    \begin{macrocode}
\newif\ifPOE@backlayer
\newif\ifPOE@frontlayer
\newif\ifPOE@optexpenv
\newif\ifPOE@variable
\newif\ifPOE@voltage
\newif\ifPOE@caxisinv
\newif\ifPOE@reverse
\newif\ifPOE@lamp
\newif\ifPOE@component@optional
\newif\ifPOE@debug@showoptdots
\newif\ifPOE@debug@showifcnodes
\newif\ifPOE@debug@showinterfaces
\newif\ifPOE@endbox
\newif\ifPOE@startbox
\newif\ifPOE@thicklens
\newif\ifPOE@usefiberstyle
\newif\ifPOE@usewirestyle
\newif\ifPOE@fiberin@
\newif\ifPOE@fiberin@top
\newif\ifPOE@fiberin@bottom
\newif\ifPOE@fiberout@
\newif\ifPOE@fiberout@top
\newif\ifPOE@fiberout@bottom
\newif\ifPOE@fiberpresetin@
\newif\ifPOE@fiberpresetin@top
\newif\ifPOE@fiberpresetin@bottom
\newif\ifPOE@fiberpresetout@
\newif\ifPOE@fiberpresetout@top
\newif\ifPOE@fiberpresetout@bottom
\newif\ifPOE@wirein@
\newif\ifPOE@wirein@top
\newif\ifPOE@wirein@bottom
\newif\ifPOE@wireout@
\newif\ifPOE@wireout@top
\newif\ifPOE@wireout@bottom
\newif\ifPOE@wirepresetin@
\newif\ifPOE@wirepresetin@top
\newif\ifPOE@wirepresetin@bottom
\newif\ifPOE@wirepresetout@
\newif\ifPOE@wirepresetout@top
\newif\ifPOE@wirepresetout@bottom
\newif\ifPOE@beam
\newif\ifPOE@startinside
\newif\ifPOE@stopinside
\newif\ifPOE@beaminsidefirst
\newif\ifPOE@beaminsidelast
\newif\ifPOE@savebeam
\newif\ifPOE@loadbeam
\newif\ifPOE@beaminside
\newif\ifPOE@raytrace
\newif\ifPOE@pswarning
\newif\ifPOE@useNA
%    \end{macrocode}
% This is to check if \nxLkeyword{compname} is set inside or outside of a component. For this no boolean key is provided.
%    \begin{macrocode}
\newif\ifPOE@insideobj\POE@insideobjfalse
%    \end{macrocode}
%
% \subsection{Counters}
% Count the components in one \nxLenv{pspicture} environment.
%    \begin{macrocode}
\newcount\POE@cnt
%    \end{macrocode}
% Save the current count at the end of the optexp-environment, before
% the second pass.
%    \begin{macrocode}
\newcount\POE@oldcnt
%    \end{macrocode}
% Count the temporal planes which are created for connections to nodes.
%    \begin{macrocode}
\newcount\POE@nodecnt
%    \end{macrocode}
% Count the number of input nodes of a wdmcoupler, or output nodes of a wdmsplitter
%    \begin{macrocode}
\newcount\POE@couplernodecount
%    \end{macrocode}
%
% \subsection{Fixed strings}
% These are all the fixed strings which are used as possible values for
% choicekeys.
%    \begin{macrocode}
\def\POE@str@absolute{absolute}
\def\POE@str@auto{auto}
\def\POE@str@bandpass{bandpass}
\def\POE@str@bandstop{bandstop}
\def\POE@str@binary{binary}
\def\POE@str@blazed{blazed}
\def\POE@str@bottom{bottom}
\def\POE@str@center{center}
\def\POE@str@circle{circle}
\def\POE@str@closed{closed}
\def\POE@str@connection{connection}
\def\POE@str@coupling{coupling}
\def\POE@str@cross{cross}
\def\POE@str@cube{cube}
\def\POE@str@custom{custom}
\def\POE@str@default{default}
\def\POE@str@diode{diode}
\def\POE@str@directional{directional}
\def\POE@str@ellipse{ellipse}
\def\POE@str@elliptic{elliptic}
\def\POE@str@extended{extended}
\def\POE@str@global{global}
\def\POE@str@highpass{highpass}
\def\POE@str@lcirc{lcirc}
\def\POE@str@left{left}
\def\POE@str@linear{linear}
\def\POE@str@lowpass{lowpass}
\def\POE@str@misc{misc}
\def\POE@str@none{none}
\def\POE@str@opened{opened}
\def\POE@str@parallel{parallel}
\def\POE@str@perp{perp}
\def\POE@str@piezo{piezo}
\def\POE@str@plain{plain}
\def\POE@str@plate{plate}
\def\POE@str@pulse{pulse}
\def\POE@str@quiet{quiet}
\def\POE@str@rcirc{rcirc}
\def\POE@str@rectangle{rectangle}
\def\POE@str@reflective{reflective}
\def\POE@str@relative{relative}
\def\POE@str@relgrav{relgrav}
\def\POE@str@right{right}
\def\POE@str@round{round}
\def\POE@str@sawtooth{sawtooth}
\def\POE@str@semitrans{semitrans}
\def\POE@str@sine{sine}
\def\POE@str@standard{standard}
\def\POE@str@symmetric{symmetric}
\def\POE@str@top{top}
\def\POE@str@transmittive{transmittive}
\def\POE@str@transparency{transparency}
\def\POE@str@triangle{triangle}
\def\POE@str@vector{vector}
\def\POE@str@verbose{verbose}
%    \end{macrocode}
%
% \section{Parameter and style definitions}
% The parameters and styles are commented quiet well in the user documentation,
% here you will find only additional comments about technical peculiarities.
%    \begin{macrocode}
\newpsstyle{OptComp}{}%
\define@key[psset]{optexp}{newOptComp}{%
  \newpsstyle{OptComp}{#1}%
}
\define@key[psset]{optexp}{addtoOptComp}{%
  \addtopsstyle{OptComp}{#1}%
}
\newpsstyle{OptionalStyle}{linestyle=dashed,dash=1.5pt 1pt}%
\newpsstyle{IfcNodeStyle}{dotstyle=x, dotscale=1.5, linecolor=blue}%
\newpsstyle{IfcStyle}{linestyle=dashed, dash=1pt 1pt, linecolor=red!70!black}%
\newpsstyle{Beam}{linecolor=green!90!black, linejoin=1}%
\define@key[psset]{optexp}{newBeam}{%
  \newpsstyle{Beam}{#1}%
}
\define@key[psset]{optexp}{addtoBeam}{%
  \addtopsstyle{Beam}{#1}%
}
%    \end{macrocode}
% Styles for the automatic fiber connections.
%    \begin{macrocode}
\newpsstyle{Fiber}{}%
\define@key[psset]{optexp}{newFiber}{%
  \newpsstyle{Fiber}{#1}%
}
\define@key[psset]{optexp}{addtoFiber}{%
  \addtopsstyle{Fiber}{#1}%
}
\newpsstyle{FiberIn}{style=Fiber}%
\define@key[psset]{optexp}{newFiberIn}{%
  \newpsstyle{FiberIn}{#1}%
}
\define@key[psset]{optexp}{addtoFiberIn}{%
  \addtopsstyle{FiberIn}{#1}%
}
\newpsstyle{FiberOut}{style=Fiber}%
\define@key[psset]{optexp}{newFiberOut}{%
  \newpsstyle{FiberOut}{#1}%
}
\define@key[psset]{optexp}{addtoFiberOut}{%
  \addtopsstyle{FiberOut}{#1}%
}
\newpsstyle{FiberIn1}{style=FiberIn}%
\define@key[psset]{optexp}{newFiberIn1}{%
  \newpsstyle{FiberIn1}{#1}%
}
\define@key[psset]{optexp}{addtoFiberIn1}{%
  \addtopsstyle{FiberIn1}{#1}%
}
\newpsstyle{FiberIn2}{style=FiberIn}%
\define@key[psset]{optexp}{newFiberIn2}{%
  \newpsstyle{FiberIn2}{#1}%
}
\define@key[psset]{optexp}{addtoFiberIn2}{%
  \addtopsstyle{FiberIn2}{#1}%
}
\newpsstyle{FiberOut1}{style=FiberOut}%
\define@key[psset]{optexp}{newFiberOut1}{%
  \newpsstyle{FiberOut1}{#1}%
}
\define@key[psset]{optexp}{addtoFiberOut1}{%
  \addtopsstyle{FiberOut1}{#1}%
}
\newpsstyle{FiberOut2}{style=FiberOut}%
\define@key[psset]{optexp}{newFiberOut2}{%
  \newpsstyle{FiberOut2}{#1}%
}
\define@key[psset]{optexp}{addtoFiberOut2}{%
  \addtopsstyle{FiberOut2}{#1}%
}
%    \end{macrocode}
%
% Electrical connection stuff
%    \begin{macrocode}
\newpsstyle{Wire}{}
\define@key[psset]{optexp}{newWire}{%
  \newpsstyle{Wire}{#1}%
}
\define@key[psset]{optexp}{addtoWire}{%
  \addtopsstyle{Wire}{#1}%
}
\newpsstyle{WireIn}{style=Wire}
\define@key[psset]{optexp}{newWireIn}{%
  \newpsstyle{WireIn}{#1}%
}
\define@key[psset]{optexp}{addtoWireIn}{%
  \addtopsstyle{WireIn}{#1}%
}
\newpsstyle{WireIn1}{style=WireIn}
\define@key[psset]{optexp}{newWireIn1}{%
  \newpsstyle{WireIn1}{#1}%
}
\define@key[psset]{optexp}{addtoWireIn1}{%
  \addtopsstyle{WireIn1}{#1}%
}
\newpsstyle{WireIn2}{style=WireIn}
\define@key[psset]{optexp}{newWireIn2}{%
  \newpsstyle{WireIn2}{#1}%
}
\define@key[psset]{optexp}{addtoWireIn2}{%
  \addtopsstyle{WireIn2}{#1}%
}
\newpsstyle{WireOut}{style=Wire}
\define@key[psset]{optexp}{newWireOut}{%
  \newpsstyle{WireOut}{#1}%
}
\define@key[psset]{optexp}{addtoWireOut}{%
  \addtopsstyle{WireOut}{#1}%
}
\newpsstyle{WireOut1}{style=WireOut}
\define@key[psset]{optexp}{newWireOut1}{%
  \newpsstyle{WireOut1}{#1}%
}
\define@key[psset]{optexp}{addtoWireOut1}{%
  \addtopsstyle{WireOut1}{#1}%
}
\newpsstyle{WireOut2}{style=WireOut}
\define@key[psset]{optexp}{newWireOut2}{%
  \newpsstyle{WireOut2}{#1}%
}
\define@key[psset]{optexp}{addtoWireOut2}{%
  \addtopsstyle{WireOut2}{#1}%
}
\newpsstyle{ElecComp}{}
%    \end{macrocode}
% Special styles to change only a part of some devices.
%    \begin{macrocode}
\newpsstyle{ExtendedMirror}{%
  linestyle=none, hatchwidth=0.5\pslinewidth,
  hatchsep=1.4\pslinewidth, fillstyle=hlines
}%
\newpsstyle{VariableStyle}{%
  linewidth=0.8\pslinewidth, arrowinset=0, arrowscale=0.8, arrows=<->
}
\newpsstyle{SemitransMirror}{linestyle=none, fillstyle=solid,fillcolor=black!30}%
\newpsstyle{PiezoMirror}{fillstyle=solid,fillcolor=black!30}%
\newpsstyle{IsolatorArrow}{linewidth=2\pslinewidth, arrowinset=0}
\newpsstyle{CrystalCaxis}{%
  linestyle=dashed, dash=2pt 2pt, linewidth=0.7\pslinewidth, 
  arrowinset=0, arrows=->
}
\newpsstyle{CrystalLamp}{linewidth=0.6\pslinewidth}
\newpsstyle{FdlArrow}{arrowinset=0, arrows=->}
\newpsstyle{VariableCoupler}{arrowinset=0, arrows=->}
%    \end{macrocode}
%
% \subsection{General parameters}
%    \begin{macrocode}
\define@boolkey[psset]{optexp}[POE@component@]{optional}[true]{}
\define@boolkey[psset]{optexp}[POE@]{usefiberstyle}[true]{}
\define@choicekey[psset]{optexp}{usewirestyle}%
  [\val\nr]{true,false}[true]{%
    \psset[optexp]{usefiberstyle=false}%
    \ifcase\nr\relax
      \POE@usewirestyletrue
    \or
      \POE@usewirestylefalse
    \fi}%
\define@boolkey[psset]{optexp}[POE@]{usewirestyle}[true]{}
\define@boolkey[psset]{optexp}[POE@debug@]{showoptdots}[true]{}
\define@boolkey[psset]{optexp}[POE@debug@]{showifcnodes}[true]{}
\define@boolkey[psset]{optexp}[POE@debug@]{showinterfaces}[true]{}
%    \end{macrocode}
% The positioning parameters.
%    \begin{macrocode}
\define@boolkey[psset]{optexp}[POE@]{endbox}[true]{}
\define@boolkey[psset]{optexp}[POE@]{startbox}[true]{}
\define@choicekey*+[psset]{optexp}{position}[\val\nr]{start,end}{%
  \ifcase\nr\relax
    \psset[optexp]{startbox, endbox=false}%
  \or
    \psset[optexp]{startbox=false, endbox=true}%
  \fi
}{%
  \psset[optexp]{startbox=false, endbox=false}%
  \edef\POE@key@position{#1}%
}%
\define@choicekey*+[psset]{optexp}{abspos}[\val\nr]{start,end}{%
  \ifcase\nr\relax
    \psset[optexp]{startbox, endbox=false}%
  \or
    \psset[optexp]{startbox=false, endbox=true}%
  \fi
}{%
  \psset[optexp]{startbox=false, endbox=false}%
  \edef\POE@key@abspos{#1}%
}%
\define@key[psset]{optexp}{compshift}{%
  \pst@checknum{#1}\POE@key@compshift
}
\define@key[psset]{optexp}{angle}{%
  \pst@checknum{#1}\POE@key@angle
}
\define@key[psset]{optexp}{compoffset}{%
  \pst@checknum{#1}\POE@key@compoffset
}
\define@choicekey+[psset]{optexp}{innercompalign}%
  [\val\nr]{rel,abs,relative,absolute}%
  {%
    \ifcase\nr\relax
      \let\POE@key@innercompalign\POE@str@relative
    \or
      \let\POE@key@innercompalign\POE@str@absolute
    \else
      \def\POE@key@innercompalign{#1}%
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for innercompalign}}%
\psset[optexp]{%
  position={},
  abspos={},
  compshift=0,
  compoffset=0,
  innercompalign=relative,
  angle=0
}%
%    \end{macrocode}
% Layering
%    \begin{macrocode}
\define@boolkey[psset]{optexp}[POE@]{backlayer}[true]{}
\define@boolkey[psset]{optexp}[POE@]{frontlayer}[true]{}
\define@boolkey[psset]{optexp}[POE@]{optexpenv}[true]{}
\psset[optexp]{backlayer, frontlayer}%
%    \end{macrocode}
% Labels
%    \begin{macrocode}
\newcommand{\oelabel}[1]{#1}%
\define@key[psset]{optexp}{labelangle}{%
  \pst@checknum{#1}\POE@key@labelangle
}
\define@key[psset]{optexp}{labeloffset}{%
  \pst@checknum{#1}\POE@key@labeloffset
}
\define@key[psset]{optexp}{labelstyle}{%
  \def\POE@key@labelstyle{#1}%
}
\define@key[psset]{optexp}{labelalign}{%
  \def\POE@key@labelalign{#1}%
}
\define@choicekey+[psset]{optexp}{labelref}%
  [\val\nr]{absolute,relative,relgrav,global}%
  {%
    \ifcase\nr\relax
      \let\POE@key@labelref\POE@str@global
    \else
      \def\POE@key@labelref{#1}%
    \fi
  }{%
    \PackageError{pst-optexp}%
      {Unknown value '\val' for labelref}%
}%
\define@choicekey*+[psset]{optexp}{innerlabel}%
  [\val\nr]{true}[true]%
  {\ifcase\nr\relax
     \psset[optexp]{labeloffset=0, labelref=relative, labelalign=c}%
   \fi}
  {\PackageError{pst-optexp}{Unknown value '\val' for innerlabel}}%
\define@key[psset]{optexp}{label}{%
  \pst@expandafter\POE@psset@@label{#1} {} {} {} {} {}\@nil
}%
\def\POE@psset@@label#1 #2 #3 #4 #5\@nil{%
  \edef\POE@temp{#4}%
  \ifx\POE@temp\@empty\else
    \expandafter\ifx\POE@temp.\else
      \psset[optexp]{labelref=#4}%
    \fi
  \fi
  \edef\POE@temp{#3}%
  \ifx\POE@temp\@empty\else
    \expandafter\ifx\POE@temp.\else
      \psset[optexp]{labelalign=#3}%
    \fi
  \fi
  \edef\POE@temp{#2}%
  \ifx\POE@temp\@empty\else
    \expandafter\ifx\POE@temp.\else
      \psset[optexp]{labelangle=#2}%
    \fi
  \fi
  \edef\POE@temp{#1}%
  \ifx\POE@temp\@empty\else
    \expandafter\ifx\POE@temp.\else
      \psset[optexp]{labeloffset=#1}%
    \fi
  \fi
}%
%    \end{macrocode}
% This is for internal use only, it sets the reference angle for the \opt{labelangle} parameter and can be different for some components.
%    \begin{macrocode}
\define@key[psset]{optexp}{ref@angle}{%
  \pst@checknum{#1}\POE@key@labelrefangle
}%
\psset[optexp]{%
  labeloffset=0.8,
  labelangle=0,
  labelstyle=,
  labelalign=c,
  labelref=relgrav,
  ref@angle=180
}%
%    \end{macrocode}
% External node
%    \begin{macrocode}
\define@choicekey+[psset]{optexp}{extnodealign}%
  [\val\nr]{rel,abs,relative,absolute}%
  {%
    \ifcase\nr\relax
      \let\POE@key@extnodealign\POE@str@relative
    \or
      \let\POE@key@extnodealign\POE@str@absolute
    \else
      \def\POE@key@extnodealign{#1}%
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for extnodealign}}
%    \end{macrocode}
% This part was copied and adapted from \cs{psset@@ref} from pstricks.tex
%    \begin{macrocode}
\define@key[psset]{optexp}{extnodes}{%
  \edef\POE@key@extnode{#1}%
  \ifx\@empty\POE@key@extnode
    \edef\POE@key@extnode@cnt{1}%
    \edef\POE@key@extnode@xrefs{0 }%
    \edef\POE@key@extnode@yrefs{0 }%
  \else
    \def\POE@key@extnode@xrefs{}%
    \def\POE@key@extnode@yrefs{}%
    \psForeach{\POE@tempD}{#1,}{%
      \ifx\POE@tempD\@empty
        \advance\psLoopIndex by -1
      \else
        \pst@expandafter\POE@psset@@extnode{\POE@tempD}\@empty,,\@nil
        \edef\POE@key@extnode@xrefs{\POE@key@extnode@xrefs\POE@key@extnode@xref\space}%
        \edef\POE@key@extnode@yrefs{\POE@key@extnode@yrefs\POE@key@extnode@yref\space}%
      \fi
    }%
    \edef\POE@key@extnode@cnt{\the\psLoopIndex}%
  \fi
}%
%    \end{macrocode}
% Need to have two options 'extnode' and 'extnodes' to allow extnode={-0.5,1} without 
%    \begin{macrocode}
\define@key[psset]{optexp}{extnode}{%
  \edef\POE@key@extnode{#1}%
  \edef\POE@key@extnode@cnt{1}%
  \ifx\@empty\POE@key@extnode
    \edef\POE@key@extnode@xrefs{0 }%
    \edef\POE@key@extnode@yrefs{0 }%
  \else
    \pst@expandafter\POE@psset@@extnode{#1}\@empty,,\@nil
    \edef\POE@key@extnode@xrefs{\POE@key@extnode@xref}%
    \edef\POE@key@extnode@yrefs{\POE@key@extnode@yref}%
  \fi
}%
\def\POE@key@extnode@xref{0}%
\def\POE@key@extnode@yref{0}%
\def\POE@psset@@extnode#1#2,#3,#4\@nil{%
  \def\POE@key@extnode@xref{0}%
  \def\POE@key@extnode@yref{0}%
  \ifx\@empty#3\@empty
    \@nameuse{POE@getref@#1}%
    \@nameuse{POE@getref@#2}%
  \else
    \pst@checknum{#1#2}\POE@key@extnode@xref%
    \pst@checknum{#3}\POE@key@extnode@yref%
  \fi
}%
\def\POE@getref@c{}%
\def\POE@getref@t{\def\POE@key@extnode@yref{1}}%
\def\POE@getref@b{\def\POE@key@extnode@yref{-1}}%
\def\POE@getref@l{\def\POE@key@extnode@xref{-1}}%
\def\POE@getref@r{\def\POE@key@extnode@xref{1}}%
\psset[optexp]{%
  extnode=\@empty, 
  extnodealign=absolute
}%
%    \end{macrocode}
% Set the rotation reference point. For this to work properly, the components
% must define a proper \cs{component@ref} macro which sets the origin and
% sizes. See below for detailed information.
%    \begin{macrocode}
\define@key[psset]{optexp}{rotateref}{%
   \def\POE@temp{#1}%
   \ifx\@empty\POE@temp\else
      \pst@expandafter\POE@psset@@rotateref{#1}\@empty,,\@nil
   \fi
}%
\def\POE@key@rotate@xref{0}%
\def\POE@key@rotate@yref{0}%
\def\POE@psset@@rotateref#1#2,#3,#4\@nil{%
  \def\POE@key@rotate@xref{0}%
  \def\POE@key@rotate@yref{0}%
  \ifx\@empty#3\@empty
    \@nameuse{POE@getref@rotate@#1}%
    \@nameuse{POE@getref@rotate@#2}%
  \else
    \pst@checknum{#1#2}\POE@key@rotate@xref%
    \pst@checknum{#3}\POE@key@rotate@yref%
  \fi}%
\def\POE@getref@rotate@c{}%
\def\POE@getref@rotate@t{\def\POE@key@rotate@yref{1}}%
\def\POE@getref@rotate@b{\def\POE@key@rotate@yref{-1}}%
\def\POE@getref@rotate@l{\def\POE@key@rotate@xref{-1}}%
\def\POE@getref@rotate@r{\def\POE@key@rotate@xref{1}}%
\psset[optexp]{rotateref=c}%
%    \end{macrocode}
% Naming parameters.
%    \begin{macrocode}
\edef\POE@str@basicname@default{@}%
\edef\POE@str@basicname@prefix{OE@}%
\gdef\POE@str@basicname@sep{}%
\edef\POE@str@extnode@postfix{Ext}%
\define@key[psset]{optexp}{b@sicname}{%
  \edef\POE@key@b@sicname{\POE@str@basicname@prefix#1}%
}%
\define@key[psset]{optexp}{compname}{%
  \ifPOE@insideobj\else
    \PackageError{pst-optexp}{compname allowed only inside an object}
  \fi
  \edef\POE@temp{#1}%
  \ifx\POE@temp\@empty
    \edef\POE@key@compname{\the\POE@cnt}%
  \else
    \edef\POE@key@compname{#1}%
  \fi
%    \end{macrocode}
% check if compname was already defined.
%    \begin{macrocode}
  \@expandtwoargs\in@{,\POE@key@compname,}{,\POE@complist,}%
  \ifin@
    \PackageWarning{pst-optexp}{%
      ^^Jcompname '\POE@key@compname' already used,\MessageBreak
      previous nodes will be overwritten!^^J
    }%
  \else
%    \end{macrocode}
%
% Use definition of \cs{XKV@addtolist@x} with an \cs{xdef} instead of \cs{edef} in order to keep the bookkeeping global.
%    \begin{macrocode}
    \xdef\POE@complist{%
      \POE@key@compname\ifx\POE@complist\@empty\else,\fi\POE@complist
    }%
  \fi
}%
\POE@insideobjtrue
\psset[optexp]{compname=\@empty}
\POE@insideobjfalse
%    \end{macrocode}
% Error handling.
%    \begin{macrocode}
\define@boolkey[psset]{optexp}[POE@]{pswarning}[true]{}
\psset[optexp]{pswarning=false}%
%    \end{macrocode}
%
% \subsection{Free-ray component parameters}
% Lens
%    \begin{macrocode}
\define@key[psset]{optexp}{lensheight}{%
  \pst@checknum{#1}\POE@key@lensheight
}
\define@key[psset]{optexp}{lenswidth}{%
  \pst@checknum{#1}\POE@key@lenswidth
  \ifdim\POE@key@lenswidth pt > 0pt
    \psset[optexp]{thicklens=true}
  \fi
}
\define@key[psset]{optexp}{lensradiusleft}{%
  \pst@checknum{#1}\POE@key@lensradiusleft
}
\define@key[psset]{optexp}{lensradiusright}{%
  \pst@checknum{#1}\POE@key@lensradiusright
}
\define@boolkey[psset]{optexp}[POE@]{thicklens}[true]{}
\define@key[psset]{optexp}{lensradius}{%
  \pst@expandafter\POE@psset@@lensradius{#1} {} {} {}\@nil
}%
\def\POE@psset@@lensradius#1 #2 #3\@nil{%
  \edef\POE@temp{#1}%
  \ifx\POE@temp\@empty\else
    \psset[optexp]{lensradiusleft=#1}%
  \fi
  \edef\POE@temp{#2}%
  \ifx\POE@temp\@empty
    \psset[optexp]{lensradiusright=#1}%
  \else
    \psset[optexp]{lensradiusright=#2}%
  \fi
}%
\define@key[psset]{optexp}{lens}{%
  \pst@expandafter\POE@psset@@lens{#1} {} {} {} {} {}\@nil
}%
\def\POE@psset@@lens#1 #2 #3 #4 #5\@nil{%
  \edef\POE@temp{#4}%
  \ifx\POE@temp\@empty\else
    \expandafter\ifx\POE@temp.\else
      \psset[optexp]{lenswidth=#4}%
    \fi
  \fi
  \edef\POE@temp{#3}%
  \ifx\POE@temp\@empty\else
    \expandafter\ifx\POE@temp.\else
      \psset[optexp]{lensheight=#3}
    \fi
  \fi
  \edef\POE@temp{#2}%
  \ifx\POE@temp\@empty
     \psset[optexp]{lensradiusright=#1}%
  \else
    \expandafter\ifx\POE@temp.\else
      \psset[optexp]{lensradiusright=#2}%
    \fi
  \fi
  \edef\POE@temp{#1}%
  \expandafter\ifx\POE@temp.\else
    \psset[optexp]{lensradiusleft=#1}%
  \fi
}%
\psset[optexp]{%
  lenswidth=0,
  lensheight=1,
  lensradiusleft=1,
  lensradiusright=1
}%
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key[psset]{optexp}{asphereheight}{%
  \pst@checknum{#1}\POE@key@asphereheight
}%
\define@key[psset]{optexp}{aspherewidth}{%
  \pst@checknum{#1}\POE@key@aspherewidth
}%
\define@key[psset]{optexp}{asphereradiusleft}{%
  \pst@checknum{#1}\POE@key@asphereradiusleft
}%
\define@key[psset]{optexp}{asphereradiusright}{%
  \pst@checknum{#1}\POE@key@asphereradiusright
}%
\define@key[psset]{optexp}{asphereconstant}{%
  \pst@checknum{#1}\POE@key@asphereconstant
}%
\define@key[psset]{optexp}{aspherecoefficients}{%
  \pst@expandafter\POE@psset@@aspherecoefficients{#1} {} {} {} {} {}\@nil
}%
\def\POE@psset@@aspherecoefficients#1 #2 #3 #4 #5\@nil{%
  \def\POE@key@asphereAfour{0}%
  \def\POE@key@asphereAsix{0}%
  \def\POE@key@asphereAeight{0}%
  \def\POE@key@asphereAten{0}%
  \ifx\\#1\\\else
    \def\POE@key@asphereAfour{#1}%
    \ifx\\#2\\\else
      \def\POE@key@asphereAsix{#2}%
      \ifx\\#3\\\else
        \def\POE@key@asphereAeight{#3}%
        \ifx\\#4\\\else
          \def\POE@key@asphereAten{#4}%
        \fi
      \fi
    \fi
  \fi
}%
\psset[optexp]{%
  aspherewidth=0,
  asphereheight=1,
  asphereconstant=-1,
  asphereradiusleft=1,
  aspherecoefficients=0,
  asphereradiusright=0
}
%    \end{macrocode}
% Pinhole
%    \begin{macrocode}
\define@key[psset]{optexp}{innerheight}{%
  \pst@checknum{#1}\POE@key@innerheight
}
\define@key[psset]{optexp}{outerheight}{%
  \pst@checknum{#1}\POE@key@outerheight
}
\define@key[psset]{optexp}{phlinewidth}{%
  \edef\POE@key@phlinewidth{#1}%
}
\define@key[psset]{optexp}{phwidth}{%
  \edef\POE@key@phwidth{#1}%
}
\psset[optexp]{%
  phlinewidth=2\pslinewidth,
  phwidth=0,
  outerheight=1,
  innerheight=0.1
}%
%    \end{macrocode}
% Crystal
%    \begin{macrocode}
\define@key[psset]{optexp}{crystalwidth}{%
  \pst@checknum{#1}\POE@key@crystalwidth
}
\define@key[psset]{optexp}{crystalheight}{%
  \pst@checknum{#1}\POE@key@crystalheight
}
\define@key[psset]{optexp}{crystalsize}{%
  \pst@expandafter\POE@psset@@crystalsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@crystalsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \PackageWarning{pst-optexp}{%
      Parameter 'crystalsize' requires two numbers.}%
  \fi
  \psset[optexp]{crystalwidth=#1}%
  \psset[optexp]{crystalheight=#2}%
}%
\define@key[psset]{optexp}{caxislength}{%
  \pst@checknum{#1}\POE@key@caxislength
}
\define@boolkey[psset]{optexp}[POE@]{voltage}[true]{}
\define@boolkey[psset]{optexp}[POE@]{caxisinv}[true]{}
\define@boolkey[psset]{optexp}[POE@]{lamp}[true]{}
\psset[optexp]{%
  crystalwidth=1.4,
  crystalheight=0.6,
  caxislength=0.3
}%
%    \end{macrocode}
% Box
%    \begin{macrocode}
\define@key[psset]{optexp}{optboxwidth}{%
  \pst@checknum{#1}\POE@key@optboxwidth
}
\define@key[psset]{optexp}{optboxheight}{%
  \pst@checknum{#1}\POE@key@optboxheight
}
\define@key[psset]{optexp}{optboxsize}{%
  \pst@expandafter\POE@psset@@optboxsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@optboxsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \PackageWarning{pst-optexp}{%
      Parameter 'optboxsize' requires two numbers.}%
  \fi
  \psset[optexp]{optboxwidth=#1, optboxheight=#2}%
}%
\psset[optexp]{optboxsize=1.4 0.8}%
%    \end{macrocode}
%
% Box
%    \begin{macrocode}
\define@key[psset]{optexp}{sourcewidth}{%
  \pst@checknum{#1}\POE@key@sourcewidth
}
\define@key[psset]{optexp}{sourceheight}{%
  \pst@checknum{#1}\POE@key@sourceheight
}
\define@key[psset]{optexp}{sourcesize}{%
  \pst@expandafter\POE@psset@@sourcesize{#1} {} {} {}\@nil
}%
\def\POE@psset@@sourcesize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \PackageWarning{pst-optexp}{%
      Parameter 'sourcesize' requires two numbers.}%
  \fi
  \psset[optexp]{sourcewidth=#1, sourceheight=#2}%
}%
\psset[optexp]{sourcesize=1.4 0.8}%
%    \end{macrocode}
%
% arrowbox
%    \begin{macrocode}
\define@key[psset]{optexp}{arrowcompwidth}{%
  \pst@checknum{#1}\POE@key@arrowcompwidth
}
\define@key[psset]{optexp}{arrowcompheight}{%
  \pst@checknum{#1}\POE@key@arrowcompheight
}
\define@key[psset]{optexp}{arrowcompsize}{%
  \pst@expandafter\POE@psset@@arrowcompsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@arrowcompsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \psset[optexp]{arrowcompwidth=#1, arrowcompheight=#1}%
  \else
    \psset[optexp]{arrowcompwidth=#1, arrowcompheight=#2}%
  \fi
}%
\define@key[psset]{optexp}{arrowcompangle}{%
  \pst@checknum{#1}\POE@key@arrowcompangle
}%
\define@choicekey+[psset]{optexp}{arrowcompshape}%
  [\val\nr]{circle, rectangle}%
  {\edef\POE@key@arrowcompshape{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for arrowcompshape}}
\psset[optexp]{%
  arrowcompsize=1.4 0.8,
  arrowcompangle=70,
  arrowcompshape=rectangle
}%
\newpsstyle{ArrowCompStyle}{arrowinset=0, arrows=->}%
%    \end{macrocode}
% BarBox
%    \begin{macrocode}
\define@key[psset]{optexp}{barcompwidth}{%
  \pst@checknum{#1}\POE@key@barcompwidth
}
\define@key[psset]{optexp}{barcompheight}{%
  \pst@checknum{#1}\POE@key@barcompheight
}
\define@key[psset]{optexp}{barcompsize}{%
  \pst@expandafter\POE@psset@@barcompsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@barcompsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \psset[optexp]{barcompwidth=#1, barcompheight=#1}%
  \else
    \psset[optexp]{barcompwidth=#1, barcompheight=#2}%
  \fi
}%
\define@key[psset]{optexp}{barcompangle}{%
  \pst@checknum{#1}\POE@key@barcompangle
}%
\define@choicekey+[psset]{optexp}{barcompshape}%
  [\val\nr]{circle, rectangle}%
  {\edef\POE@key@barcompshape{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for barcompshape}}
\psset[optexp]{%
  barcompsize=1.4 0.8,
  barcompangle=70,
  barcompshape=rectangle
}%
\newpsstyle{BarCompStyle}{}%
%    \end{macrocode}
%
% Plate
%    \begin{macrocode}
\define@key[psset]{optexp}{platelinewidth}{%
  \edef\POE@key@platelinewidth{#1}%
}
\define@key[psset]{optexp}{plateheight}{%
  \pst@checknum{#1}\POE@key@plateheight
}
\psset[optexp]{%
  plateheight=1,
  platelinewidth=2\pslinewidth
}%
%    \end{macrocode}
% Optical retardation plate, the height is the same as for \cs{optplate}.
%    \begin{macrocode}
\define@key[psset]{optexp}{platewidth}{%
  \pst@checknum{#1}\POE@key@platewidth
}
\define@key[psset]{optexp}{platesize}{%
  \pst@expandafter\POE@psset@@platesize{#1} {} {} {}\@nil
}%
\def\POE@psset@@platesize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \PackageWarning{pst-optexp}{%
      Parameter 'platesize' requires two numbers.}%
  \fi
  \psset[optexp]{platewidth=#1, plateheight=#2}%
}%
\psset[optexp]{platewidth=0.1}%
%    \end{macrocode}
% Detector
%    \begin{macrocode}
\define@key[psset]{optexp}{detsize}{%
  \pst@expandafter\POE@psset@@detsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@detsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@detsize
  \else
    \let\POE@key@detsize\@empty
    \pst@checknum{#1}\POE@key@detwidth
    \pst@checknum{#2}\POE@key@detheight
  \fi
}%
\define@choicekey*+[psset]{optexp}{dettype}[\val\nr]{round,diode}%
   {\edef\POE@key@dettype{\val}}
   {\PackageError{pst-optexp}{Unknown value '\val' for dettype}}
\newpsstyle{DetectorStyle}{}
\psset[optexp]{%
  detsize=0.8,
  dettype=round
}%
%    \end{macrocode}
% Polarization
%    \begin{macrocode}
\define@key[psset]{optexp}{polsize}{%
  \pst@checknum{#1}\POE@key@polsize
}
%    \end{macrocode}
% This is defined manually, to avoid printing the warning inside the key definition above.
%    \begin{macrocode}
\newpsstyle{Polarization}{%
  linewidth=0.7\pslinewidth, 
  arrowscale=0.8, dotsize=3\pslinewidth}
\define@choicekey+[psset]{optexp}{poltype}%
  [\val\nr]{parallel,misc,perp,rcirc,lcirc}%
  {\edef\POE@key@poltype{#1}}
  {\PackageError{pst-optexp}{Unknown value '\val' for poltype}%
}
\psset[optexp]{%
  poltype=parallel,
  polsize=0.6
}%
%    \end{macrocode}
% Optical diode
%    \begin{macrocode}
\define@key[psset]{optexp}{optdiodesize}{%
  \pst@checknum{#1}\POE@key@optdiodesize
}
\psset[optexp]{optdiodesize=0.8}%
%    \end{macrocode}
% Dove prism
%    \begin{macrocode}
\define@key[psset]{optexp}{doveprismsize}{%
  \pst@expandafter\POE@psset@@doveprismsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@doveprismsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@doveprismheight
    \pstFPmul\POE@key@doveprismwidth{3}{#1}
  \else
    \pst@checknum{#1}\POE@key@doveprismwidth
    \pst@checknum{#2}\POE@key@doveprismheight
  \fi
}%
\psset[optexp]{doveprismsize=0.6}%
%    \end{macrocode}
% Glan-Thompson prism
%    \begin{macrocode}
\define@key[psset]{optexp}{glanthompsongap}{%
  \pst@checknum{#1}\POE@key@glanthompsongap
}%
\define@key[psset]{optexp}{glanthompsonwidth}{%
  \pst@checknum{#1}\POE@key@glanthompsonwidth
}%
\define@key[psset]{optexp}{glanthompsonheight}{%
  \pst@checknum{#1}\POE@key@glanthompsonheight
}%
\define@key[psset]{optexp}{glanthompsonsize}{%
  \pst@expandafter\POE@psset@@glanthompsonsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@glanthompsonsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \PackageWarning{pst-optexp}{%
      Parameter 'glanthompsonsize' requires two numbers.}%
  \fi
  \psset[optexp]{glanthompsonwidth=#1, glanthompsonheight=#2}%
}%
\psset[optexp]{%
  glanthompsongap=0,
  glanthompsonsize=1 0.5
}%
%    \end{macrocode}
% Beamsplitter
%    \begin{macrocode}
\define@key[psset]{optexp}{bssize}{%
  \pst@checknum{#1}\POE@key@bssize
}
\define@key[psset]{optexp}{bsstyle}{%
  \edef\POE@key@bsstyle{#1}%
}
\psset[optexp]{%
  bssize=0.8,
  bsstyle=cube
}%
%    \end{macrocode}
% Mirror
%    \begin{macrocode}
\define@key[psset]{optexp}{mirrorwidth}{%
  \pst@checknum{#1}\POE@key@mirrorwidth
}
\define@key[psset]{optexp}{mirrorlinewidth}{%
  \edef\POE@key@mirrorlinewidth{#1}%
}
\define@choicekey*[psset]{optexp}{mirrortype}%
  [\val\nr]{piezo,extended,plain,semitrans}{%
  \edef\POE@key@mirrortype{#1}%
}
\define@key[psset]{optexp}{mirrordepth}{%
  \pst@checknum{#1}\POE@key@mirrordepth
}
\define@key[psset]{optexp}{mirrorradius}{%
  \pst@expandafter\POE@psset@@mirrorradius{#1} {} {} {}\@nil
}%
\def\POE@psset@@mirrorradius#1 #2 #3\@nil{%
  \pst@checknum{#1}\POE@key@mirrorradius
  \ifx\\#2\\%
    \def\POE@key@mirrorradiusB{}%
  \else
    \pst@checknum{#2}\POE@key@mirrorradiusB
    \ifdim\POE@key@mirrorradiusB pt=0pt\else
      \PackageWarning{optexp}{%
        The second value for option 'mirrorradius' must be 0.}%
    \fi
  \fi
}%
\define@boolkey[psset]{optexp}[POE@]{variable}[true]{}
\psset[optexp]{%
  mirrorwidth=1,
  mirrordepth=0.15,
  mirrorradius=0,
  mirrortype=plain,
  mirrorlinewidth=2\pslinewidth
}%
%    \end{macrocode}
%
% Parabolic mirror
%    \begin{macrocode}
\define@key[psset]{optexp}{parmirrorwidth}{%
  \pst@checknum{#1}\POE@key@parmirrorwidth
}
\define@key[psset]{optexp}{parmirrorheight}{%
  \pst@checknum{#1}\POE@key@parmirrorheight
}
\psset[optexp]{%
  parmirrorwidth=1,
  parmirrorheight=1
}%
%    \end{macrocode}
%
% Off-axis parabolic mirror
%    \begin{macrocode}
\define@key[psset]{optexp}{oapmirroraperture}{%
  \pst@expandafter\POE@psset@@oapmirroraperture{#1} {} {} {}\@nil
}%
\def\POE@psset@@oapmirroraperture#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \def\POE@key@oapmirroraperture@outer{#1 0.5 mul}
    \def\POE@key@oapmirroraperture@inner{#1 0.5 mul}
  \else
    \pst@checknum{#1}\POE@key@oapmirroraperture@inner
    \pst@checknum{#2}\POE@key@oapmirroraperture@outer
  \fi
}%
\psset[optexp]{oapmirroraperture=1}
%    \end{macrocode}
%
% Axicon
%    \begin{macrocode}
\define@key[psset]{optexp}{axiconheight}{%
  \pst@checknum{#1}\POE@key@axiconheight
}%
\define@key[psset]{optexp}{axiconwidth}{%
  \pst@checknum{#1}\POE@key@axiconwidth
}%
\define@key[psset]{optexp}{axiconangle}{%
  \pst@checknum{#1}\POE@key@axiconangle
}%
\psset[optexp]{axiconheight=1.5, axiconwidth=0.4, axiconangle=10}
%    \end{macrocode}
%
% Wedge
%    \begin{macrocode}
\define@key[psset]{optexp}{wedgeangles}{%
  \pst@expandafter\POE@psset@@wedgeangles{#1} {} {} {}\@nil
}%
\def\POE@psset@@wedgeangles#1 #2 #3\@nil{%
  \pst@checknum{#1}\POE@key@wedgeangleleft
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@wedgeangleright
  \else
    \pst@checknum{#2}\POE@key@wedgeangleright
  \fi
}%
\define@key[psset]{optexp}{wedgeangleleft}{%
  \pst@checknum{#1}\POE@key@wedgeangleleft
}%
\define@key[psset]{optexp}{wedgeangleright}{%
  \pst@checknum{#1}\POE@key@wedgeangleright
}%
\define@key[psset]{optexp}{wedgeheight}{%
  \pst@checknum{#1}\POE@key@wedgeheight
}%
\define@key[psset]{optexp}{wedgewidth}{%
  \pst@checknum{#1}\POE@key@wedgewidth
}%
\psset[optexp]{%
  wedgeangles=0 10,
  wedgeheight=0.8,
  wedgewidth=0
}%
%    \end{macrocode}
% Grating
%    \begin{macrocode}
\define@key[psset]{optexp}{gratingcount}{%
  \pst@checknum{#1}\POE@key@gratingcount
}
\define@key[psset]{optexp}{gratingwidth}{%
  \pst@checknum{#1}\POE@key@gratingwidth
}
\define@key[psset]{optexp}{gratingheight}{%
  \pst@checknum{#1}\POE@key@gratingheight
}
\define@choicekey*[psset]{optexp}{gratingtype}%
  [\val\nr]{binary,blazed}{%
  \edef\POE@key@gratingtype{#1}%
}
\define@key[psset]{optexp}{gratingdepth}{%
  \pst@checknum{#1}\POE@key@gratingdepth
}
\define@key[psset]{optexp}{gratinglinewidth}{%
  \edef\POE@key@gratinglinewidth{#1}%
}
\define@choicekey+[psset]{optexp}{gratingalign}%
  [\val\nr]{t,c,top,center}%
  {%
    \ifcase\nr\relax
      \let\POE@key@gratingalign\POE@str@top
    \or
      \let\POE@key@gratingalign\POE@str@center
    \else
      \def\POE@key@gratingalign{#1}%
    \fi}%
  {\PackageError{pst-optexp}{Unknown value '\val' for gratingalign}}
\define@boolkey[psset]{optexp}[POE@]{reverse}[true]{}
\psset[optexp]{%
  gratingcount=10,
  gratingwidth=1,
  gratingheight=0.15,
  gratingdepth=0.075,
  gratingtype=blazed,
  gratinglinewidth=0.7\pslinewidth,
  gratingalign=t
}%
%    \end{macrocode}
% Penta prism
%    \begin{macrocode}
\define@key[psset]{optexp}{pentaprismsize}{%
  \pst@checknum{#1}\POE@key@pentaprismsize
}
\psset[optexp]{pentaprismsize=0.7}
%    \end{macrocode}
% Right-angle prism
%    \begin{macrocode}
\define@key[psset]{optexp}{raprismsize}{%
  \pst@checknum{#1}\POE@key@raprismsize
}
\define@choicekey+[psset]{optexp}{raprismalign}[\val\nr]%
  {auto,center}%
  {\def\POE@key@raprismalign{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for raprismalign}}%
\psset[optexp]{%
  raprismsize=1.5,
  raprismalign=auto
}
%    \end{macrocode}
% Prism
%    \begin{macrocode}
\define@key[psset]{optexp}{prismsize}{%
  \pst@checknum{#1}\POE@key@prismsize
}
\define@key[psset]{optexp}{prismangle}{%
  \pst@checknum{#1}\POE@key@prismangle
}
\define@choicekey+[psset]{optexp}{prismalign}[\val\nr]%
  {auto,center}%
  {\def\POE@key@prismalign{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for prismalign}}%
\define@choicekey+[psset]{optexp}{prismtype}[\val\nr]%
  {transmittive, reflective, coupling}%
  {\def\POE@key@prismtype{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for prismtype}}%
\psset[optexp]{%
  prismsize=1,
  prismangle=60,
  prismalign=auto,
  prismtype=transmittive
}%
%    \end{macrocode}
%
% Optdipole and Opttripole
%    \begin{macrocode}
\define@key[psset]{optexp}{optdipolesize}{%
  \pst@expandafter\POE@psset@@optdipolesize{#1} {} {} {}\@nil
}%
\def\POE@psset@@optdipolesize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \def\POE@key@optdipoleheight{0}%
  \else
    \pst@checknum{#2}\POE@key@optdipoleheight
  \fi
  \pst@checknum{#1}\POE@key@optdipolewidth
}%
\define@key[psset]{optexp}{optdipolecomp}{%
  \def\POE@key@optdipolecomp{#1}%
}
\define@key[psset]{optexp}{opttripolecomp}{%
  \def\POE@key@opttripolecomp{#1}%
}
\psset[optexp]{%
  optdipolesize=0 0,
  optdipolecomp=,
  opttripolecomp=%
}%
%    \end{macrocode}
%
% acousto-optic modulator
%    \begin{macrocode}
\define@key[psset]{optexp}{aomwidth}{%
  \pst@checknum{#1}\POE@key@aomwidth
}%
\define@key[psset]{optexp}{aomheight}{%
  \pst@checknum{#1}\POE@key@aomheight
}%
\define@key[psset]{optexp}{aomsize}{%
  \pst@expandafter\POE@psset@@aomsize{#1} {} {} {}\@nil
}%
\define@key[psset]{optexp}{aomgratingcount}{%
  \edef\POE@key@aomgratingcount{#1}%
}%
\define@choicekey+[psset]{optexp}{aomalign}%
  [\val\nr]{sym,symmetric,straight}%
  {%
    \ifcase\nr\relax
      \let\POE@key@aomalign\POE@str@symmetric
    \else
      \def\POE@key@aomalign{#1}%
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for aomalign}}%
\define@choicekey+[psset]{optexp}{aomreflalign}%
  [\val\nr]{perp,parallel}%
  {\def\POE@key@aomreflalign{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for aomreflalign}}%
\def\POE@psset@@aomsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \PackageWarning{pst-optexp}{%
      Parameter 'aomsize' requires two numbers.}%
  \fi
  \psset[optexp]{aomwidth=#1, aomheight=#2}%
}%
\define@key[psset]{optexp}{aomcomp}{%
  \def\POE@key@aomcomp{#1}%
}%
\define@key[psset]{optexp}{diffractionorders}{%
  \def\POE@key@diffractionorders{#1}%
}%
\define@key[psset]{optexp}{beamdiffractionorder}{%
  \def\POE@key@beamdiffractionorder{#1}%
}%
\psset[optexp]{%
  aomsize=1.5 1, 
  aomcomp=default, 
  aomalign=sym,
  aomreflalign=parallel,
  aomgratingcount=9,
  diffractionorders=2,
  beamdiffractionorder=
}%
%    \end{macrocode}
%
% \subsection{Parameters of fiber-optical components}
% \subsubsection{fiber}
%    \begin{macrocode}
\define@key[psset]{optexp}{fiberloops}{%
  \pst@checknum{#1}\POE@key@fiberloops
}
\define@key[psset]{optexp}{fiberloopradius}{%
  \pst@checknum{#1}\POE@key@fiberloopradius
}
\define@key[psset]{optexp}{fiberloopsep}{%
  \pst@checknum{#1}\POE@key@fiberloopsep
}
\psset[optexp]{%
  fiberloops=3,
  fiberloopradius=0.4,
  fiberloopsep=0.2
}%
%    \end{macrocode}
% \subsubsection{optfilter}
%    \begin{macrocode}
\define@key[psset]{optexp}{filtersize}{%
  \pst@checknum{#1}\POE@key@filtersize
}
\define@choicekey+[psset]{optexp}{filtertype}[\val\nr]%
   {bandstop,bandpass,lowpass,highpass}%
   {\def\POE@key@filtertype{#1}}%
   {\PackageError{pst-optexp}{Unknown value '\val' for filtertype}}
\define@key[psset]{optexp}{filterangle}{%
  \pst@checknum{#1}\POE@key@filterangle
}
\newpsstyle{FilterStyle}{}
\psset[optexp]{%
  filterangle=0,
  filtersize=0.8,
  filtertype=bandpass
}%
%    \end{macrocode}
% Polarization controller
%    \begin{macrocode}
\define@key[psset]{optexp}{polcontrolsize}{%
  \pst@checknum{#1}\POE@key@polcontrolsize
}
\define@choicekey+[psset]{optexp}{polcontroltype}[\val\nr]%
   {linear,triangle}%
   {\def\POE@key@polcontroltype{#1}}%
   {\PackageError{pst-optexp}{Unknown value '\val' for polcontroltype}}
\psset[optexp]{%
  polcontrolsize=0.15,
  polcontroltype=linear
}%
%    \end{macrocode}
%
% \subsubsection{optamp}
%    \begin{macrocode}
\define@key[psset]{optexp}{optampsize}{%
  \pst@expandafter\POE@psset@@optampsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@optampsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@optampheight
    \pstFPmul\POE@key@optampwidth{0.866}{#1}
  \else
    \pst@checknum{#1}\POE@key@optampwidth
    \pst@checknum{#2}\POE@key@optampheight
  \fi
}%
\psset[optexp]{optampsize=0.8}
%    \end{macrocode}
% Mach-Zehnder modulator
%    \begin{macrocode}
\define@key[psset]{optexp}{optmzmsize}{%
  \pst@expandafter\POE@psset@@optmzmsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@optmzmsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@optmzmheight
    \pstFPmul\POE@key@optmzmwidth{1.6}{#1}
  \else
    \pst@checknum{#1}\POE@key@optmzmwidth
    \pst@checknum{#2}\POE@key@optmzmheight
  \fi
}%
\psset[optexp]{optmzmsize=0.8}
%    \end{macrocode}
% \subsubsection{Isolator}
%    \begin{macrocode}
\define@key[psset]{optexp}{isolatorsize}{%
  \pst@expandafter\POE@psset@@isolatorsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@isolatorsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@isolatorheight
    \pstFPmul\POE@key@isolatorwidth{1.6}{#1}
  \else
    \pst@checknum{#1}\POE@key@isolatorwidth
    \pst@checknum{#2}\POE@key@isolatorheight
  \fi
}%
\psset[optexp]{isolatorsize=0.6}%
%    \end{macrocode}
% Fiber polarizer
%    \begin{macrocode}
\define@key[psset]{optexp}{fiberpolsize}{%
  \pst@expandafter\POE@psset@@fiberpolsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@fiberpolsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@fiberpolheight
    \pstFPmul\POE@key@fiberpolwidth{1.6}{#1}
  \else
    \pst@checknum{#1}\POE@key@fiberpolwidth
    \pst@checknum{#2}\POE@key@fiberpolheight
  \fi
}%
\psset[optexp]{fiberpolsize=0.6}%
%    \end{macrocode}
% Optical switch
%    \begin{macrocode}
\define@key[psset]{optexp}{switchsize}{%
  \pst@expandafter\POE@psset@@switchsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@switchsize#1 #2 #3\@nil{%
  \pst@checknum{#1}\POE@key@switchwidth
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@switchheight
  \else
    \pst@checknum{#2}\POE@key@switchheight
  \fi
}%
\define@choicekey+[psset]{optexp}{switchstyle}%
  [\val\nr]{opened,closed}%
  {\edef\POE@key@switchstyle{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for switchstyle}}
\psset[optexp]{%
  switchsize=0.8,
  switchstyle=opened
}%
%    \end{macrocode}
% \subsubsection{Fiber delay line}
%    \begin{macrocode}
\define@key[psset]{optexp}{fdlsize}{%
  \pst@expandafter\POE@psset@@fdlsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@fdlsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@fdlheight
    \pstFPmul\POE@key@fdlwidth{1.6}{#1}
  \else
    \pst@checknum{#1}\POE@key@fdlwidth
    \pst@checknum{#2}\POE@key@fdlheight
  \fi
}%
\psset[optexp]{fdlsize=0.6}%
%    \end{macrocode}
% Fiber collimator 
%    \begin{macrocode}
\define@key[psset]{optexp}{fibercolsize}{%
  \pst@expandafter\POE@psset@@fibercolsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@fibercolsize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@fibercolheight
    \pstFPmul\POE@key@fibercolwidth{0.866}{#1}
  \else
    \pst@checknum{#1}\POE@key@fibercolwidth
    \pst@checknum{#2}\POE@key@fibercolheight
  \fi
}%
\psset[optexp]{fibercolsize=0.3}%
%    \end{macrocode}
% Optical Circulator
%    \begin{macrocode}
\define@key[psset]{optexp}{optcircsize}{%
  \pst@checknum{#1}\POE@key@optcircsize
}%
\define@key[psset]{optexp}{optcircangleA}{%
  \pst@checknum{#1}\POE@key@optcircangleA
}%
\define@key[psset]{optexp}{optcircangleB}{%
  \pst@checknum{#1}\POE@key@optcircangleB
}%
\define@key[psset]{optexp}{optcircangle}{%
  \pst@expandafter\POE@psset@@optcircangle{#1} {} {} {}\@nil
}%
\def\POE@psset@@optcircangle#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \PackageError{pst-optexp}{optcircangle requires two numbers}%
  \else\ifx\\#1\\%
    \PackageError{pst-optexp}{optcircangle requires two numbers}%
  \else
    \psset[optexp]{optcircangleA=#1, optcircangleB=#2}%
  \fi\fi
}%
\psset[optexp]{%
  optcircsize=0.8, 
  optcircangle=-160 -20
}%
\newpsstyle{OptCircArrow}{unit=0.7, arrows=->, arrowinset=0}
%    \end{macrocode}
%
% \subsubsection{Coupler}
%    \begin{macrocode}
\define@key[psset]{optexp}{couplersize}{%
  \pst@expandafter\POE@psset@@couplersize{#1} {} {} {}\@nil
}%
\def\POE@psset@@couplersize#1 #2 #3\@nil{%
  \ifx\\#2\\%
    \pstFPmul\POE@key@couplerheight{0.8}{#1}
    \pstFPmul\POE@key@couplerwidth{2}{#1}
  \else
    \pst@checknum{#1}\POE@key@couplerwidth
    \pst@checknum{#2}\POE@key@couplerheight
  \fi
}%
\define@key[psset]{optexp}{couplersep}{%
  \edef\POE@key@couplersep{#1}%
}
\define@choicekey+[psset]{optexp}{couplertype}%
  [\val\nr]{none,elliptic,ellipse,cross,rectangle}%
  {%
    \edef\POE@key@couplertype{#1}
    \ifx\POE@key@couplertype\POE@str@elliptic
      \let\POE@key@couplertype\POE@str@ellipse
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for couplertype}}
\define@choicekey+[psset]{optexp}{coupleralign}%
  [\val\nr]{t,b,c,top,bottom,center}%
  {%
    \ifcase\nr\relax
      \let\POE@key@coupleralign\POE@str@top
    \or
      \let\POE@key@coupleralign\POE@str@bottom
    \or
      \let\POE@key@coupleralign\POE@str@center
    \else
      \def\POE@key@coupleralign{#1}%
    \fi}%
  {\PackageError{pst-optexp}{Unknown value '\val' for coupleralign}}
\psset[optexp]{%
  couplersize=0.2,
  couplersep=0.05,
  coupleralign=center,
  couplertype=elliptic
}%
%    \end{macrocode}
%
% \subsection{Fiber box}
%
%    \begin{macrocode}
\define@key[psset]{optexp}{fiberboxheight}{%
  \pst@checknum{#1}\POE@key@fiberboxheight
}%
\define@key[psset]{optexp}{fiberboxwidth}{%
  \pst@checknum{#1}\POE@key@fiberboxwidth
}%
\define@key[psset]{optexp}{fiberboxsize}{%
  \pst@expandafter\POE@psset@@fiberboxsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@fiberboxsize#1 #2 #3\@nil{%
  \psset[optexp]{fiberboxwidth=#1}
  \ifx\\#2\\%
    \psset[optexp]{fiberboxheight=0}%
  \else
    \psset[optexp]{fiberboxheight=#2}%
  \fi
}%
\define@key[psset]{optexp}{fiberboxsepin}{%
  \def\POE@key@fiberboxsepin{#1}
}%
\define@key[psset]{optexp}{fiberboxsepout}{%
  \def\POE@key@fiberboxsepout{#1}%
}%
\define@key[psset]{optexp}{fiberboxcount}{%
  \pst@expandafter\POE@psset@@fiberboxcount#1\@nil
}%
\def\POE@psset@@fiberboxcount#1x#2\@nil{%
  \ifx\\#1\\%
    \def\POE@key@fiberboxcountin{1}%
  \else
    \def\POE@key@fiberboxcountin{#1}%
  \fi
  \ifx\\#2\\%
    \def\POE@key@fiberboxcountout{1}%
  \else
    \def\POE@key@fiberboxcountout{#2}
  \fi
}%
\psset[optexp]{%
  fiberboxsize=1,
  fiberboxsepin=0.2,
  fiberboxsepout=0.2,
  fiberboxcount=2x2}
%    \end{macrocode}
%
% \subsection{Electrical components}
%
% \subsubsection{elecmixer}
%    \begin{macrocode}
\define@key[psset]{optexp}{elecmixersize}{%
  \pst@checknum{#1}\POE@key@elecmixersize
}%
\psset[optexp]{elecmixersize=0.8}%
%    \end{macrocode}
%
% \subsubsection{eleccoupler}
%    \begin{macrocode}
\define@key[psset]{optexp}{eleccouplersize}{%
  \pst@expandafter\POE@psset@@eleccouplersize{#1} {} {} {}\@nil
}%
\def\POE@psset@@eleccouplersize#1 #2 #3\@nil{%
  \pst@checknum{#1}\POE@key@eleccouplerwidth
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@eleccouplerheight
  \else
    \pst@checknum{#2}\POE@key@eleccouplerheight
  \fi
}%
\define@key[psset]{optexp}{eleccouplersep}{%
  \edef\POE@key@eleccouplersep{#1}%
}
\define@choicekey+[psset]{optexp}{eleccouplertype}%
  [\val\nr]{standard, directional}%
  {\edef\POE@key@eleccouplertype{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for eleccouplertype}}%
\define@choicekey+[psset]{optexp}{eleccouplerinput}%
  [\val\nr]{left, right}%
  {\edef\POE@key@eleccouplerinput{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for eleccouplerinput}}%
\define@choicekey+[psset]{optexp}{eleccoupleralign}%
  [\val\nr]{t,b,c,top,bottom,center}%
  {%
    \ifcase\nr\relax
      \let\POE@key@eleccoupleralign\POE@str@top
    \or
      \let\POE@key@eleccoupleralign\POE@str@bottom
    \or
      \let\POE@key@eleccoupleralign\POE@str@center
    \else
      \def\POE@key@eleccoupleralign{#1}%
    \fi}%
  {\PackageError{pst-optexp}{Unknown value '\val' for eleccoupleralign}}
\psset[optexp]{%
  eleccouplersize=0.8,
  eleccouplersep={},
  eleccoupleralign=center,
  eleccouplertype=standard,
  eleccouplerinput=left
}%
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key[psset]{optexp}{synthsize}{%
  \pst@expandafter\POE@psset@@synthsize{#1} {} {} {}\@nil
}%
\def\POE@psset@@synthsize#1 #2 #3\@nil{%
  \pst@checknum{#1}\POE@key@synthwidth
  \ifx\\#2\\%
    \pst@checknum{#1}\POE@key@synthheight
  \else
    \pst@checknum{#2}\POE@key@synthheight
  \fi
}%
\define@key[psset]{optexp}{synthrectwidth}{%
  \pst@checknum{#1}\POE@key@synthrectwidth
}%
\define@choicekey+[psset]{optexp}{synthshape}%
  [\val\nr]{circle, rectangle}%
  {\edef\POE@key@synthshape{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for synthshape}}
\define@choicekey+[psset]{optexp}{synthtype}%
  [\val\nr]{sine, pulse, rectangle, triangle, sawtooth, custom}%
  {\edef\POE@key@synthtype{#1}}%
  {\PackageError{pst-optexp}{Unknown value '\val' for synthtype}}
\newpsstyle{SynthStyle}{}
\psset[optexp]{%
  synthsize=0.8,
  synthshape=circle,
  synthtype=sine,
  synthrectwidth=0.2
}%
%    \end{macrocode}
%
% \subsection{Beam-connection parameters}
% The keys related to the \cs{draw*} macros.
%
% Connect a component directly with its reference nodes using \cs{drawbeam}.
%    \begin{macrocode}
\define@boolkey[psset]{optexp}[POE@]{beam}[true]{}
%    \end{macrocode}
%    \begin{macrocode}
\define@key[psset]{optexp}{refractiveindex}{%
  \psset[optexp]{n=#1}%
  \PackageWarning{pst-optexp}{%
    Option 'refractiveindex' is deprecated,\MessageBreak
    use 'n' instead.}%
}%
\define@key[psset]{optexp}{n}{%
  \POE@parsealg{n}#1\@nil
}
\def\POE@parsealg#1#2#3\@nil{%
  \ifx#2*\relax
    \POE@@parsealg#3\@nil
    \expandafter\let\csname POE@key@#1\endcsname\POE@tempA
  \else
    \@namedef{POE@key@#1}{[#2#3] }%
  \fi
}
\def\POE@@parsealg#1#2\@nil{%
  \edef\POE@tempA{tx@Dict begin (#1#2) AlgParser end }%
}
\define@key[psset]{optexp}{beamangle}{%
  \edef\POE@key@beamangle{#1}%
}%
\define@key[psset]{optexp}{beampos}{%
  \edef\POE@key@beampos{#1}%
}%
\define@key[psset]{optexp}{beamdiv}{%
  \edef\POE@key@beamdiv{#1}%
}%
\define@key[psset]{optexp}{beamwidth}{%
  \edef\POE@key@beamwidth{#1}%
}%
\define@choicekey+[psset]{optexp}{beammode}%
  [\val\nr]{trans,refl,reflective,transmittive,auto}%
  {\ifcase\nr\relax
      \let\POE@key@beammode\POE@str@transmittive
    \or
      \let\POE@key@beammode\POE@str@reflective
    \else
      \def\POE@key@beammode{#1}%
    \fi}%
  {\PackageError{pst-optexp}{Unknown value '\val' for beammode}}

\define@boolkey[psset]{optexp}[POE@]{startinside}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{stopinside}[true]{}%
\define@key[psset]{optexp}{startinsidecount}{%
  \pst@checknum{#1}\POE@key@startinsidecount
}
\define@key[psset]{optexp}{stopinsidecount}{%
  \pst@checknum{#1}\POE@key@stopinsidecount
}
\define@boolkey[psset]{optexp}[POE@]{beaminsidefirst}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{beaminsidelast}[true]{}%
\define@choicekey+[psset]{optexp}{savebeampoints}%
  [\val\nr]{true,false}[true]{%
    \ifcase\nr\relax
      \def\POE@key@savebeampoints{1}%
    \or
      \def\POE@key@savebeampoints{0}%
    \fi
  }{%
    \ifnum9<1#1
      \def\POE@key@savebeampoints{#1}%
    \else
      \PackageError{pst-optexp}%
        {savebeampoints must be a positive integer or 0}%
    \fi
    \@expandtwoargs\in@{,\POE@key@savebeampoints,}{,\POE@beamlist,}%
    \ifin@\else
      \xdef\POE@beamlist{%
        \POE@key@savebeampoints
        \ifx\POE@beamlist\@empty\else,\fi\POE@beamlist
      }%
    \fi
}%
\define@choicekey+[psset]{optexp}{loadbeampoints}%
  [\val\nr]{true,false}[true]{%
    \ifcase\nr\relax
      \def\POE@key@loadbeampoints{1}%
    \or
      \def\POE@key@loadbeampoints{0}%
    \fi
  }{%
    \ifnum9<1#1
      \def\POE@key@loadbeampoints{#1}%
    \else
      \PackageError{pst-optexp}%
        {loadbeampoints must be a positive integer or 0}%
    \fi
    \@expandtwoargs\in@{,\POE@key@loadbeampoints,}{,\POE@beamlist,}%
    \ifin@\else
      \xdef\POE@beamlist{%
        \POE@key@loadbeampoints
        \ifx\POE@beamlist\@empty\else,\fi\POE@beamlist
      }%
    \fi
}%
\define@key[psset]{optexp}{loadbeam}[true]{%
  \setkeys[psset]{optexp}{loadbeampoints=#1}%
  \ifdim\POE@key@loadbeampoints pt>0pt
    \POE@loadbeamtrue
  \else
    \POE@loadbeamfalse
  \fi
}%
\define@key[psset]{optexp}{savebeam}[true]{%
  \setkeys[psset]{optexp}{savebeampoints=#1}%
  \ifdim\POE@key@savebeampoints pt>0pt
    \POE@savebeamtrue
  \else
    \POE@savebeamfalse
  \fi
}%
\define@boolkey[psset]{optexp}[POE@]{beaminside}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{allowbeaminside}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{forcebeaminside}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{raytrace}[true]{}%
\define@boolkey[psset]{optexp}[POE@]{useNA}[true]{}%
\define@choicekey+[psset]{optexp}{beamnodealign}%
  [\val\nr]{vec, conn, vector, connection}%
  {%
    \ifcase\nr\relax
      \let\POE@key@beamnodealign\POE@str@vector
    \or
      \let\POE@key@beamnodealign\POE@str@connection
    \else
      \def\POE@key@beamnodealign{#1}%
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for beamnodealign}}
\define@key[psset]{optexp}{beampathskip}{%
  \pst@checknum{#1}\POE@key@beampathskip
}%
\define@key[psset]{optexp}{beampathcount}{%
  \pst@getint{#1}\POE@key@beampathcount
}%
\define@choicekey+[psset]{optexp}{beamalign}%
  [\val\nr]{rel,abs,relative,absolute,firstcomp}%
  {%
    \ifcase\nr\relax
      \let\POE@key@beamalign\POE@str@relative
    \or
      \let\POE@key@beamalign\POE@str@absolute
    \else
      \def\POE@key@beamalign{#1}%
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for beamalign}}
\define@key[psset]{optexp}{ArrowInsideMinLength}{%
  \def\POE@key@ArrowInsideMinLength{#1}%
}%
\define@key[psset]{optexp}{ArrowInsideMaxLength}{%
  \def\POE@key@ArrowInsideMaxLength{#1}%
}%
\define@choicekey[psset]{optexp}{fadeto}[\val\nr]{white,black,transparency}{%
  \def\POE@key@fadeto{#1}%
}%
\define@key[psset]{optexp}{fadefunc}{%
  \def\POE@key@fadefunc{#1}%
}%
\define@key[psset]{optexp}{fadefuncname}{%
  \def\POE@key@fadefuncname{#1}%
}%
\define@key[psset]{optexp}{fadepoints}{%
  \def\POE@key@fadepoints{#1}%
}%
\def\psls@fade{%
  \pst@optexpdict
    \ifx\POE@key@fadefunc\@empty\else
      /fadefunc@custom {\POE@key@fadefunc} def
    \fi
    /fadecorrect \ifx\POE@key@fadeto\POE@str@transparency 0 \else 0.1 \fi def
    \pst@usecolor\pslinecolor
    \POE@key@fadepoints\space
    \psk@strokeopacityalpha
    currentdict /fadeto@\POE@key@fadeto\space dup 3 1 roll known not { pop /fadeto@white } if load
    currentdict /fadefunc@\POE@key@fadefuncname\space dup 3 1 roll known not { pop /fadefunc@linear } if load
    FadeStroke
  end
}%
\psset[optexp]{%
  raytrace=true
  ,useNA=true
  ,beamnodealign=connection
  ,startinside=false
  ,stopinside=false
  ,allowbeaminside=true
  ,forcebeaminside=false
  ,beaminside=true
  ,beaminsidefirst=false
  ,beaminsidelast=false
  ,loadbeam=false
  ,savebeam=true
  ,loadbeampoints=false
  ,savebeampoints=true
  ,beamangle=0
  ,beampos=\@empty
  ,beamalign=relative
  ,beamwidth=0
  ,beamdiv=0
  ,beammode=auto
  ,n=1.5
  ,beampathskip=0
  ,beampathcount=-1
  ,stopinsidecount=-1
  ,startinsidecount=-1
  ,ArrowInsideMinLength=0.2
  ,ArrowInsideMaxLength=-1
  ,fadepoints=200
  ,fadeto=white
  ,fadefunc=\@empty
  ,fadefuncname=linear
}%
%    \end{macrocode}
%
% \subsection{Fiber-connection parameters}
% Select which fibers are drawn automatically. 
%    \begin{macrocode}
\define@key[psset]{optexp}{fiber}[all]{%
  \POE@psset@fibercheck#1\@nil
}
%    \end{macrocode}
% Check which components are affected by the fiber parameter. * is only for 
% fiber-optical components, + refers to all components but the fiber-optical 
% ones, otherwise all components are affected.
%    \begin{macrocode}
\def\POE@psset@fibercheck#1#2\@nil{%
  \ifx#1*\relax
    \ifx\\#2\\%
      \setkeys[psset]{optexp}{fiber@preset=all}%
    \else
      \setkeys[psset]{optexp}{fiber@preset=#2}%
    \fi
  \else\ifx#1+\relax
    \ifx\\#2\\%
      \setkeys[psset]{optexp}{fiber@all=all}%
    \else
      \setkeys[psset]{optexp}{fiber@all=#2}%
    \fi
    \POE@unset@wire
  \else
    \setkeys[psset]{optexp}{fiber@all=#1#2}%
    \setkeys[psset]{optexp}{fiber@preset=#1#2}%
    \POE@unset@wire
  \fi\fi
}%
\def\POE@unset@wire{%
  \ifPOE@fiberin@
    \setkeys[psset]{optexp}{wirepresetin@=false}%
  \fi
  \ifPOE@fiberout@
    \setkeys[psset]{optexp}{wirepresetout@=false}%
  \fi
  \ifPOE@fiberin@top
    \setkeys[psset]{optexp}{wirepresetin@top=false}%
  \fi
  \ifPOE@fiberin@bottom
    \setkeys[psset]{optexp}{wirepresetin@bottom=false}%
  \fi
  \ifPOE@fiberout@top
    \setkeys[psset]{optexp}{wirepresetout@top=false}%
  \fi
  \ifPOE@fiberout@bottom
    \setkeys[psset]{optexp}{wirepresetout@bottom=false}%
  \fi
}%
%    \end{macrocode}
% Set the fiber parameters for fiber-optical components only (use fiber=*...).
%    \begin{macrocode}
\define@choicekey*+[psset]{optexp}{fiber@preset}%
  [\val\nr]{false,none,true,all}[all]{%
  \ifcase\nr\relax
    \POE@getfiberpreset@none
  \or
    \POE@getfiberpreset@none
  \or
    \POE@getfiberpreset@all
  \or
    \POE@getfiberpreset@all
  \fi
}{%
  \ifx\@empty\val
    \POE@getfiberpreset@none
  \else
    \pst@expandafter\POE@psset@@fiberpreset{#1}\@empty,,\@nil
  \fi
}%
\def\POE@psset@@fiberpreset#1#2,#3,#4\@nil{%
  \POE@getfiberpreset@all
  \ifx\\#3\\%
    \@nameuse{POE@getfiberpreset@#1}%
    \@nameuse{POE@getfiberpreset@#2}%
  \fi
}%
\def\POE@getfiberpreset@none{%
  \setkeys[psset]{optexp}{%
    fiberpresetin@=false, fiberpresetout@=false,
    fiberpresetin@top=false, fiberpresetin@bottom=false, 
    fiberpresetout@top=false, fiberpresetout@bottom=false}%
}%
\def\POE@getfiberpreset@all{%
  \setkeys[psset]{optexp}{%
    fiberpresetin@, fiberpresetout@,
    fiberpresetin@top, fiberpresetin@bottom, 
    fiberpresetout@top, fiberpresetout@bottom}%
}%
\def\POE@getfiberpreset@t{%
  \setkeys[psset]{optexp}{%
    fiberpresetin@bottom=false, fiberpresetout@bottom=false}%
}%
\def\POE@getfiberpreset@b{%
  \setkeys[psset]{optexp}{%
    fiberpresetin@top=false, fiberpresetout@top=false}%
}%
\def\POE@getfiberpreset@l{%
  \setkeys[psset]{optexp}{%
    fiberpresetout@=false,
    fiberpresetout@top=false,
    fiberpresetout@bottom=false}%
}%
\def\POE@getfiberpreset@r{%
  \setkeys[psset]{optexp}{%
    fiberpresetin@=false,
    fiberpresetin@top=false,
    fiberpresetin@bottom=false}%
}%
\let\POE@getfiberpreset@i\POE@getfiberpreset@l
\let\POE@getfiberpreset@o\POE@getfiberpreset@r
%    \end{macrocode}
%
% This code is for all components, fiber-optical and free-ray.
%    \begin{macrocode}
\define@choicekey*+[psset]{optexp}{fiber@all}%
  [\val\nr]{false,none,true,all}[all]{%
  \ifcase\nr\relax
    \POE@getfiber@none
  \or
    \POE@getfiber@none
  \or
    \POE@getfiber@all
  \or
    \POE@getfiber@all
  \fi
}{%
  \ifx\@empty\val
    \POE@getfiber@none
  \else
    \pst@expandafter\POE@psset@@fiber{#1}\@empty,,\@nil
  \fi
}%
\def\POE@psset@@fiber#1#2,#3,#4\@nil{%
  \POE@getfiber@all
  \ifx\@empty#3\@empty
    \@nameuse{POE@getfiber@#1}%
    \@nameuse{POE@getfiber@#2}%
  \fi
}%
\def\POE@getfiber@none{%
  \setkeys[psset]{optexp}{%
    fiberin@=false, fiberout@=false,
    fiberin@top=false, fiberin@bottom=false, 
    fiberout@top=false, fiberout@bottom=false}%
}%
\def\POE@getfiber@all{%
  \setkeys[psset]{optexp}{%
    fiberin@, fiberout@,
    fiberin@top, fiberin@bottom, 
    fiberout@top, fiberout@bottom}%
}%
\def\POE@getfiber@t{%
  \setkeys[psset]{optexp}{%
    fiberin@bottom=false, fiberout@bottom=false}%
}%
\def\POE@getfiber@b{%
  \setkeys[psset]{optexp}{%
    fiberin@top=false, fiberout@top=false}%
}%
\def\POE@getfiber@l{%
  \setkeys[psset]{optexp}{%
    fiberout@=false, fiberout@top=false, fiberout@bottom=false}%
}%
\def\POE@getfiber@r{%
  \setkeys[psset]{optexp}{%
    fiberin@=false, fiberin@top=false, fiberin@bottom=false}%
}%
\let\POE@getfiber@i\POE@getfiber@l
\let\POE@getfiber@o\POE@getfiber@r
%    \end{macrocode}
% These are the internal boolkeys for the fiber choices done with \opt{fiberin},
% \opt{fiberout} and \opt{fiber}. Do not use them directly.
%    \begin{macrocode}
\define@boolkey[psset]{optexp}[POE@]{fiberin@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberin@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberin@bottom}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberout@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberout@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberout@bottom}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberpresetin@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberpresetin@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberpresetin@bottom}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberpresetout@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberpresetout@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{fiberpresetout@bottom}[true]{}
\psset[optexp]{fiber=*all}%
\define@key[psset]{optexp}{fiberangleA}{%
  \pst@checknum{#1}\POE@key@fiberangleA
}%
\define@key[psset]{optexp}{fiberangleB}{%
  \pst@checknum{#1}\POE@key@fiberangleB
}%
\define@choicekey+[psset]{optexp}{fiberalign}%
  [\val\nr]{rel,abs,relative,center,absolute}%
  {%
    \ifcase\nr\relax
      \let\POE@key@fiberalign\POE@str@relative
    \or
      \let\POE@key@fiberalign\POE@str@absolute
    \else
      \def\POE@key@fiberalign{#1}%
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for fiberalign}}%
\define@key[psset]{optexp}{fiberstyle}{%
  \@ifundefined{nc#1}%
    {\PackageError{pst-optexp}{Unknown value '#1' for fiberstyle}}%
    {\def\POE@key@fiberstyle{#1}}}
\psset[optexp]{%
  fiberangleA=0,
  fiberangleB=0,
  fiberalign=relative,
  fiberstyle=curve
}%

% \subsection{Wire connection parameters}
% Select which wires are drawn automatically. 
% Note, this part is equivalent to the fiber connection parameters, only 'fiber' is replace by 'wire'.
%    \begin{macrocode}
\define@key[psset]{optexp}{wire}[all]{%
  \POE@psset@wirecheck#1\@nil
}
%    \end{macrocode}
% Check which components are affected by the wire parameter:
% * is only for electrical components
% + refers to all components but the electrical ones,
% otherwise all components are affected.
%    \begin{macrocode}
\def\POE@psset@wirecheck#1#2\@nil{%
  \ifx#1*\relax
    \ifx\\#2\\%
      \setkeys[psset]{optexp}{wire@preset=all}%
    \else
      \setkeys[psset]{optexp}{wire@preset=#2}%
    \fi
  \else\ifx#1+\relax
    \ifx\\#2\\%
      \setkeys[psset]{optexp}{wire@all=all}%
    \else
      \setkeys[psset]{optexp}{wire@all=#2}%
    \fi
    \POE@unset@fiber
  \else
    \setkeys[psset]{optexp}{wire@all=#1#2, wire@preset=#1#2}%
    \POE@unset@fiber
  \fi\fi
}%
\def\POE@unset@fiber{%
  \ifPOE@wirein@
    \setkeys[psset]{optexp}{fiberpresetin@=false, fiberin@=false}%
  \fi
  \ifPOE@wireout@
    \setkeys[psset]{optexp}{fiberpresetout@=false, fiberout@=false}%
  \fi
  \ifPOE@wirein@top
    \setkeys[psset]{optexp}{fiberpresetin@top=false, fiberin@top=false}%
  \fi
  \ifPOE@wirein@bottom
    \setkeys[psset]{optexp}{fiberpresetin@bottom=false, fiberin@bottom=false}%
  \fi
  \ifPOE@wireout@top
    \setkeys[psset]{optexp}{fiberpresetout@top=false, fiberout@top=false}%
  \fi
  \ifPOE@wireout@bottom
    \setkeys[psset]{optexp}{fiberpresetout@bottom=false, fiberout@bottom=false}%
  \fi
}%
%    \end{macrocode}
% Set the fiber parameters for fiber-optical components only (use fiber=*...).
%    \begin{macrocode}
\define@choicekey*+[psset]{optexp}{wire@preset}%
  [\val\nr]{false,none,true,all}[all]{%
  \ifcase\nr\relax
    \POE@getwirepreset@none
  \or
    \POE@getwirepreset@none
  \or
    \POE@getwirepreset@all
  \or
    \POE@getwirepreset@all
  \fi
}{%
  \ifx\@empty\val
    \POE@getwirepreset@none
  \else
    \pst@expandafter\POE@psset@@wirepreset{#1}\@empty,,\@nil
  \fi
}%
\def\POE@psset@@wirepreset#1#2,#3,#4\@nil{%
  \POE@getwirepreset@all
  \ifx\\#3\\%
    \@nameuse{POE@getwirepreset@#1}%
    \@nameuse{POE@getwirepreset@#2}%
  \fi
}%
\def\POE@getwirepreset@none{%
  \setkeys[psset]{optexp}{%
    wirepresetin@=false, wirepresetout@=false,
    wirepresetin@top=false, wirepresetin@bottom=false, 
    wirepresetout@top=false, wirepresetout@bottom=false}%
}%

\def\POE@getwirepreset@all{%
  \setkeys[psset]{optexp}{%
    wirepresetin@, wirepresetout@,
    wirepresetin@top, wirepresetin@bottom, 
    wirepresetout@top, wirepresetout@bottom}%
}%
\def\POE@getwirepreset@t{%
  \setkeys[psset]{optexp}{%
    wirepresetin@bottom=false, wirepresetout@bottom=false}%
}%
\def\POE@getwirepreset@b{%
  \setkeys[psset]{optexp}{%
    wirepresetin@top=false, wirepresetout@top=false}%
}%
\def\POE@getwirepreset@l{%
  \setkeys[psset]{optexp}{%
    wirepresetout@=false,
    wirepresetout@top=false,
    wirepresetout@bottom=false}%
}%
\def\POE@getwirepreset@r{%
  \setkeys[psset]{optexp}{%
    wirepresetin@=false,
    wirepresetin@top=false,
    wirepresetin@bottom=false}%
}%
\let\POE@getwirepreset@i\POE@getwirepreset@l
\let\POE@getwirepreset@o\POE@getwirepreset@r
%    \end{macrocode}
%
% This code is for all components, fiber-optical and free-ray.
%    \begin{macrocode}
\define@choicekey*+[psset]{optexp}{wire@all}%
  [\val\nr]{false,none,true,all}[all]{%
  \ifcase\nr\relax
    \POE@getwire@none
  \or
    \POE@getwire@none
  \or
    \POE@getwire@all
  \or
    \POE@getwire@all
  \fi
}{%
  \ifx\@empty\val
    \POE@getwire@none
  \else
    \pst@expandafter\POE@psset@@wire{#1}\@empty,,\@nil
  \fi
}%
\def\POE@psset@@wire#1#2,#3,#4\@nil{%
  \POE@getwire@all
  \ifx\@empty#3\@empty
    \@nameuse{POE@getwire@#1}%
    \@nameuse{POE@getwire@#2}%
  \fi
}%
\def\POE@getwire@none{%
  \setkeys[psset]{optexp}{%
    wirein@=false, wireout@=false,
    wirein@top=false, wirein@bottom=false, 
    wireout@top=false, wireout@bottom=false}%
}%
\def\POE@getwire@all{%
  \setkeys[psset]{optexp}{%
    wirein@, wireout@,
    wirein@top, wirein@bottom, 
    wireout@top, wireout@bottom}%
}%
\def\POE@getwire@t{%
  \setkeys[psset]{optexp}{%
    wirein@bottom=false, wireout@bottom=false}%
}%
\def\POE@getwire@b{%
  \setkeys[psset]{optexp}{%
    wirein@top=false, wireout@top=false}%
}%
\def\POE@getwire@l{%
  \setkeys[psset]{optexp}{%
    wireout@=false, wireout@top=false, wireout@bottom=false}%
}%
\def\POE@getwire@r{%
  \setkeys[psset]{optexp}{%
    wirein@=false, wirein@top=false, wirein@bottom=false}%
}%
\let\POE@getwire@i\POE@getwire@l
\let\POE@getwire@o\POE@getwire@r
%    \end{macrocode}
% These are the internal boolkeys for the wire choices done with \opt{wirein},
% \opt{wireout} and \opt{wire}. Do not use them directly.
%    \begin{macrocode}
\define@boolkey[psset]{optexp}[POE@]{wirein@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirein@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirein@bottom}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wireout@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wireout@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wireout@bottom}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirepresetin@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirepresetin@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirepresetin@bottom}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirepresetout@}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirepresetout@top}[true]{}
\define@boolkey[psset]{optexp}[POE@]{wirepresetout@bottom}[true]{}
\psset[optexp]{wire=*all}%
\define@key[psset]{optexp}{wireangleA}{%
  \pst@checknum{#1}\POE@key@wireangleA
}%
\define@key[psset]{optexp}{wireangleB}{%
  \pst@checknum{#1}\POE@key@wireangleB
}%
\define@choicekey+[psset]{optexp}{wirealign}%
  [\val\nr]{rel,abs,relative,center,absolute}%
  {%
    \ifcase\nr\relax
      \let\POE@key@wirealign\POE@str@relative
    \or
      \let\POE@key@wirealign\POE@str@absolute
    \else
      \def\POE@key@wirealign{#1}%
    \fi
  }%
  {\PackageError{pst-optexp}{Unknown value '\val' for wirealign}}%
\define@key[psset]{optexp}{wirestyle}{%
  \@ifundefined{nc#1}%
    {\PackageError{pst-optexp}{Unknown value '#1' for wirestyle}}%
    {\def\POE@key@wirestyle{#1}}}
\psset[optexp]{%
  wireangleA=0,
  wireangleB=0,
  wirealign=relative,
  wirestyle=angle
}%
%    \end{macrocode}
% Which nodes to take for the automatic fiber and wire connections.
%    \begin{macrocode}
\define@key[psset]{optexp}{startnode}{\edef\POE@key@startnode{#1}}%
\define@key[psset]{optexp}{stopnode}{\edef\POE@key@stopnode{#1}}%
\psset[optexp]{%
  startnode=auto,
  stopnode=auto
}%
%    \end{macrocode}
%
% \section{Layering}
%    \begin{macrocode}
\newenvironment{optexp}{\Collect@Body\POE@collect}{}%
\long\def\POE@collect#1{%
  \psset[optexp]{optexpenv}
  \global\POE@oldcnt=\POE@cnt
  \bgroup
    \psset[optexp]{backlayer=true, frontlayer=false}#1%
  \egroup
  \gdef\POE@complist{}\global\POE@cnt=\POE@oldcnt\relax
  \psset[optexp]{backlayer=false, frontlayer=true}%
  #1\ignorespaces}%
%    \end{macrocode}
% \begin{macro}{\backlayer}
%    \begin{macrocode}
\def\backlayer#1{\ifPOE@backlayer #1\fi\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\frontlayer}
%    \begin{macrocode}
\def\frontlayer#1{\ifPOE@frontlayer #1\fi\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \section{Connection code}
% \subsection{drawfiber}
% \begin{macro}{\POE@getnode}
%    \begin{macrocode}
\def\POE@getnode#1#2\@nil{%
  \ifx(#1\relax%)
    \POE@getcoor#1#2
    \edef\POE@temp{{\pst@coor}}%
  \else
    \POE@checkcompname{#1#2}%
    \edef\POE@temp{/\oenode{}{#1#2}\space}%
  \fi%
}%
%    \end{macrocode}
% \begin{macro}{\POE@getcoor}
%    \begin{macrocode}
\def\POE@getcoor(#1){\pst@@getcoor{#1}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% 
% \begin{macro}{\drawfiber}
%    \begin{macrocode}
\def\drawfiber{\drawfiber@{Fiber}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\drawwire}
%    \begin{macrocode}
\def\drawwire{\drawwire@{Wire}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\drawwire@}
%    \begin{macrocode}
\def\drawwire@#1{%
  \def\POE@setconnparam{%
    \let\POE@key@connangleA\POE@key@wireangleA
    \let\POE@key@connangleB\POE@key@wireangleB
    \let\POE@key@connalign\POE@key@wirealign
    \let\POE@key@connstyle\POE@key@wirestyle
  }%
  \drawconn@{#1}
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\drawfiber@}
%    \begin{macrocode}
\def\drawfiber@#1{%
  \def\POE@setconnparam{%
    \let\POE@key@connangleA\POE@key@fiberangleA
    \let\POE@key@connangleB\POE@key@fiberangleB
    \let\POE@key@connalign\POE@key@fiberalign
    \let\POE@key@connstyle\POE@key@fiberstyle
  }%
  \drawconn@{#1}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\drawconn@}
%    \begin{macrocode}
\def\drawconn@#1{%
  \ifPst@custom\else
    \def\pst@par{style=#1}%
  \fi
  \@ifnextchar[%]
    {\drawconn@i}{\drawconn@i[]}}%
\def\drawconn@i[#1]{%
  \addafter@par{#1}%
  \POE@normalizecomps\drawconn@ii}
\def\drawconn@ii{%
  \@ifnextchar\bgroup
    {\drawconn@iii}%
    {}}%
\def\drawconn@iii#1{%
  \def\POE@tempe{#1}\drawconn@iv}%
\def\drawconn@iv{%
  \@ifnextchar\bgroup{\drawconn@v}{}}%
\def\drawconn@v#1{%
  \expandafter\drawconn@vi\expandafter{\POE@tempe}{#1}%
  \def\POE@tempe{#1}\drawconn@iv}%
\def\drawconn@vi#1#2{%
  \begingroup
    \let\psk@angleA\relax
    \let\psk@angleB\relax
    \use@par
    \POE@setconnparam
    \let\POE@angleA\psk@angleA
    \let\POE@angleB\psk@angleB
    \ifx\psk@angleA\relax
      \def\psk@angleA{0 }%3
    \fi
    \ifx\psk@angleB\relax
      \def\psk@angleB{0 }%
    \fi
    \def\POE@tempa{#1}
    \ifx\POE@tempa\@empty
      \edef\POE@comps{/\oenode{}{}\space}
    \else
      \expandafter\POE@getnode#1\@nil
      \edef\POE@comps{\POE@temp}
    \fi
    \def\POE@tempb{#2}
    \ifx\POE@tempb\@empty
      \edef\POE@comps{/\oenode{}{}\space \POE@comps}
    \else
      \expandafter\POE@getnode#2\@nil
      \edef\POE@comps{\POE@temp\space \POE@comps}
    \fi
    \ifPOE@backlayer
      \ifx\POE@key@startnode\POE@str@auto\else
        \POE@pnode{/\POE@key@startnode\space \POE@comps exch pop 
          \POE@dict{GetIfcOrNodeCoord} \tx@UserCoor}{@@A}
      \fi
      \ifx\POE@key@stopnode\POE@str@auto\else
        \POE@pnode{/\POE@key@stopnode\space \POE@comps pop 
                 \POE@dict{GetIfcOrNodeCoord} \tx@UserCoor}{@@B}
      \fi
      \ifx\POE@key@startnode\POE@str@auto
        \ifx\POE@key@stopnode\POE@str@auto
          \POE@pnode{\POE@comps exch \POE@dict{NearestNode} 
                   \tx@UserCoor}{@@A}
          \POE@pnode{\POE@comps pop
                     \POE@dict{/N@@@A @GetCenter ToVec NearestNode} 
                     \tx@UserCoor}{@@B}
        \else
          \POE@pnode{\POE@comps exch pop /N@@@B 
                   \POE@dict{@GetCenter ToVec NearestNode} 
                   \tx@UserCoor}{@@A}
        \fi
      \else\ifx\POE@key@stopnode\POE@str@auto
        \POE@pnode{\POE@comps pop /N@@@A
                 \POE@dict{@GetCenter ToVec NearestNode} 
                 \tx@UserCoor}{@@B}
      \fi\fi
      \pst@getcoor{@@A}\POE@tempa
      \pst@getcoor{@@B}\POE@tempb
      \ifx\POE@angleA\relax
        \ifx\POE@key@connalign\POE@str@absolute
          \psset{angleA=\POE@key@connangleA}%
        \else
          \psset{angleA=! \POE@dict{%
            \POE@tempb \POE@tempa \POE@comps exch 
            \POE@key@connalign\space RelConnAngle
            \POE@key@connangleA\space add }
          }%
        \fi
      \fi
      \ifx\POE@angleB\relax
        \ifx\POE@key@connalign\POE@str@absolute
          \psset{angleB=\POE@key@connangleB}%
        \else
          \psset{angleB=! \POE@dict{%
            \POE@tempa \POE@tempb \POE@comps 
            \POE@key@connalign\space RelConnAngle
            \POE@key@connangleB\space add}
          }%
        \fi
      \fi
      \@nameuse{nc\POE@key@connstyle}{@@A}{@@B}
    \fi
  \endgroup
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{POE@pnode}
%   Do some trickery to define \cs{pnode} inside \cs{pscustom}, which is
%   required if one wants to use \cs{drawfiber} inside \cs{pscustom}.
%    \begin{macrocode}
\def\POE@pnode#1#2{%
  \ifPst@custom
    \code{%
      gsave 
        /currentpoint load stopped { 0 0 moveto } if 
        1 8.3021995 div dup neg scale 
        tx@NodeDict begin 
          {#1 \tx@ScreenCoor } false /N@#2 10 {InitPnode} 
          /NodeScale {} def NewNode 
        end 
      grestore 
    }%
  \else
    \pnode(!#1){#2}
  \fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsection{drawbeam}
%
% \begin{macro}{\begin@BeamObj}
%    \begin{macrocode}
\def\begin@BeamObj{%
  \addbefore@par{n=n}%
  \begin@SpecialObj%
  \addto@pscode{%
     \pst@optexpdict
     /loadbeampoints \POE@key@loadbeampoints\space def 
     /loadbeam \ifPOE@loadbeam true \else false \fi def
     /beamangle \POE@key@beamangle\space def
     /beamdiv \POE@key@beamdiv\space def
     /savebeampoints \POE@key@savebeampoints\space def
     /savebeam \ifPOE@savebeam true \else false \fi def
     /startinsidecount \POE@key@startinsidecount\space cvi def
     startinsidecount 0 eq {
       /beaminsidefirst false def
       /startinside false def
     } {
       /beaminsidefirst \ifPOE@beaminsidefirst true \else false \fi def
       /startinside \ifPOE@startinside true \else false \fi def
     } ifelse
     /stopinsidecount \POE@key@stopinsidecount\space cvi def
     stopinsidecount 0 eq {
       /beaminsidelast false def
       /stopinside false def
     } {
       /beaminsidelast \ifPOE@beaminsidelast true \else false \fi def
       /stopinside \ifPOE@stopinside true \else false \fi def
     } ifelse
     /beaminside \ifPOE@beaminside true \else false \fi def
     /connectifc \ifPOE@raytrace false \else true \fi def
     /beamalign 
       \ifx\POE@key@beamalign\POE@str@absolute\space 
         absolute
       \else\ifx\POE@key@beamalign\POE@str@relative\space
         relative
       \else
         firstcomp
       \fi\fi def
     /beampathskip \POE@key@beampathskip\space def
     \POE@key@beampathcount\space dup -1 gt { beampathskip add } if /beampathcount ED
     /useNA \ifPOE@useNA true \else false \fi def
     /aligntovector \ifx\POE@key@beamnodealign\POE@str@vector true \else false \fi def
     /beamdiffractionorder 
       \ifx\POE@key@beamdiffractionorder\@empty null 
       \else\POE@key@beamdiffractionorder\space 
       \fi def
     /beammode 
       \ifx\POE@key@beammode\POE@str@reflective
         refl
       \else\ifx\POE@key@beammode\POE@str@transmittive
         trans
       \else
         auto
       \fi\fi def
  }%
  \let\tx@Line\POE@tx@Line
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\begin@WideBeamObj}
%    \begin{macrocode}
\def\begin@WideBeamObj{%
  \addbefore@par{style=Beam}%
  \begin@BeamObj
  \let\pst@linetype\pst@arrowtype
  \pst@addarrowdef%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\begin@SingleBeamObj}
%    \begin{macrocode}
\let\begin@SingleBeamObj\begin@WideBeamObj
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\drawbeam}
%    \begin{macrocode}
\def\drawbeam{\pst@object{drawbeam}}%
\def\drawbeam@i{%
  \begin@SingleBeamObj
  \POE@getcomps[\drawbeam@ii%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\drawwidebeam}
%    \begin{macrocode}
\def\drawwidebeam{\pst@object{drawwidebeam}}%
\def\drawwidebeam@i{%
  \begin@WideBeamObj
  \POE@getcomps[\drawwidebeam@ii%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@beam@use@pscode}
%
%   This is a hack which allows us to leave the names and coordinates of the
%   beam end points on the stack after the \opt{@endspecial} call. This replaces
%   \nxLcs{use@pscode} in \nxLcs{end@BeamObj}. These values on the stack must be
%   consumed directly after closing the beam object.
%    \begin{macrocode}
\def\POE@beam@use@pscode{%
  \pstverb{%
    \pst@dict
    \tx@STP
    \pst@newpath
    \psk@origin
    \psk@swapaxes
    \pst@code
    end
    count /ocount exch def
  }%
  \gdef\pst@code{}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\end@BeamObj}
%    \begin{macrocode}
\def\end@BeamObj{%
  \addto@pscode{ end }%
  \let\psk@fillstyle\relax
  \ifPOE@optexpenv
    \ifPOE@frontlayer
%    \end{macrocode}
% Erase all beam-drawing code and leave only \opt{false} on the stack to 
% indicate that no beampoints should be stored.
%    \begin{macrocode}
      \def\pst@code{ false false }%
    \fi
  \fi
  \let\use@pscode\POE@beam@use@pscode
  \end@SpecialObj%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\drawbeam@ii}
%    \begin{macrocode}
\def\drawbeam@ii{%
  \ifodd
%    \end{macrocode}
% Do not draw anything only if both linestyle and ArrowInside are not set.
%    \begin{macrocode}
    \ifx\pslinestyle\@none\ifx\psk@ArrowInside\@empty 1\else 0\fi\else 0\fi
    \addto@pscode{ cleartomark false false }%
  \else
%    \end{macrocode}
% Get the beamproperties from the first component if it is a source.
%    \begin{macrocode}
    \POE@HandleSourceBeam
%    \end{macrocode}
% I need to pack it this way in order to avoid replacing the \opt{n} inside the
% code here. This must be done later, when it refers to the correct refractive
% indices.
%    \begin{macrocode}
    \addto@pscode{%
      {/nbeam {\POE@key@n cvx exec} bind def
       \ifPOE@pswarning
         /Warning /PrintWarning load def
       \else
         /Warning /pop load def
       \fi}%
      [ \POE@key@beampos\space counttomark dup 
      0 eq { 
        pop 0 0 
      } {
        1 eq {
          0 exch
        } if
      } ifelse \tx@ScreenCoor] cvx
      beamangle
      currentdict /lastBeamPointTmp undef
      currentdict /lastVecTmp undef
      loadbeampoints 1 ge 
      tx@NodeDict /N@\oenodeBeam{\POE@key@loadbeampoints} known and {
        /N@\oenodeBeam{\POE@key@loadbeampoints} @GetCenter ToVec 
        /lastBeamPointTmp ED
      } if
      currentdict /lastVec\POE@key@loadbeampoints\space known 
      loadbeam and {
        /lastVecTmp /lastVec\POE@key@loadbeampoints\space load def
      } if
      TraceBeam 
      \POE@strokesinglebeam
      savebeampoints 1 ge
      currentdict /lastBeamPointTmp known and dup { 
        lastBeamPointTmp 
        /N@\oenodeBeam{\POE@key@savebeampoints}\space 4 -1 roll
      } if 
      savebeam currentdict /lastVecTmp known and dup {
        /prevVec\POE@key@savebeampoints\space
        currentdict /prevVecTmp known { prevVecTmp }{ 0 0 } ifelse
        /lastVec\POE@key@savebeampoints\space lastVecTmp 7 -1 roll
      } if
    }%
  \fi
  \end@BeamObj
  \POE@Verb{%
    { tx@OptexpDict begin ToVec def ToVec def end } if
    { \tx@NodeScale @NewNode } if
  }%
}%
%    \end{macrocode}
% \end{macro}
% This fix is necessary for pst-node since version 1.21.
%    \begin{macrocode}
\def\tx@NodeScale{%
  \pst@nodedict 
    /NodeScale {\ifx\pstnodescale\@undefined\else\pstnodescale\fi} def 
  end }
%    \end{macrocode}
% 
% \begin{macro}{\POE@strokesinglebeam}
%    \begin{macrocode}
\def\POE@strokesinglebeam{%
  gsave 
    /Lineto /lineto load def
    20 dict begin
      DrawbeamPrepare
%    \end{macrocode}
% If there are only three elements or less on the stack, the first ray
% misses the next interface or is even parallel to the input interface.
%    \begin{macrocode}
      counttomark 3 gt { 
%    \end{macrocode}
% Define some parameters for Drawbeam which are based on TeX-parameters
%    \begin{macrocode}
        \ifx\psk@arrowA\arrowType@H
          \pst@number\pshooklength
        \else
          \psk@arrowsize\space CLW mul add dup \psk@arrowlength\space mul exch \psk@arrowinset mul neg add  
        \fi
        /arrowlength exch def 
        /arrowminlength \POE@key@ArrowInsideMinLength\space\pst@number\psunit mul def
        /arrowmaxlength \POE@key@ArrowInsideMaxLength\space\pst@number\psunit mul def
        /arrowpos  \psk@ArrowInsidePos\space def
        /arrowno   \psk@ArrowInsideNo\space cvi def
        /ArrowPosStart \psk@ArrowInsideOffset\space def
        /dArrowPosStart \psk@ArrowInsidePos\space def
        counttomark 3 idiv /N exch def
        (\psk@ArrowInside) length 0 gt {
          DrawbeamArrowInside
        }{
          DrawbeamSimple
        } ifelse
      } if
      cleartomark
    end
    \tx@setlinejoin
    \pst@number\pslinewidth SLW
    \pst@usecolor\pslinecolor
    \tx@setStrokeTransparency
    \@nameuse{psls@\pslinestyle}
  grestore
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\drawwidebeam@ii}
%    \begin{macrocode}
\def\drawwidebeam@ii{%
  \def\pst@fill##1{ gsave ##1 grestore }%
%    \end{macrocode}
% Get the beamproperties from the first component if it is a source.
%    \begin{macrocode}
  \POE@HandleSourceBeam
  \addto@pscode{%
    {/nbeam {\POE@key@n cvx exec} bind def
      \ifPOE@pswarning
        /Warning /PrintWarning load def
      \else
        /Warning /pop load def
      \fi}%
  }%
%    \end{macrocode}
% arrange and create the input vectors
%    \begin{macrocode}
  \addto@pscode{%
    beamangle dup
    beamdiv 0.5 mul dup 4 -1 roll add 3 1 roll sub
  }%
%    \end{macrocode}
% the start positions
%    \begin{macrocode}
  \addto@pscode{%
    [ \POE@key@beampos\space counttomark dup
      0 eq {
        pop 0 0 
      } {
        1 eq {
          0 exch 
        } if
      } ifelse
%    \end{macrocode}
% if \opt{beamwidth} is defined at Postscript level, it was defined from the source object.
%    \begin{macrocode}
      currentdict /beamwidth known {
        beamwidth currentdict /beamwidth undef
      } {
        mark \POE@key@beamwidth\space counttomark 0 eq { 0 } if exch pop
      } ifelse 0.5 mul
      3 copy add \tx@ScreenCoor\space ToVec 
      5 1 roll sub \tx@ScreenCoor
    ] cvx
  }%
%    \end{macrocode}
% rearrange options
%    \begin{macrocode}
  \addto@pscode{ exch 4 -1 roll 4 2 roll exch }% 
%    \end{macrocode}
% stroke and/or fill
%    \begin{macrocode}
  \addto@pscode{%
    counttomark mark exch 2 add 1 roll
    gsave
      \ifx\psk@fillstyle\relax
        currentdict /fillBeam undef
      \else
        /fillBeam {\psk@fillstyle} def
      \fi
      /strokeBeam 
        \ifx\pslinestyle\@none false \else true \fi 
        \ifx\psk@ArrowInside\@empty false \else true \fi or def
      [/lastBeamPointTmpLow /lastBeamPointTmpUp
      /lastVecTmpLow /lastVecTmpUp]
      {currentdict exch undef} forall
      tx@NodeDict /N@\oenodeBeamLow{\POE@key@loadbeampoints} known
      tx@NodeDict /N@\oenodeBeamUp{\POE@key@loadbeampoints} known
      loadbeampoints 1 ge and and {
        /N@\oenodeBeamLow{\POE@key@loadbeampoints} @GetCenter ToVec 
        /lastBeamPointTmpLow ED
        /N@\oenodeBeamUp{\POE@key@loadbeampoints} @GetCenter ToVec 
        /lastBeamPointTmpUp ED
      } if
      loadbeam 
      currentdict /lastVecLow\POE@key@loadbeampoints\space known and 
      currentdict /lastVecUp\POE@key@loadbeampoints\space known and {
        /lastVecTmpLow /lastVecLow\POE@key@loadbeampoints\space load def
        /lastVecTmpUp /lastVecUp\POE@key@loadbeampoints\space load def
      } if
      TraceAndFillWideBeam
    grestore pop % pop off the mark
%    \end{macrocode}
% Rearrange the points so that we can use two Drawbeam calls.
% 
%    \begin{macrocode}
    counttomark 0 gt strokeBeam and {
      counttomark dup /cnta ED /cntb ED
      cnta 6 idiv {
        cnta 3 roll /cnta cnta 3 sub def
        /cntb cntb 3 sub def
        cntb 3 roll /cntb cntb 3 sub def
      } repeat
      counttomark 2 idiv 1 add mark exch 1 roll
      \POE@strokesinglebeam
      \POE@strokesinglebeam
    } {
      pop % pop off the mark
    } ifelse
    currentdict /fillBeam known strokeBeam or
    savebeampoints 1 ge and
    currentdict /lastBeamPointTmpLow known and
    currentdict /lastBeamPointTmpUp known and dup {
      lastBeamPointTmpLow /N@\oenodeBeamLow{\POE@key@savebeampoints}
      lastBeamPointTmpUp /N@\oenodeBeamUp{\POE@key@savebeampoints}
      7 -1 roll
    } if
    currentdict /fillBeam known strokeBeam or 
    savebeam and
    currentdict /lastVecTmpLow known and
    currentdict /lastVecTmpUp known and dup {
      /prevVecLow\POE@key@savebeampoints\space /prevVecUp\POE@key@savebeampoints\space
      currentdict /prevVecLow known currentdict /prevVecUp known and {
        prevVecLow 3 -1 roll prevVecUp
      } { 
        0 0 3 -1 roll 0 0
      } ifelse
      /lastVecLow\POE@key@savebeampoints\space lastVecTmpLow
      /lastVecUp\POE@key@savebeampoints\space lastVecTmpUp
      13 -1 roll
    } if
  }%
  \end@BeamObj
  \POE@Verb{%
    { tx@OptexpDict begin 4 { ToVec def } repeat end } if
    { \tx@NodeScale @NewNode @NewNode } if 
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@Drawbeam}
%    \begin{macrocode}
\pst@def{Drawbeam}<
%    \end{macrocode}
% Remove trailing empty line parts.
%    \begin{macrocode}
    { counttomark 6 le {
        exit
      } if
      3 index not {
        pop pop pop 
      }{ 
        exit
      } ifelse
    } loop
%    \end{macrocode}
% Remove heading empty line parts. Note, that the first point must not have
% 'draw = true', because it is the starting point which we have to move to.
%    \begin{macrocode}
    { counttomark 3 le {
        exit
      } if
      counttomark 3 sub index not {
        counttomark -3 roll pop pop pop
      }{
        exit
      } ifelse
    } loop
%    \end{macrocode}
%    \begin{macrocode}
  counttomark 3 le {
%    \end{macrocode}
% first ray misses the next interface or is even parallel to the input interface.
%    \begin{macrocode}
    cleartomark
  }{
%    \end{macrocode}
% This is the /Line definition from \opt{pstricks-add}, adapted to the beam path
% structure which includes the boolean values to indicate if a line is drawn, or
% if we use moveto. There was no way to patch the original definition to account
% for the moveto parts and avoid duplicating the code.
%    \begin{macrocode}
  counttomark 3 div cvi /N ED
  (\psk@ArrowInside) length 0 gt { 
    \ifx\psk@arrowA\arrowType@H   % do we have a Hook arrow at the beginning?
      \pst@number\pshooklength  % yes 
    \else
      \psk@arrowsize\space CLW mul add dup \psk@arrowlength\space mul exch \psk@arrowinset mul neg add  
    \fi
    /arrowlength exch def 
    6 copy pop				% copy all four values for the arrow line
    /y1 ED /x1 ED pop /y2 ED /x2 ED 	% save them
    /Alpha y2 y1 sub x2 x1 sub Atan def % the gradient of the line
    pop 3 -1 roll 5 1 roll 
    ArrowA 
    x1 Alpha cos arrowlength mul add	% dx add
    y1 Alpha sin arrowlength mul add	% dy add, to get the current point at the end of the arrow tip
    5 -1 roll 3 1 roll true
    /N N 1 sub def
    N {
      6 copy pop 
      /y1 ED /x1 ED pop /y2 ED /x2 ED /draw ED
%    \end{macrocode}
% Check for line segment length and draw the arrow only, if the segment is long
% enough. This is in first place to avoid drawing an inside arrow for the
% pinhole which has three interfaces instead of one so that it can be used as
% real spatial filter.
%    \begin{macrocode}
      x1 y1 x2 y2 @ABDist dup
      \POE@key@ArrowInsideMinLength\space\pst@number\psunit mul ge 
      exch \POE@key@ArrowInsideMaxLength\space\pst@number\psunit mul dup 0 lt 
        3 1 roll le or and {
        x1 y1
        \psk@ArrowInsidePos\space 1 gt {
          /Alpha y2 y1 sub x2 x1 sub Atan def
          /ArrowPos \psk@ArrowInsideOffset\space def
          /dArrowPos \psk@ArrowInsidePos\space abs def
          \psk@ArrowInsideNo\space cvi {
            /ArrowPos ArrowPos dArrowPos add def
            x1 Alpha cos ArrowPos mul add
            y1 Alpha sin ArrowPos mul add
            6 index { ArrowInside } if
            pop pop
          } repeat
        }{
          /ArrowPos \psk@ArrowInsideOffset\space def
          /dArrowPos \psk@ArrowInsideNo 1 gt {%
            1.0 \psk@ArrowInsideNo 1.0 add div
          }{\psk@ArrowInsidePos } ifelse def
            \psk@ArrowInsideNo\space cvi {
              /ArrowPos ArrowPos dArrowPos add def
              x2 x1 sub ArrowPos mul x1 add
              y2 y1 sub ArrowPos mul y1 add
              6 index { ArrowInside } if
              pop pop
            } repeat
        } ifelse
        pop pop
      } if
      draw {Lineto}{moveto} ifelse
    } repeat
  }{
    pop 5 copy 3 -1 roll pop 
    ArrowA pop pop pop pop
    counttomark 3 idiv -1 2 {
      pop {
        lineto
      }{
        moveto
      } ifelse
    } for
  } ifelse
  {CP 4 2 roll ArrowB lineto pop pop } {moveto} ifelse
%    \end{macrocode}
% remove the mark
%    \begin{macrocode}
  pop
  } ifelse
>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@getcomprange}
%    \begin{macrocode}
\def\POE@getcomprange#1-#2\@nil{%
  \ifx\\#2\\%
    \ifx\\#1\\%
%    \end{macrocode}
% empty option, use the current component ID
%    \begin{macrocode}
      \@tempcnta=\POE@cnt
      \@tempcntb=\POE@cnt
    \else
%    \end{macrocode}
% A single number was given
%    \begin{macrocode}
      \@tempcnta=#1
      \@tempcntb=#1
%    \end{macrocode}
% Check if the number is valid, otherwise quit with an error.
%    \begin{macrocode}
      \ifodd
        \ifnum 0<\@tempcnta\ifnum\@tempcntb>\the\POE@cnt \@ne\else\z@\fi\else\@ne\fi
        \PackageError{pst-optexp}%
          {Component ID \the\@tempcnta\space is not valid, 
           \ifnum\the\POE@cnt=0 no components have been defined\else
           valid range is from 1 to \the\POE@cnt\fi}
      \fi
    \fi
  \else
    \ifx\\#1\\%
      \@tempcnta=\@ne
    \else
      \@tempcnta=#1
    \fi
    \edef\POE@temp{\POE@getfirstchar#2\@nil}%
    \expandafter\ifx\POE@temp<\relax
      \POE@getlastcompprev#2%
    \else
      \POE@getlastcomp#2%
    \fi
    \POE@checkandfixcomprange
  \fi
}%
\def\POE@getcomprangeprev<#1-#2\@nil{%
  \@tempcnta=\POE@cnt
  \@tempcntb=\POE@cnt
  \ifx\\#1\\%
    \advance\@tempcnta by -1
  \else
    \advance\@tempcnta by -#1
  \fi
  \ifx\\#2\\\else
    \edef\POE@temp{\POE@getfirstchar#2\@nil}%
    \expandafter\ifx\POE@temp<\relax
      \POE@getlastcompprev#2%
    \else
      \POE@getlastcomp#2%
    \fi
  \fi
  \POE@checkandfixcomprange
}%
\def\POE@checkandfixcomprange{%
  \ifnum\@tempcnta>\POE@cnt
    \ifnum\@tempcntb>\POE@cnt
      \PackageError{pst-optexp}%
        {All components \the\@tempcnta-\the\@tempcntb\space out of range}%
    \fi
  \fi
  \ifnum\@tempcnta<\@ne
    \PackageWarning{pst-optexp}%
      {Component ID \the\@tempcnta\space is not valid, setting to 1.}%
    \@tempcnta=\@ne
  \else\ifnum\@tempcnta>\POE@cnt
    \PackageWarning{pst-optexp}%
      {A: Component ID \the\@tempcnta\space is not valid, setting to \MessageBreak
       the last defined value (\the\POE@cnt).}%
    \@tempcnta=\POE@cnt
  \fi\fi
  \ifnum\@tempcntb>\POE@cnt
    \PackageWarning{pst-optexp}%
      {B: Component ID \the\@tempcntb\space is not valid, setting to \MessageBreak
       the last defined value (\the\POE@cnt).}%
    \@tempcntb=\POE@cnt
  \else\ifnum\@tempcntb<\@ne
    \PackageWarning{pst-optexp}%
      {Component ID \the\@tempcntb\space is not valid, setting to 1.}%
    \@tempcntb=\@ne
  \fi\fi
}%
\def\POE@getlastcomp#1-{%
  \ifx\\#1\\%
    \ifnum\@tempcnta>\POE@cnt
      \PackageError{pst-optexp}{All components \the\@tempcnta- out of range.}%
    \fi%
    \@tempcntb=\POE@cnt
  \else
    \@tempcntb=#1\relax
  \fi
}%
\def\POE@getlastcompprev<#1-{%
  \@tempcntb=\POE@cnt
  \ifx\\#1\\%
    \advance\@tempcntb by -1
  \else
    \advance\@tempcntb by -#1
  \fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@getcomps}
%    \begin{macrocode}
\def\POE@getcomps#1#2{%
  \def\POE@aftercomps{\addto@pscode{#1 \POE@comps }#2}%
  \def\POE@comps{}%
  \POE@getcomps@i%
}%
\def\POE@getcomps@i{%
  \@ifnextchar(%)
    {\POE@getplanenode@i}%
    {\POE@getcomps@ii}
}%
\def\POE@getcomps@ii{%
  \@ifnextchar\bgroup{\POE@getcomps@iii}{\POE@aftercomps}%
}%
\def\POE@getfirstchar#1#2\@nil{#1}%
\def\POE@getprevcompid<#1\@nil{%
  \ifx\\#1\\%
    \number\numexpr\POE@cnt-1\relax
  \else
    \number\numpexp\POE@cnt-#1\relax
  \fi
}%    
\def\POE@getcomps@iii#1{%
  \edef\POE@temp{\POE@getfirstchar#1{}\@nil}%
  \ifx\POE@temp\@empty
    \POE@getcomp{(\oenode{}{})}%
  \else\expandafter\ifx\POE@temp(\relax%)
    \POE@getplanenode#1%
  \else\ifnum9<1\POE@temp\relax
    \expandafter\POE@getcomprange#1-\@nil
    \POE@getcomp{%
      (\POE@str@basicname@prefix\POE@str@basicname@default)
      \the\@tempcnta\space\the\@tempcntb\space GetCompRange %
    }%
  \else\expandafter\ifx\POE@temp<\relax
    \expandafter\POE@getcomprangeprev#1-\@nil
    \POE@getcomp{%
      (\POE@str@basicname@prefix\POE@str@basicname@default)
      \the\@tempcnta\space\the\@tempcntb\space GetCompRange %
    }%
  \else\expandafter\ifx\POE@temp-\relax
    \POE@getcomprange#1-\@nil
    \POE@getcomp{%
      (\POE@str@basicname@prefix\POE@str@basicname@default) 
      \the\@tempcnta\space\the\@tempcntb\space GetCompRange %
    }%
  \else
    \POE@checkcompname{#1}%
    \POE@getcomp{(\oenode{}{#1})}%
  \fi\fi\fi\fi\fi%
  \POE@getcomps@i%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@getplanenode}
%    \begin{macrocode}
\def\POE@getplanenode(#1){%
  \pst@@getcoor{#1}%
  \advance\POE@nodecnt by 1
  \POE@getcomp{%
    {\pst@coor} {0 1} 
    (\POE@str@basicname@default N@\the\POE@nodecnt) 
    {\tx@UserCoor} NewTempNodeComp 
    (\POE@str@basicname@default N@\the\POE@nodecnt)
  }%
}%
\def\POE@getplanenode@i(#1){\POE@getplanenode(#1)\POE@getcomps@i}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@getcomp}
%    \begin{macrocode}
\def\POE@getcomp#1{%
  \ifx\POE@comps\@empty
    \edef\POE@tempc{#1}%
  \else
    \edef\POE@tempd{#1}%
  \fi
  \edef\POE@comps{#1 \POE@comps}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\POE@normalizecomps}
%   Expands all component parameters by resolving the ranges, i.e. {1-3}
%   becomes {1}{2}{3}. Nodes are wrapped with brackets, if necessary:
%   (1,1) becomes {(1,1)}.
%    \begin{macrocode}
\def\POE@normalizecomps#1{%
  \def\POE@aftercomps{\expandafter#1\POE@comps}%
  \def\POE@comps{}%
  \POE@normalizecomps@i%
}%
\def\POE@normalizecomps@i{%
  \@ifnextchar(%)
    {\POE@normalizecomps@ii}%
    {\POE@normalizecomps@iii}
}%
\def\POE@normalizecomps@ii(#1){%
  \edef\POE@comps{\POE@comps{(#1)}}%
  \POE@normalizecomps@i
}%
\def\POE@normalizecomps@iii{%
  \@ifnextchar\bgroup{\POE@normalizecomps@iv}{\POE@aftercomps}%
}%
%    \end{macrocode}
%
% Analyze the content of the comp id and expand it accordingly.
%    \begin{macrocode}
\def\POE@normalizecomps@iv#1{%
  \edef\POE@temp{\POE@getfirstchar#1{}\@nil}%
  \let\POE@tempb\POE@getcomprange
  \ifnum9<1\POE@temp\relax
    \def\POE@tempa{1}%
  \else\expandafter\ifx\POE@temp-\relax
    \def\POE@tempa{1}%
  \else\expandafter\ifx\POE@temp<\relax
    \def\POE@tempa{1}%
    \let\POE@tempb\POE@getcomprangeprev
  \else
    \def\POE@tempa{0}%
  \fi\fi\fi
  \ifodd\POE@tempa
    \POE@tempb#1-\@nil
    \ifnum\@tempcnta<\@tempcntb \def\POE@rel{<}\def\POE@inc{\@ne}%
    \else \def\POE@rel{>}\def\POE@inc{\m@ne}\fi
    \advance\@tempcntb\POE@inc
    \whiledo{\@tempcnta\POE@rel\@tempcntb}{%
      \edef\POE@comps{\POE@comps{\the\@tempcnta}}%
      \advance\@tempcnta\POE@inc
    }%
  \else
    \edef\POE@comps{\POE@comps{#1}}%
  \fi
  \POE@normalizecomps@i%
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Automatic connections}
%
% \begin{macro}{\POE@PresetWireConn}
% Draw automatic wires for electrical components.
%    \begin{macrocode}
\def\POE@PresetWireConn{%
  \ifPOE@startbox\else
    \ifPOE@wirepresetin@
      \drawwire@{WireIn}(\oenodeRefA{}){}
    \else\ifPOE@fiberin@
      \drawfiber@{FiberIn}(\oenodeRefA{}){}
    \fi\fi
  \fi
  \ifPOE@endbox\else
    \ifPOE@wirepresetout@
      \drawwire@{WireOut}{}(\oenodeRefB{})
    \else\ifPOE@fiberout@
      \drawfiber@{FiberOut}{}(\oenodeRefB{})
    \fi\fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\POE@PresetFiberConn}
% Draw automatic fiber or wires for fiber components.
%    \begin{macrocode}
\def\POE@PresetFiberConn{%
  \ifPOE@startbox\else
    \ifPOE@fiberpresetin@
      \drawfiber@{FiberIn}(\oenodeRefA{}){}
    \else\ifPOE@wirein@
      \drawwire@{WireIn}(\oenodeRefA{}){}
    \fi\fi
  \fi
  \ifPOE@endbox\else
    \ifPOE@fiberpresetout@
      \drawfiber@{FiberOut}{}(\oenodeRefB{})
    \else\ifPOE@wireout@
      \drawwire@{WireOut}{}(\oenodeRefB{})
    \fi\fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@InternalConn}
%    \begin{macrocode}
\def\POE@InternalConn{%
  \ifPOE@beam
    \ifPOE@endbox
      \drawbeam[raytrace=false](\oenodeRefA{}){}
    \else\ifPOE@startbox
      \drawbeam[raytrace=false]{}(\oenodeRefB{})
    \else
      \drawbeam[raytrace=false](\oenodeRefA{}){}(\oenodeRefB{})
    \fi\fi
  \else
    \ifPOE@startbox\else
      \ifPOE@fiberin@
        \drawfiber@{FiberIn}(\oenodeRefA{}){}
      \else\ifPOE@wirein@
        \drawwire@{WireIn}(\oenodeRefA{}){}
      \fi\fi
    \fi
    \ifPOE@endbox\else
      \ifPOE@fiberout@
        \drawfiber@{FiberOut}{}(\oenodeRefB{})
      \else\ifPOE@wireout@
        \drawwire@{WireOut}{}(\oenodeRefB{})
      \fi\fi
    \fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@usefiberorwirestyle}
%    \begin{macrocode}
\def\POE@usefiberorwirestyle{%
  \ifPOE@usefiberstyle
    \psset{style=Fiber, arrows=-, ArrowInside=-}%
  \else\ifPOE@usewirestyle
    \psset{style=Wire, arrows=-, ArrowInside=-}%
  \fi\fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \section{Accessing component nodes} 
% \begin{macro}{\POE@checkcompname}
% Check if a component with name \#1 was already defined.
%    \begin{macrocode}
\def\POE@checkcompname#1{%
  \@expandtwoargs\in@{,#1,}{,\POE@complist,}%
  \ifin@\else
    \PackageError{pst-optexp}{Component '#1' is undefined}
  \fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\oenode}
% Get the full node name of the node \#1 defined in component \#2.
%    \begin{macrocode}
\def\oenode#1#2{%
  \POE@str@basicname@prefix%
  \ifx\\#2\\%
    \POE@str@basicname@default\the\POE@cnt
  \else
    \ifnum9<1#2
      \POE@str@basicname@default
      #2%
    \else
      \POE@prevnode#2\@nil
      \POE@str@basicname@sep%
    \fi%
  \fi%
  #1%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{POE@prevnode}
%    \begin{macrocode}
\def\POE@prevnode#1#2\@nil{%
  \ifx<#1%
    \POE@str@basicname@default
    \ifx\\#2\\%
      \number\numexpr\POE@cnt-1\relax
    \else
      \number\numexpr\POE@cnt-#2\relax
    \fi
  \else
    #1#2%
  \fi
}%
%    \end{macrocode}
% \end{macro}
%
% Define some special nodes, which should be accessed always via these macros.
%
% \begin{macro}{\oenodeExt}
%   The external node which is set with \opt{extnode}.
%    \begin{macrocode}
\def\oenodeExt#1{\oenode{\POE@str@extnode@postfix}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeIn}
%   The first (input) node of the component.
%    \begin{macrocode}
\def\oenodeIn#1{\oenode{1}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeOut}
%   The last (output) node of the component
%    \begin{macrocode}
\def\oenodeOut#1{\oenode{N}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeCenter}
%   The center node of the component.
%    \begin{macrocode}
\def\oenodeCenter#1{\oenode{Center}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeLabel}
%   The transformed label node of the component
%    \begin{macrocode}
\def\oenodeLabel#1{\oenode{Label}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeRefA}
%   The first reference node which is used for positioning of the
%   component. For dipoles it is equivalent to the (\#1) node.
%    \begin{macrocode}
\def\oenodeRefA#1{\oenode{A}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeRefB}
%   The second reference node, for dipoles it is equivalent to the (\#2)
%   node.
%    \begin{macrocode}
\def\oenodeRefB#1{\oenode{B}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeRotref}
%   The rotation reference node.
%    \begin{macrocode}
\def\oenodeRotref#1{\oenode{Rotref}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeTrefA}
%   The transformed first reference node, after applying parameters
%   \opt{compshift}, \opt{compoffset} and \opt{angle}.
%    \begin{macrocode}
\def\oenodeTrefA#1{\oenode{TrefA}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeTrefB}
%   The transformed second reference node.
%    \begin{macrocode}
\def\oenodeTrefB#1{\oenode{TrefB}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenode@RefA}
%   The first reference node, after it was projected on the reflection
%   plane of a tripole, at distance 1 from the center.
%    \begin{macrocode}
\def\oenode@RefA#1{\oenode{@A}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenode@RefB}
%   The second referencen node, projected on the reflection plane.
%    \begin{macrocode}
\def\oenode@RefB#1{\oenode{@B}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenode@TrefA}
%   The transformed, projected first reference node.
%    \begin{macrocode}
\def\oenode@TrefA#1{\oenode{@TrefA}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenode@TrefB}
%   The transformed, projected second reference node.
%    \begin{macrocode}
\def\oenode@TrefB#1{\oenode{@TrefB}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenode@Origin}
%   The origin of the component, available only for tripoles. Introduced
%   to be able to compute the angle between AO and BO at later times
%   (for \cs{rightangleprism} and \cs{optprism}.
%    \begin{macrocode}
\def\oenode@Origin#1{\oenode{Origin}{#1}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{oenode@Path}
% Use this macro for internal use with \cs{pssavepath}.
%    \begin{macrocode}
\def\oenode@Path#1{\oenode{Path@#1}{}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeIfc}
%   The node of the interface no. \#1 of component \#2. Only integer
%   number, N or C are allowed. You should always use this e.g. to
%   access coupler nodes.
%    \begin{macrocode}
\def\oenodeIfc#1#2{%
  \ifnum9<1#1 %
    \oenode{#1}{#2}%
  \else\ifx#1N %
    \oenode{#1}{#2}%
  \else\ifx#1C %
    \oenode{#1}{#2}%
  \else
    \PackageWarning{pst-optexp}{%
      \string\oenodeIfc\space node argument must be\MessageBreak
      integer, 'N', or 'C'.}
  \fi\fi\fi
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeBeam}
%   The end point of the last beam path which was saved with number \#1
%   (default is 1).
%    \begin{macrocode}
\def\oenodeBeam#1{%
  \POE@str@basicname@prefix\POE@str@basicname@default Beam%
  \ifx\\#1\\1\else#1\fi
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeBeamUp}
%   The upper end point of the last wide beam path saved with number \#1
%   (default is 1).
%    \begin{macrocode}
\def\oenodeBeamUp#1{%
  \POE@str@basicname@prefix\POE@str@basicname@default BeamUp%
  \ifx\\#1\\1\else#1\fi
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oenodeBeamLow}
%   The lower end point of the last wide beam path saved with number \#1
%   (default is 1).
%    \begin{macrocode}
\def\oenodeBeamLow#1{%
  \POE@str@basicname@prefix\POE@str@basicname@default BeamLow%
  \ifx\\#1\\1\else#1\fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@beamvec}
%   Generic macro to load the Postscript coordinates of the direction
%   vector of the last beam segment (upper, lower, single, specified
%   with \#1) saved with number \#2.
%    \begin{macrocode}
\def\POE@beamvec#1#2{%
  \POE@dict{%
    /prevVec#1\ifx\\#2\\1\else#2\fi\space dup
    currentdict exch known { load exec }{ pop 0 0 } ifelse
  }%
}%
\def\oeBeamVec#1{\POE@beamvec{}{#1}}%
\def\oeBeamVecUp#1{\POE@beamvec{Up}{#1}}%
\def\oeBeamVecLow#1{\POE@beamvec{Low}{#1}}%
\def\oeBeamVecMedian#1{%
  \oeBeamVecUp{#1} \oeBeamVecLow{#1} \POE@dict{VecAdd NormalizeVec}
}%
\def\oeBeamCenter#1{%
  \psGetNodeCenter{\oenodeBeamUp{#1}} \oenodeBeamUp{#1}.x \oenodeBeamUp{#1}.y
  \psGetNodeCenter{\oenodeBeamLow{#1}} \oenodeBeamLow{#1}.x \oenodeBeamLow{#1}.y
  \POE@dict{VecAdd 0.5 VecScale}
}%
%    \end{macrocode}
% \end{macro}
% 
% \section{Components}
%
% \begin{macro}{\POE@useifccode}
% \begin{macro}{\begin@CompIfc}
%    \begin{macrocode}
\def\POE@useifccode{%
  \POE@Verb{%
    [ \pst@code
    \ifPOE@allowbeaminside true \else false \fi
    \ifPOE@forcebeaminside true \else false \fi
    (\oenode{}{}) {\tx@ScreenCoor}
    NewOptexpComp
  }%
  \gdef\pst@code{}%
}%
\def\begin@CompIfc{%
  \begingroup
}%
\def\end@CompIfc{%
  \addto@pscode{ false }%
  \POE@useifccode
  \endgroup
  \ignorespaces
}%
\def\end@AmbCompIfc{%
  \addto@pscode{ true }%
  \POE@useifccode
  \endgroup
  \ignorespaces
}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\newOptexpComp@}
%    \begin{macrocode}
\def\newOptexpComp@#1#2{%
  \POE@Verb{%
    \tx@NodeScale
    [ #1 #2 
    \ifPOE@allowbeaminside true \else false \fi
    \ifPOE@forcebeaminside true \else false \fi
    (\oenode{}{}) {\tx@ScreenCoor} 
    NewOptexpComp
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\newOptexpComp}
%    \begin{macrocode}
\def\newOptexpComp#1{%
  \newOptexpComp@{#1}{false}%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newOptexpCompAmb}
%    \begin{macrocode}
\def\newOptexpCompAmb#1{%
  \newOptexpComp@{#1}{true}%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newOptexpFiberComp}
%    \begin{macrocode}
\def\newOptexpFiberComp#1{%
  \POE@Verb{%
    \tx@NodeScale
    [ #1 (\oenode{}{}) {\tx@ScreenCoor}
      NewOptexpFiberComp
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{newOptexpElecComp}
% This may change at later times.
%    \begin{macrocode}
\let\newOptexpElecComp\newOptexpFiberComp
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\optplane}
%   Define an invisible plane which is used only for ray tracing. The first node
%   is the origin, the second one is the difference vector.
%    \begin{macrocode}
\def\optplane{%
  \@ifnextchar[%]
    {\optplane@i}{\optplane@i[]}%
}%
\def\optplane@i[#1](#2){%
  \pst@getcoor{#2}\POE@tempa
%    \end{macrocode}
% Set the height to 0 to circumvent problems with the NA beeing too low
%    \begin{macrocode}
  \optplate[#1, plateheight=0, linestyle=none]%
    (! \POE@tempa exch 1 sub exch \tx@UserCoor)%
    (! \POE@tempa exch 1 add exch \tx@UserCoor)%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@SaveBeamParameters}
%   Save the current beam parameters. This is used to be able to set a
%   source beam with the usual beam parameters.
%    \begin{macrocode}
\def\POE@SaveBeamParameters{%
  \let\POE@tempA\POE@key@beamangle
  \let\POE@tempB\POE@key@beamdiv
  \let\POE@tempC\POE@key@beamwidth
  \let\POE@tempD\POE@key@beamalign
  \let\POE@key@beamangle\relax
  \let\POE@key@beamdiv\relax
  \let\POE@key@beamwidth\relax
  \let\POE@key@beamalign\relax
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@SetSourceAndRestoreBeamParameters}
%    \begin{macrocode}
\def\POE@SetSourceAndRestoreBeamParameters{%
  \let\POE@key@sourcebeamangle\POE@key@beamangle
  \let\POE@key@sourcebeamdiv\POE@key@beamdiv
  \let\POE@key@sourcebeamwidth\POE@key@beamwidth
  \let\POE@key@sourcebeamalign\POE@key@beamalign
  \let\POE@key@beamangle\POE@tempA
  \let\POE@key@beamdiv\POE@tempB
  \let\POE@key@beamwidth\POE@tempC
  \let\POE@key@beamalign\POE@tempD
}%      
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@HandleSourceBeam}
%   Load beam properties from the first component on the stack, if it is
%   an optical source. Also handle the beamalign=firstcomp case, since
%   this also depends on the first component.
%    \begin{macrocode}
\def\POE@HandleSourceBeam{%
  \addto@pscode{%
    counttomark 0 eq not {
      dup cvn load dup /source known { 
        /source get { def } forall
      }{ pop } ifelse
    } if
%    \end{macrocode}
% Handle the beamalign=firstcomp case. Calculate the angle of the first
% component's reference line and set the beamalign parameter to
% absolute.
%    \begin{macrocode}
    beamalign firstcomp eq {
      dup dup (Center) NodeName tx@NodeDict exch known not {
%    \end{macrocode}
% If we have no node called \opt{\ldots Center}, the first object isn't
% a component, but a node. Switch to relative alignment.
%    \begin{macrocode}
        pop /beamalign relative def
      } {
        RelConnAngle@tref exch atan /beamangle exch def
        /beamalign absolute def
      } ifelse
    } if
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\begin@OptexpObj}
%    \begin{macrocode}
\def\begin@OptexpObj{%
  \global\advance\POE@cnt by 1
  \addbefore@par{compname={}}%
  \pst@killglue
  \begingroup
    \POE@insideobjtrue
    \POE@Verb{InitOptexpComp }%
    \POE@SaveBeamParameters
    \use@par
    \POE@SetSourceAndRestoreBeamParameters
%    \end{macrocode}
% The \opt{compshift} refers to the $y$-direction, shifting in $x$-direction
% is done by \opt{abspos} or \opt{position}
%    \begin{macrocode}
    \let\POE@key@comp@Yshift\POE@key@compshift%
    \let\POE@key@comp@Xshift\POE@key@compoffset%
    \edef\POE@refnodeA{\oenodeRefA{}}%
    \edef\POE@refnodeB{\oenodeRefB{}}%
    \edef\POE@trefnodeA{\oenodeTrefA{}}%
    \edef\POE@trefnodeB{\oenodeTrefB{}}%
    \def\POE@transformnodes{%
      \POE@transformnode{\oenodeRefA{}}{\oenodeTrefA{}}%
      \POE@transformnode{\oenodeRefB{}}{\oenodeTrefB{}}%
    }%
    \def\tx@Line{Line }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\begin@OptexpTripole}
%    \begin{macrocode}
\let\POE@disablepos\relax
\def\begin@OptexpTripole{%
  \begin@OptexpObj
%    \end{macrocode}
% for multipoles the default shifting is in $x$-direction
%    \begin{macrocode}
  \def\POE@key@comp@Xshift{\POE@key@compshift\space neg }%
  \let\POE@key@comp@Yshift\POE@key@compoffset
%    \end{macrocode}
% The positioning parameters are disabled, because \opt{compshift} does the job for tripoles.
%    \begin{macrocode}
  \def\POE@disablepos{%
    \let\POE@key@abspos\@empty
    \let\POE@key@position\@empty
  }%
  \POE@positionrefnodes
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@positionrefnodes}
%    \begin{macrocode}
\def\POE@positionrefnodes{%
  \edef\POE@refnodeA{\oenode@RefA{}}%
  \edef\POE@refnodeB{\oenode@RefB{}}%
  \edef\POE@trefnodeA{\oenode@TrefA{}}%
  \edef\POE@trefnodeB{\oenode@TrefB{}}%
  \def\POE@transformnodes{%
    \POE@transformnode{\oenodeRefA{}}{\oenodeTrefA{}}%
    \POE@transformnode{\oenodeRefB{}}{\oenodeTrefB{}}%
    \POE@transformnode{\oenode@RefA{}}{\oenode@TrefA{}}%
    \POE@transformnode{\oenode@RefB{}}{\oenode@TrefB{}}%
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@unsetbeamparameters}
% Unset some beam parameters which might be used by \cs{optsource}.
%    \begin{macrocode}
\def\POE@unsetbeamparameters{%
  \let\POE@key@beamangle\relax
  \let\POE@key@beamdiv\relax
  \let\POE@key@beamwidth\relax
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\end@OptexpObj}
%    \begin{macrocode}
\def\end@OptexpObj{%
  \ifnum9<1\POE@key@compname\else
    \POE@Verb{
      (\oenode{}{\POE@key@compname})
      (\oenode{}{\the\POE@cnt}) CompAlias }%
  \fi
  \endgroup
  \ignorespaces%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\end@OptexpDipole}
%    \begin{macrocode}
\let\end@OptexpDipole\end@OptexpObj
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\end@OptexpTripole}
%    \begin{macrocode}
\let\end@OptexpTripole\end@OptexpObj
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\addafter@par}
%   Analog to \cs{addbefore@par} from pstricks.tex, but inserts new options at
%   the end of the current token register.  This can be useful to preset options
%   that are not allowed to be changed by the user.
%    \begin{macrocode}
\def\addafter@par#1{%
  \ifx\pst@par\@empty
    \def\pst@par{#1}%
  \else
    \toks@{#1}%
    \pst@toks\expandafter{\pst@par}%
    \edef\pst@par{\the\pst@toks,\the\toks@}%
  \fi%
}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\def\POE@clwh{CLW \pst@number\psxunit 2 mul div }%
\def\POE@clw{CLW \pst@number\psxunit div }%
\let\POE@restorerefnodes\relax
%    \end{macrocode}
% 
% New high-level macros 
% 1) Allow a compressed notation of all provided elements, as most of the organizing code 
%    is mostly equal.
%
% 2) Provide a rather easy-to-use interface for the user to allow new user-defined elements
%
% \begin{macro}{\newOptexpDipole}
%    \begin{macrocode}
\def\newOptexpDipole{%
  \@ifnextchar[%]
    {\POE@newdipole}{\POE@newdipole[]}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newOptexpTripole}
%    \begin{macrocode}
\def\newOptexpTripole{%
  \@ifnextchar[%]
    {\POE@newtripole}{\POE@newtripole[]}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\newOptexpFiberDipole}
%    \begin{macrocode}
\def\newOptexpFiberDipole{%
  \@ifnextchar[%]
    {\POE@newfiberdipole}{\POE@newfiberdipole[]}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@newdipole}
%    \begin{macrocode}
\def\POE@newdipole[#1]#2{%
  \@ifnextchar\bgroup
    {\POE@newdipole@i[#1]{#2}}{\POE@newdipole@i[#1]{#2}{}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\POE@newdipole@i}
%    \begin{macrocode}
\def\POE@newdipole@i[#1]#2#3{%
  \@ifundefined{#2@i}{%
    \@namedef{#2}{\pst@object{#2}}%
    \expandafter\def\csname #2@i\endcsname(##1)(##2){%
      \@ifnextchar\bgroup%
        {\@nameuse{#2@ii}(##1)(##2)}%
        {\@nameuse{#2@ii}(##1)(##2){}}%
    }%
    \expandafter\def\csname #2@ii\endcsname(##1)(##2)##3{%
      \addbefore@par{#3}%
      \addafter@par{#1}%
      \begin@OptexpObj
        \ifPOE@backlayer
          \POE@regNodes{##1}{##2}
        \fi
        \POE@drawcomponent{#2}{##3}
        \ifPOE@backlayer
          \POE@Verb{ (1) (N) (\oenode{}{}) CorrectDipoleIfc }%
          \@ifundefined{#2@conn}{\POE@InternalConn}{\@nameuse{#2@conn}}%
        \fi
      \end@OptexpDipole
    }%
    \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@dipole@nodes}}{}%
  }{%
    \PackageError{pst-optexp}{%
      dipole component '#2' already defined}%
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@newfiberdipole}
%    \begin{macrocode}
\def\POE@newfiberdipole[#1]#2{%
  \@ifnextchar\bgroup
    {\POE@newfiberdipole@i[#1]{#2}}{\POE@newfiberdipole@i[#1]{#2}{}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\POE@newfiberdipole@i}
%    \begin{macrocode}
\def\POE@newfiberdipole@i[#1]#2#3{%
  \@ifundefined{#2@i}{%
    \@namedef{#2}{\pst@object{#2}}%
    \expandafter\def\csname #2@i\endcsname(##1)(##2){%
      \@ifnextchar\bgroup%
        {\@nameuse{#2@ii}(##1)(##2)}%
        {\@nameuse{#2@ii}(##1)(##2){}}%
    }%
    \expandafter\def\csname #2@ii\endcsname(##1)(##2)##3{%
      \addbefore@par{#3}%
      \addafter@par{#1}%
      \begin@OptexpObj
        \ifPOE@backlayer
          \POE@regNodes{##1}{##2}
        \fi
        \POE@drawcomponent{#2}{##3}
        \ifPOE@backlayer
          \POE@Verb{ (1) (N) (\oenode{}{}) CorrectDipoleIfc }%
          \POE@PresetFiberConn
        \fi
        \end@OptexpDipole
      }%
      \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@fiberdipole@nodes}}{}%
   }{%
     \PackageError{pst-optexp}{%
       fiber dipole object '#2' already defined}%
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@newtripole}
%    \begin{macrocode}
\def\POE@newtripole[#1]#2{%
  \@ifnextchar\bgroup
    {\POE@newtripole@i[#1]{#2}}{\POE@newtripole@i[#1]{#2}{}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\POE@newtripole@i}
%    \begin{macrocode}
\def\POE@newtripole@i[#1]#2#3{%
  \@ifundefined{#2@i}{%
    \@namedef{#2}{\pst@object{#2}}%
    \expandafter\def\csname #2@i\endcsname(##1)(##2)(##3){%
      \@ifnextchar\bgroup{\@nameuse{#2@ii}(##1)(##2)(##3)}%
                         {\@nameuse{#2@ii}(##1)(##2)(##3){}}%
    }%
    \expandafter\def\csname #2@ii\endcsname(##1)(##2)(##3)##4{%
      \addbefore@par{#3}%
      \addafter@par{ref@angle=0,#1}%
      \begin@OptexpTripole
        \ifPOE@backlayer
          \POE@calcNodes{##1}{##2}{##3}%
          \POE@regNodes{##1}{##3}%
        \fi
        \POE@drawcomponent{#2}{##4}
        \ifPOE@backlayer
          \POE@InternalConn
        \fi
      \end@OptexpTripole
    }%
    \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@tripole@nodes}}{}%
  }{%
    \PackageError{pst-optexp}{%
      tripole object '#2' already defined}%
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optaom}
%    \begin{macrocode}
\def\optaom{\pst@object{optaom}}%
\def\optaom@i(#1)(#2)(#3){%
  \@ifnextchar\bgroup
    {\optaom@ii(#1)(#2)(#3)}%
    {\optaom@ii(#1)(#2)(#3){}}%
}%
\def\optaom@ii(#1)(#2)(#3)#4{%
  \addafter@par{ref@angle=180}%
  \begin@OptexpTripole
    \ifPOE@backlayer
      \ifx\POE@key@abspos\@empty
        \ifx\POE@key@position\@empty
          \psLNode(#1)(#2){0.5}{\oenode{Tmp}{}}
        \else
          \psLNode(#1)(#2){\POE@key@position}{\oenode{Tmp}{}}
        \fi
      \else
        \psLDNode(#1)(#2){\POE@key@abspos}{\oenode{Tmp}{}}
      \fi
      \POE@calcNodes{#1}{\oenode{Tmp}{}}{#3}%
      \POE@regNodes{#1}{#3}
    \fi
    \POE@drawcomponent{optaom}{#4}
    \ifPOE@backlayer
      \POE@InternalConn
    \fi
  \end@OptexpTripole
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optcoupler}
%    \begin{macrocode}
\def\optcoupler{\pst@object{optcoupler}}%
\def\optcoupler@i(#1)(#2){%
  \@ifnextchar(%)
    {\optcoupler@ii(#1)(#2)}%
    {\optcoupler@ii(#1)(#1)(#2)(#2)}%
}%
\def\optcoupler@ii(#1)(#2)(#3)(#4){%
  \@ifnextchar\bgroup%
    {\optcoupler@iii(#1)(#2)(#3)(#4)}%
    {\optcoupler@iii(#1)(#2)(#3)(#4){}}%
}%
\def\optcoupler@iii(#1)(#2)(#3)(#4)#5{%
  \begin@OptexpObj
    \ifPOE@backlayer
      \ifx\POE@key@coupleralign\POE@str@top
        \pnode(#1){\oenodeRefA{}}
        \pnode(#3){\oenodeRefB{}}
      \else\ifx\POE@key@coupleralign\POE@str@bottom
        \pnode(#2){\oenodeRefA{}}
        \pnode(#4){\oenodeRefB{}}
      \else
        \pst@getcoor{#1}\POE@tempa%
        \pst@getcoor{#2}\POE@tempb%
        \pnode(!\POE@tempa \POE@tempb 
                \POE@dict{VecAdd 0.5 VecScale}
                \tx@UserCoor){\oenodeRefA{}}
        \pst@getcoor{#3}\POE@tempa%
        \pst@getcoor{#4}\POE@tempb%
        \pnode(!\POE@tempa \POE@tempb 
                \POE@dict{VecAdd 0.5 VecScale}
                \tx@UserCoor){\oenodeRefB{}}
      \fi\fi
    \fi
    \POE@drawcomponent{optcoupler}{#5}
    \ifPOE@backlayer
      \POE@Verb{%
        (1) (3) (\oenode{}{}) CorrectDipoleIfc 
        (2) (4) (\oenode{}{}) CorrectDipoleIfc 
      }%
      \ifPOE@fiberpresetin@
        \ifPOE@fiberpresetin@top
          \drawfiber@{FiberIn1}[stopnode=1](#1){}
        \fi
        \ifPOE@fiberpresetin@bottom
          \drawfiber@{FiberIn2}[stopnode=2](#2){}
        \fi
      \fi
      \ifPOE@fiberpresetout@
        \ifPOE@fiberpresetout@top
          \drawfiber@{FiberOut1}[startnode=3]{}(#3)
        \fi
        \ifPOE@fiberpresetout@bottom
          \drawfiber@{FiberOut2}[startnode=N]{}(#4)
        \fi
      \fi
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
% 
% 
% \begin{macro}{\wdmsplitter}
%    \begin{macrocode}
\def\wdmsplitter{\pst@object{wdmsplitter}}%
\def\wdmsplitter@i{%
  \def\my@aftercoors{\wdmsplitter@ii}%
  \POE@couplernodecount=0\relax
  \def\coupler@coors{}%
  \coupler@@getcoors
}
\def\wdmsplitter@ii{%
  \@ifnextchar\bgroup%
    {\wdmsplitter@iii}%
    {\wdmsplitter@iii{}}%
}%
\def\wdmsplitter@iii#1{%
  \ifnum\POE@couplernodecount>1\else
    \PackageError{pst-optexp}%
    {A wdmsplitter expects at least two nodes, one input and one output node}%
  \fi
  \begin@OptexpObj
    \ifPOE@backlayer
%    \end{macrocode}
% Use first coordinate pair as RefA
%    \begin{macrocode}
      \pnode(! [ \coupler@coors 1 \POE@dict{GetCoordinatePair} \tx@UserCoor){\oenodeRefA{}}
      \ifx\POE@key@coupleralign\POE@str@top
%    \end{macrocode}
% For top alignment, use first output coordinate pair, i.e. second coordinate pair as RefB
%    \begin{macrocode}
        \pnode(! [ \coupler@coors 2 \POE@dict{GetCoordinatePair} \tx@UserCoor){\oenodeRefB{}}
      \else\ifx\POE@key@coupleralign\POE@str@bottom
%    \end{macrocode}
% For bottom alignment, use last output coordinate pair
%    \begin{macrocode}
        \pnode(! [ \coupler@coors counttomark 2 idiv \POE@dict{GetCoordinatePair} \tx@UserCoor){\oenodeRefB{}}
      \else
%    \end{macrocode}
% Use median of all output coordinate pairs as RefB
%    \begin{macrocode}
        \pnode(! [ \coupler@coors
%    \end{macrocode}
% remove input node from stack
%    \begin{macrocode}
pop pop
%    \end{macrocode}
% count number of output coordinate pair, keep that number and save it behind the mark
%    \begin{macrocode}
counttomark 2 idiv dup counttomark 1 add 1 roll
1 sub { \POE@dict{VecAdd} } repeat
%    \end{macrocode}
% divide by number of output coordinate pairs and remove mark
%    \begin{macrocode}
4 -1 roll 1 exch div \POE@dict{VecScale} 3 -1 roll pop \tx@UserCoor){\oenodeRefB{}}
      \fi\fi
    \fi
    \POE@drawcomponent{wdmsplitter}{#1}
    \ifPOE@backlayer
      \POE@Verb{%
        2 1 \the\POE@couplernodecount\space
        {
          inttostr (1) exch (\oenode{}{}) CorrectDipoleIfc
        } for
      }%
      \ifPOE@fiberpresetin@
        \drawfiber@{FiberIn}[stopnode=1](! [ \coupler@coors 1 \POE@dict{GetCoordinatePair} \tx@UserCoor){}
      \fi
      \ifPOE@fiberpresetout@
        \ifPOE@fiberpresetout@top
          \drawfiber@{FiberOut1}[startnode=2]{}(! [ \coupler@coors 2 \POE@dict{GetCoordinatePair} \tx@UserCoor)
        \fi
        \ifPOE@fiberpresetout@bottom
          \drawfiber@{FiberOut2}[startnode=N]{}(! [ \coupler@coors \the\POE@couplernodecount\space \POE@dict{GetCoordinatePair} \tx@UserCoor)
        \fi
      \fi
%    \end{macrocode}
% If top and bottom fibers are drawn, we must also draw all other output fibers
%    \begin{macrocode}
        \ifPOE@fiberpresetout@top\ifPOE@fiberpresetout@bottom
          \@tempcnta=\POE@couplernodecount
          \advance\@tempcnta by -3
          \ifnum0<\@tempcnta
            \multido{\i=3+1}{\the\@tempcnta}{%
              \drawfiber@{FiberOut}[startnode=\i]{}(! [ \coupler@coors \i\space \POE@dict{GetCoordinatePair} \tx@UserCoor)
            }%
          \fi
        \fi\fi  
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\wdmcoupler}
%    \begin{macrocode}
\def\wdmcoupler{\pst@object{wdmcoupler}}%
\def\wdmcoupler@i{%
  \def\my@aftercoors{%
%    \end{macrocode}
% Subtract one, because we counted all nodes. However, we can always access the last
% node by N, so we more often use the second last, i.e the last input node
%    \begin{macrocode}
    \advance\POE@couplernodecount by -1\relax%
    \wdmcoupler@ii}%
  \POE@couplernodecount=0\relax
  \def\coupler@coors{}%
  \coupler@@getcoors
}
%    \end{macrocode}
% \begin{macro}{\coupler@@getcoors}
%   Read in a variable number of node coordinates. The coordinates are saved in \cs{coupler@coors},
%   their number in \cs{POE@couplernodecount}.
%    \begin{macrocode}
\def\coupler@@getcoors(#1){%
  \advance\POE@couplernodecount by \@ne\relax%
  \pst@@getcoor{#1}%
  \edef\coupler@coors{\pst@coor\coupler@coors}%
  \@ifnextchar({\coupler@@getcoors}{\my@aftercoors}%
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\def\wdmcoupler@ii{%
  \@ifnextchar\bgroup%
    {\wdmcoupler@iii}%
    {\wdmcoupler@iii{}}%
  }%
\def\wdmcoupler@iii#1{%
  \ifnum\POE@couplernodecount>0\else
    \PackageError{pst-optexp}%
    {A wdmcoupler expects at least two nodes, one input and one output node}%
  \fi
  \begin@OptexpObj
    \ifPOE@backlayer
%    \end{macrocode}
% Use last coordinate pair as RefB
%    \begin{macrocode}
      \pnode(! [ \coupler@coors \the\POE@couplernodecount\space 1 add \POE@dict{GetCoordinatePair} \tx@UserCoor){\oenodeRefB{}}
      \ifx\POE@key@coupleralign\POE@str@top
%    \end{macrocode}
% For top alignment, use first coordinate pair as RefA
%    \begin{macrocode}
         \pnode(! [ \coupler@coors \POE@dict{GetFirstInputCoordinatePair} \tx@UserCoor){\oenodeRefA{}}
      \else\ifx\POE@key@coupleralign\POE@str@bottom
%    \end{macrocode}
% For bottom alignment, use second last coordinate pair as RefA
%    \begin{macrocode}
         \pnode(! [ \coupler@coors \POE@dict{GetLastInputCoordinatePair} \tx@UserCoor){\oenodeRefA{}}
      \else
%    \end{macrocode}
% Use median of all input coordinate pairs as RefA
%    \begin{macrocode}
        \pnode(! [ \coupler@coors
%    \end{macrocode}
% remove output node from stack
%    \begin{macrocode}
counttomark -2 roll pop pop
%    \end{macrocode}
% count number of input coordinate pair, keep that number and save it behind the mark
%    \begin{macrocode}
counttomark 2 idiv dup counttomark 1 add 1 roll
1 sub { \POE@dict{VecAdd} } repeat
%    \end{macrocode}
% divide by number of input coordinate pairs and remove mark
%    \begin{macrocode}
4 -1 roll 1 exch div \POE@dict{VecScale} 3 -1 roll pop \tx@UserCoor){\oenodeRefA{}}
      \fi\fi
    \fi
    \POE@drawcomponent{wdmcoupler}{#1}
    \ifPOE@backlayer 
      \POE@Verb{%
        1 1 \the\POE@couplernodecount\space
        {
          inttostr \the\POE@couplernodecount\space 1 add inttostr (\oenode{}{}) CorrectDipoleIfc
        } for
      }%
      \ifPOE@fiberpresetout@
        \drawfiber@{FiberOut}[startnode=N]{}(\oenodeRefB{})
      \fi
      \ifPOE@fiberpresetin@
        \ifPOE@fiberpresetin@top
          \drawfiber@{FiberIn1}[stopnode=1](! [ \coupler@coors 1 \POE@dict{GetCoordinatePair} \tx@UserCoor){}
        \fi 
        \ifPOE@fiberpresetin@bottom
          \drawfiber@{FiberIn2}[stopnode=\the\POE@couplernodecount](! [ \coupler@coors \the\POE@couplernodecount\space \POE@dict{GetCoordinatePair} \tx@UserCoor){}
        \fi
%    \end{macrocode}
% If top and bottom fibers are drawn, we must also draw all other input fibers
%    \begin{macrocode}
        \ifPOE@fiberpresetin@top\ifPOE@fiberpresetin@bottom
          \@tempcnta=\POE@couplernodecount
          \advance\@tempcnta by -2
          \ifnum0<\@tempcnta
            \multido{\i=2+1}{\the\@tempcnta}{%
              \drawfiber@{FiberIn}[stopnode=\i](! [ \coupler@coors \i\space \POE@dict{GetCoordinatePair} \tx@UserCoor){}
            }%
          \fi
        \fi\fi
      \fi
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optcirculator}
%    \begin{macrocode}
\def\optcirculator{\pst@object{optcirculator}}%
\def\optcirculator@i(#1)(#2)(#3){%
  \@ifnextchar\bgroup%
    {\optcirculator@ii(#1)(#2)(#3)}%
    {\optcirculator@ii(#1)(#2)(#3){}}%
}%
\def\POE@calcCircRefNodes#1#2#3{%
\ifPOE@backlayer
  \POE@regNodes{#1}{#2}
  \ifx\POE@key@position\@empty
    \ifx\POE@key@abspos\@empty
      \POE@positionrefnodes
      \pst@getcoor{#1}\POE@tempa%
      \pst@getcoor{#2}\POE@tempc%
      \pst@getcoor{#3}\POE@tempb%
      \pnode(! \POE@dict{%
        \POE@tempa \tx@UserCoor 2 copy 2 copy 
        \POE@tempc \tx@UserCoor 4 2 roll @ABVect
        2 copy 2 copy 10 4 roll
        \POE@tempb \tx@UserCoor 6 -2 roll @ABVect
        4 2 roll tx@EcldDict begin Project end VecAdd
        2 copy 6 -2 roll -0.5 VecScale VecAdd
      }){\oenode@RefA{}}%
      \pnode(! \POE@dict{4 2 roll 0.5 VecScale VecAdd})%
      {\oenode@RefB{}}%
      \fi
    \fi
  \fi
}%
\def\optcirculator@ii(#1)(#2)(#3)#4{%
  \addafter@par{ref@angle=0}%
  \begin@OptexpObj
    \POE@calcCircRefNodes{#1}{#2}{#3}%
    \POE@drawcomponent{optcirculator}{#4}
    \ifPOE@backlayer
      \ifPOE@fiberpresetin@top
        \drawfiber@{FiberIn}[stopnode=1](#1){}
      \fi
      \ifPOE@fiberpresetout@
        \ifPOE@fiberpresetout@top
          \drawfiber@{FiberOut1}[startnode=N]{}(#2)
        \fi
        \ifPOE@fiberpresetout@bottom
          \drawfiber@{FiberOut2}[startnode=2, fiberalign=center]{}(#3)
        \fi
      \fi
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fiberbox}
%    \begin{macrocode}
\def\fiberbox{\pst@object{fiberbox}}%
\def\fiberbox@i(#1)(#2){%
  \@ifnextchar(%)
    {\fiberbox@ii(#1)(#2)}%
    {\fiberbox@ii(#1)(#2)()()}%
}%
\def\fiberbox@ii(#1)(#2)(#3)(#4){%
  \@ifnextchar\bgroup%
    {\fiberbox@iii(#1)(#2)(#3)(#4)}%
    {\fiberbox@iii(#1)(#2)(#3)(#4){}}%
}%
\def\fiberbox@iii(#1)(#2)(#3)(#4)#5{%
  \begin@OptexpObj
    \ifnum\POE@key@fiberboxcountin=1
      \ifnum\POE@key@fiberboxcountout=1
        \ifdim\POE@key@fiberboxheight pt=0pt
          \PackageError{pst-optexp}{%
            Cannot determine height of 1x1 fiberbox automatically, 
            use fiberboxheight}%
        \fi
      \fi
    \fi
    \ifPOE@backlayer
      \ifx\\#3#4\\%
        \POE@regNodes{#1}{#2}
        \POE@Verb{/@@inht 0 def /@@outht 0 def}%
      \else
        \pst@getcoor{#1}\POE@tempa%
        \pst@getcoor{#2}\POE@tempb%
        \pst@getcoor{#3}\POE@tempc%
        \pst@getcoor{#4}\POE@tempd%
        \pnode(!\POE@tempa \POE@tempb 
                \POE@dict{VecAdd 0.5 VecScale}
                \tx@UserCoor){\oenodeRefA{}}
        \pnode(!\POE@tempc \POE@tempd
                \POE@dict{VecAdd 0.5 VecScale}
                \tx@UserCoor){\oenodeRefB{}}
        \POE@regNodes@
        \POE@Verb{%
          gsave
            STV CP T 
            /N@\oenodeRefA{} @GetCenter
            /N@\oenodeRefB{} @GetCenter @ABVect NormalizeVec 
            90 matrix rotate dtransform 2 copy
            \POE@tempa \POE@tempb @ABVect
            \tx@UserCoor DotProd abs 3 1 roll
            \POE@tempc \POE@tempd @ABVect 
            \tx@UserCoor DotProd abs 
          grestore
          /@@outht ED /@@inht ED
        }%
      \fi
    \fi
    \POE@drawcomponent{fiberbox}{#5}
    \ifPOE@backlayer
      \ifx\\#3#4\\%
%    \end{macrocode}
% Connect only, if the fiberbox has a single related interface node.
%    \begin{macrocode}
        \ifnum\POE@key@fiberboxcountin=1
          \ifPOE@fiberpresetin@
            \drawfiber@{FiberIn}(#1){}
          \else\ifPOE@wirein@
            \drawwire@{WireIn}(#1){}
          \fi\fi
        \fi
        \ifnum\POE@key@fiberboxcountout=1
          \ifPOE@fiberpresetout@
            \drawfiber@{FiberOut}{}(#2)
          \else\ifPOE@wireout@
            \drawwire@{WireOut}{}(#2)
          \fi\fi
        \fi
      \else
%    \end{macrocode}
% If four reference nodes are specified, connect all of them with the respective interface
% nodes they are aligned to.
%    \begin{macrocode}
        \ifPOE@fiberpresetin@top
          \drawfiber@{FiberIn1}(#1){}
        \else\ifPOE@wirein@top
          \drawwire@{WireIn1}(#1){}
        \fi\fi
        \ifPOE@fiberpresetin@bottom
          \drawfiber@{FiberIn2}(#2){}
        \else\ifPOE@wirein@bottom
          \drawwire@{WireIn2}(#2){}
        \fi\fi
        \ifPOE@fiberpresetout@top
          \drawfiber@{FiberOut1}{}(#3)
        \else\ifPOE@wireout@top
          \drawwire@{WireOut1}{}(#3)
        \fi\fi
        \ifPOE@fiberpresetout@bottom
          \drawfiber@{FiberOut2}{}(#4)
        \else\ifPOE@wireout@bottom
          \drawwire@{WireOut2}{}(#4)
        \fi\fi
      \fi
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@calcNodes}
%   Some of the components need three points to be positioned. 
%   These are:
%
% \begin{enumerate}
% \item starting point of the beam (in the PS-Code: (XA,YA)) 
% \item reflection point on the surface (XG, YG) 
% \item end point (XB,YB)
%  \end{enumerate}     
%
%  With these three points \cs{poe@calcNodes} calculates two new points 'tempNode@A' 
%  and 'tempNode@B', between which the component is placed by the macro 
%  \cs{poe@drawcomponent} in the way, that 'angle of incidence' == 'angle of deflection'
%  regarding the reflection surface (mirror, diagonal of the beamsplitter, 
%  grid etc.)
%    \begin{macrocode}
\def\POE@calcNodes#1#2#3{{%
  \pst@getcoor{#1}\POE@tempa%
  \pst@getcoor{#2}\POE@tempb%
  \pst@getcoor{#3}\POE@tempc%
  \pnode(! \POE@dict{%
    \POE@tempa \tx@UserCoor
    \POE@tempc \tx@UserCoor
    \POE@tempb \tx@UserCoor
    calcNodes /exch@ref@\oenode{}{} ED
    X@A Y@A}){\oenode@RefA{}}%
  \pnode(! \POE@dict{X@B Y@B}){\oenode@RefB{}}%
  \pnode(#2){\oenode@Origin{}}%
}\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@calcAngle}
%   Calculate the angle between the vectors A->O and B->0, which is
%   needed by \cs{rightangleprism} and \cs{optprism}. Also calculate the
%   angle difference between 'Winkelhalbierende' and
%   'Seitenhalbierende', which is required for some corrections in
%   \cs{rightangleprism}.
%    \begin{macrocode}
\def\POE@calcAngle{%
  \POE@Verb{%
    gsave
      STV CP T
      /N@\oenode@Origin{} @GetCenter 2 copy
      /N@\oenodeRefA{} @GetCenter VecSub /ay ED /ax ED
      /N@\oenodeRefB{} @GetCenter VecSub /by ED /bx ED
%    \end{macrocode}
% Winkelhalbierende (cx, cy)
%    \begin{macrocode}
      ax ay NormalizeVec bx by NormalizeVec VecAdd 
      2 copy Pyth abs 1e-4 lt {
%    \end{macrocode}
% vectors a and b are antiparallel
%    \begin{macrocode}
        pop pop
        ax ay 90 matrix rotate dtransform
      } if
      NormalizeVec 2 copy
%    \end{macrocode}
% Seitenhalbierende
%    \begin{macrocode}
      ax ay bx by VecAdd 
      2 copy Pyth abs 1e-4 lt {
%    \end{macrocode}
% vectors a and b are parallel
%    \begin{macrocode}
        pop pop ax ay
      } if
      NormalizeVec 
      4 copy 4 copy
      DotProd Acos 5 1 roll Chirality mul 
      /dOEangle exch def
      ax ay Pyth bx by Pyth
      2 copy dup mul exch dup mul add
      ax bx sub ay by sub Pyth dup mul exch sub
      3 1 roll -2 mul mul div Acos /OEangle exch def
%    \end{macrocode}
% project vector (ax, by) on the normal to the bisector
%    \begin{macrocode}
      neg exch ax ay \tx@UserCoor DotProd abs /@myht exch def
    grestore
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@saveDiffractionNodes}
%    \begin{macrocode}
\def\POE@saveDiffractionNodes{%
  \POE@Verb{%
    gsave
      STV CP T 
      /N@\oenodeRefA{} @GetCenter
      /N@\oenode@Origin{} @GetCenter @ABVect exch atan /myangle ED
      /N@\oenode@Origin{} @GetCenter
      /N@\oenodeRefB{} @GetCenter @ABDist /mydist ED    
    grestore
  }%
  \pnode(! \POE@dict{mydist myangle 180 sub} PtoC \tx@UserCoor){\oenode{DO0}{}}%
  \multido{\i=1+1}{\POE@key@diffractionorders}{%
    \pnode(! \POE@dict{mydist myangle 180 sub 180 OEangle sub \i\space mul } add PtoC \tx@UserCoor){\oenode{DO\i}{}}%
    \pnode(! \POE@dict{mydist myangle 180 sub 180 OEangle sub \i\space mul } sub PtoC \tx@UserCoor){\oenode{DO-\i}{}}%
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@regNodes}
% If a macro needs only two points, they are equivalent to 
% 'tempNode@A' and 'tempNode@B'. But for easier implementation of other 
% macros the given points are assigned to the temporary nodes.
%    \begin{macrocode}
\def\POE@regNodes#1#2{%
  \pnode(#1){\oenodeRefA{}}
  \pnode(#2){\oenodeRefB{}}
  \POE@regNodes@
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@regNodes@}
% Some additional work which needs to be done in \cs{POE@regNodes}, but must be
% called separately in some cases (e.g. \cs{fiberbox}).
%    \begin{macrocode}
\def\POE@regNodes@{%
  \POE@Verb{%
    /@xref [\POE@key@extnode@xrefs] def
    /@yref [\POE@key@extnode@yrefs] def
    /@@ang 
    \ifx\POE@key@innercompalign\POE@str@absolute
      /N@\POE@refnodeA\space /N@\POE@refnodeB\space SlopeAngle
    \else
      0
    \fi def
  }%
  \ifx\POE@key@extnodealign\POE@str@absolute
    \POE@Verb{%
      /N@\POE@refnodeA\space @GetCenter /N@\POE@refnodeB\space @GetCenter
      @ABVect exch
      dup 0 gt 3 1 roll 0 eq exch 0 lt and or
      { /RefFac -1 def } if
    }%
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@pnode@shiftedrot}
% Define a new node \#3 shifted by (\#1) relative to existing node \#2.
% Aditionally rotate the new node by \#4 degree around existing node as origin.
%    \begin{macrocode}
\def\POE@pnode@shiftedrot(#1)#2#3#4{%
  \pst@getcoor{#1}\POE@temp%
  \pnode(! \POE@dict{
    /N@#2 @GetCenter \POE@temp 
    #4 \POE@key@labelrefangle\space add matrix rotate dtransform 
    VecAdd \tx@UserCoor }){#3}%
  \psset[optexp]{ref@angle=0}
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@nlput}
%   We cannot use \cs{nlput} from \opt{pst-node}, because that does not work
%   correctly for negative distances together with \opt{nrot=:U}, which happens
%   for \opt{position=start}.
%    \begin{macrocode}
\def\POE@nlput{\pst@object{POE@nlput}}
\def\POE@nlput@i(#1)(#2)#3#4{%
  \begin@SpecialObj
  \POE@LDNode(#1)(#2){#3}
  \pcline[linestyle=none,fillstyle=none, arrows=-, ArrowInside=-](temp@nlputA)(temp@nlputB)%
  \ncput[npos=0.5]{#4}%
  \end@SpecialObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@LDNode}
%    \begin{macrocode}
\def\POE@LDNode(#1)(#2)#3{%
  \pst@getcoor{#1}\pst@tempA%
  \pst@getcoor{#2}\pst@tempB%
  \pnode(!
    \pst@tempA \tx@UserCoor /YA ED /XA ED
    \pst@tempB \tx@UserCoor /YB ED /XB ED
    /dx XB XA sub def
    /dy YB YA sub def
    /angle dy dx Atan def
    XA #3 1 sub angle cos mul add 
    YA #3 1 sub angle sin mul add ){temp@nlputA}%
  \pnode(!
    \pst@tempA \tx@UserCoor /YA ED /XA ED
    \pst@tempB \tx@UserCoor /YB ED /XB ED
    /dx XB XA sub def
    /dy YB YA sub def
    /angle dy dx Atan def
    XA #3 1 add angle cos mul add 
    YA #3 1 add angle sin mul add ){temp@nlputB}%
}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@putlabelrelative}
% Used to put the label for labelref=relative
%    \begin{macrocode}
\def\POE@putlabelrelative#1{%
  \nput[labelsep=0]{\POE@key@labelangle}%
       {\oenodeLabel{}}%
       {\rput[\POE@key@labelalign](0,0){\POE@key@labelstyle #1}}%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@putcomp}
%   Place the component in argument \#1 and define a new node
%   \oenodeLabel{} for positioning of the label.
%    \begin{macrocode}
\def\POE@putcomp#1{%
   \rput(! \POE@key@comp@Xshift\space\POE@key@comp@Yshift){%
     \pnode(! \POE@dict{
       \POE@key@rotate@xref\space
       \POE@key@rotate@yref\space
       DefineExtNode}){\oenodeRotref{}}%
     \psrotate(\oenodeRotref{}){!\POE@key@angle}{%
       #1%
       \POE@pnode@shiftedrot(0,\POE@key@labeloffset)%
                            {\oenodeCenter{}}%
                            {\oenodeLabel{}}%
                            {\POE@key@labelangle}%
     }%
   }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@putlabel}
% Positioning of the label depending on the reference coordinates.
% Needs possibly a previously defined node \cs{oenodeLabel} which
% marks exactly the position of the label relative to the component.
% This is defined by calling \cs{poe@putcomp}.
%    \begin{macrocode}  
\def\POE@putlabel#1{%
  \def\POE@temp{#1}%
%    \end{macrocode}
% Put the label only if it's not empty.
%    \begin{macrocode}
  \ifx\POE@temp\@empty
%    \end{macrocode}
% Place the correct 'global' label node when the label is empty.
%    \begin{macrocode}
    \ifx\POE@key@labelref\POE@str@global
      \nput[labelsep=\POE@key@labeloffset]%
        {\POE@key@labelangle}%
        {\oenodeCenter{}}%
        {\pnode(0,0){\oenodeLabel{}}}%
    \fi
  \else
%    \end{macrocode}
% For \opt{global} positioning, the label is placed in global coordinate system
% with respect to the center node.
%    \begin{macrocode}
  \ifx\POE@key@labelref\POE@str@global
    \nput[labelsep=\POE@key@labeloffset]%
      {\POE@key@labelangle}%
      {\oenodeCenter{}}%
      {\pnode(0,0){\oenodeLabel{}}%
       \rput[\POE@key@labelalign](0,0){\POE@key@labelstyle\oelabel{#1}}}%
%    \end{macrocode}
% Rotate the label node together with the component, but do not rotate the label
% text itself.
%    \begin{macrocode}
  \else\ifx\POE@key@labelref\POE@str@relgrav
    \rput[\POE@key@labelalign](\oenodeLabel{}){%
      \POE@key@labelstyle\oelabel{#1}}%
%    \end{macrocode}
% Rotate label node and label text with the component.
%    \begin{macrocode}
  \else\ifx\POE@key@labelref\POE@str@relative
    \begingroup
%    \end{macrocode}
% Redefine InitNC only for positioning of the label with labelref=relative
%    \begin{macrocode}
    \pst@def{InitNC}< % kindly contributed by Herbert Voss
      /b ED /a ED
      /NodeSepTypeB ED /NodeSepTypeA ED
      /NodeSepB ED /NodeSepA ED
      /OffsetB ED /OffsetA ED
      tx@NodeDict a known tx@NodeDict b known and dup {
        /NodeA a load def /NodeB b load def
        NodeA GetCenter NodeB GetCenter
        4 copy exch 4 -1 roll 2 copy gt
          { pop pop pop pop /yB ED /xB ED /yA ED /xA ED }
          { eq 3 1 roll lt and 
              { /yB ED /xB ED /yA ED /xA ED} 
              { /yA ED /xA ED /yB ED /xB ED} ifelse
          } ifelse
      } if >%
      \ncline[linestyle=none,fillstyle=none, npos=, arrows=-, ArrowInside=-]%
             {\POE@trefnodeA}{\POE@trefnodeB}%
      \ifx\POE@key@position\@empty
        \ifx\POE@key@abspos\@empty
          \ncput[nrot=:U,npos=]{\POE@putlabelrelative{\oelabel{#1}}}%
        \else
          \POE@nlput[nrot=:U](\POE@trefnodeA)(\POE@trefnodeB)%
            {\POE@key@abspos}{\POE@putlabelrelative{\oelabel{#1}}}%
        \fi
      \else
        \ncput[nrot=:U, npos=\POE@key@position]%
          {\POE@putlabelrelative{\oelabel{#1}}}%
      \fi
    \endgroup
  \fi\fi\fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Free-ray components}
%
% Define all free-ray dipoles
%    \begin{macrocode}
\newOptexpDipole{lens}
\newOptexpDipole{asphericlens}
\newOptexpDipole{pinhole}
\newOptexpDipole{crystal}
\newOptexpDipole{polarization}
\newOptexpDipole{optbox}
\newOptexpDipole{optsource}{position=start}
\newOptexpDipole{optplate}
\newOptexpDipole{optretplate}
\newOptexpDipole{optdetector}{position=end}
\newOptexpDipole{optdiode}{allowbeaminside=false}
\newOptexpDipole{doveprism}
\newOptexpDipole{glanthompson}
\newOptexpDipole{parabolicmirror}{position=end, ref@angle=-90}
\newOptexpDipole{axicon}
\newOptexpDipole{optwedge}
%    \end{macrocode}
% 
% Define all free-ray tripoles
%    \begin{macrocode}
\newOptexpTripole{mirror}
\newOptexpTripole[ref@angle=45]{beamsplitter}
\newOptexpTripole{optgrating}
\newOptexpTripole[ref@angle=90]{transmissiongrating}
\newOptexpTripole[ref@angle=45]{pentaprism}
\newOptexpTripole[ref@angle=45]{rightangleprism}
\newOptexpTripole[ref@angle=45]{optprism}
\newOptexpTripole{oapmirror}
%    \end{macrocode}
%
% \begin{macro}{\optdipole}
%    \begin{macrocode}
\def\optdipole{\pst@object{optdipole}}
\def\optdipole@i(#1)(#2){%
  \@ifnextchar\bgroup%
    {\optdipole@iii(#1)(#2)}%
    {\optdipole@ii(#1)(#2)}%
}%
\def\optdipole@ii(#1)(#2){%
  \optdipole@v(#1)(#2){}{}%
}%
\def\optdipole@iii(#1)(#2)#3{%
  \@ifnextchar\bgroup%
    {\optdipole@iv(#1)(#2){#3}}%
    {\optdipole@v(#1)(#2){#3}}%
}%
\def\optdipole@iv(#1)(#2)#3#4{%
   \addbefore@par{innercompalign=relative}%
   \begin@OptexpObj
      \ifPOE@backlayer
        \POE@regNodes{#1}{#2}%
      \fi
      \def\optdipole@comp{\psrotate(0,0){!\POE@dict{@@ang}}{#3}}%
      \POE@drawcomponent{optdipole}{#4}%
      \ifPOE@backlayer
        \POE@InternalConn
      \fi
   \end@OptexpObj
}%
%    \end{macrocode}
% Only one argument given, decide if this is supposed to be the label,
% or the component.
%    \begin{macrocode}
\def\optdipole@v(#1)(#2)#3{%
   \addbefore@par{innercompalign=relative}%
   \begin@OptexpObj
      \ifPOE@backlayer
        \POE@regNodes{#1}{#2}
      \fi
      \ifx\POE@key@optdipolecomp\@empty
        \def\optdipole@comp{\psrotate(0,0){!\POE@dict{@@ang}}{#3}}%
        \POE@drawcomponent{optdipole}{}
      \else
        \def\optdipole@comp{\psrotate(0,0){!\POE@dict{@@ang}}{\POE@key@optdipolecomp}}%
        \POE@drawcomponent{optdipole}{#3}
      \fi
      \ifPOE@backlayer
        \POE@InternalConn
      \fi
   \end@OptexpObj
}%
\def\optdipole@nodes{\POE@dipole@nodes}
%    \end{macrocode}
% \end{macro}
%  
% \begin{macro}{\optdipole@ref}
%    \begin{macrocode}
\def\optdipole@ref{%
  \POE@setref{%
    /@@x \POE@key@optdipolewidth\space 0.5 mul def
    /@@y \POE@key@optdipoleheight\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\opttripole}
%    \begin{macrocode}
\def\opttripole{\pst@object{opttripole}}
\def\opttripole@i(#1)(#2)(#3){%
  \@ifnextchar\bgroup
    {\opttripole@iii(#1)(#2)(#3)}%
    {\opttripole@ii(#1)(#2)(#3)}%
}%
\def\opttripole@ii(#1)(#2)(#3){%
  \opttripole@v(#1)(#2)(#3){}{}%
}%
\def\opttripole@iii(#1)(#2)(#3)#4{%
  \@ifnextchar\bgroup
    {\opttripole@iv(#1)(#2)(#3){#4}}%
    {\opttripole@v(#1)(#2)(#3){#4}}%
}%
\def\opttripole@iv(#1)(#2)(#3)#4#5{%
  \addafter@par{ref@angle=0}
  \begin@OptexpTripole
    \ifPOE@backlayer   
      \POE@calcNodes{#1}{#2}{#3}%
      \POE@regNodes{#1}{#3}%
    \fi
    \def\opttripole@comp{#4}%
    \POE@drawcomponent{opttripole}{#5}
    \ifPOE@backlayer
      \POE@InternalConn
    \fi
  \end@OptexpTripole
}%
%    \end{macrocode}
% Only one argument given, decide if this is supposed to be the label, or the component
%    \begin{macrocode}
\def\opttripole@v(#1)(#2)(#3)#4{%
  \addafter@par{ref@angle=0}
  \begin@OptexpTripole
    \ifPOE@backlayer   
      \POE@calcNodes{#1}{#2}{#3}%
      \POE@regNodes{#1}{#3}%
    \fi
    \ifx\POE@key@opttripolecomp\@empty
      \def\opttripole@comp{#3}%
      \POE@drawcomponent{opttripole}{}%
    \else
      \def\opttripole@comp{\POE@key@opttripolecomp}%
      \POE@drawcomponent{opttripole}{#4}%
    \fi
    \ifPOE@backlayer
      \POE@InternalConn
    \fi
  \end@OptexpTripole
}%
\def\opttripole@nodes{\POE@tripole@nodes}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\fibercollimator}
%    \begin{macrocode}
\def\fibercollimator{\pst@object{fibercollimator}}
\def\fibercollimator@i(#1)(#2){%
   \def\POE@tempa{#1}%
   \def\POE@tempb{#2}%
   \def\POE@tempc{}%
   \def\POE@tempd{}%
   \@ifnextchar(%)
     {\fibercollimator@ii}{\fibercollimator@iv}%
}%
\def\fibercollimator@ii(#1){%
   \def\POE@tempc{#1}%
   \@ifnextchar(%)
     {\fibercollimator@iii}{\fibercollimator@iv}%
}%
\def\fibercollimator@iii(#1){%
   \def\POE@tempd{#1}%
   \fibercollimator@iv
}%
\def\fibercollimator@iv{%
  \@ifnextchar\bgroup{\fibercollimator@v}{\fibercollimator@v{}}%
}%
\def\fibercollimator@v#1{%
  \addbefore@par{allowbeaminside=false}%
  \begin@OptexpObj
    \ifPOE@backlayer
      \POE@regNodes{\POE@tempa}{\POE@tempb}%
    \fi
    \POE@drawcomponent{fibercollimator}{#1}
    \ifPOE@backlayer
      \ifPOE@beam
        \drawbeam(\oenodeRefA{}){}
      \fi
      \ifPOE@fiberpresetout@
        \ifx\@empty\POE@tempc
          \drawfiber{}(\oenodeRefB{})
        \else\ifx\@empty\POE@tempd
          \psbezier[style=FiberOut](\oenodeOut{})(\POE@tempb)%
                                   (\POE@tempb)(\POE@tempc)%
        \else
          \psbezier[style=FiberOut](\oenodeOut{})(\POE@tempb)%
                                   (\POE@tempc)(\POE@tempd)%
        \fi\fi
      \fi
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
% 
% Define all fiber dipoles
%    \begin{macrocode}
\newOptexpFiberDipole{optfiber}{newOptComp={}}
\newOptexpFiberDipole{optamp}
\newOptexpFiberDipole{optmzm}
\newOptexpFiberDipole{optfilter}{allowbeaminside=false}
\newOptexpFiberDipole{polcontrol}
\newOptexpFiberDipole{optisolator}
\newOptexpFiberDipole{optfiberpolarizer}
\newOptexpFiberDipole{optswitch}
\newOptexpFiberDipole{fiberdelayline}
%    \end{macrocode}
%
% \begin{macro}{\POE@drawcomponent}
% This macro is called by every unit
% The first parameter contains the label, the second one the drawing code
%    \begin{macrocode}
\def\POE@drawcomponent#1#2{%
  \def\POE@comp{%
    \ifPOE@backlayer
      \pnode(!\POE@dict{@@x0 @@y0}){\oenodeCenter{}}
      \@nameuse{#1@nodes}
    \fi
    \ifPOE@frontlayer
      \@nameuse{#1@comp}
    \fi
    \ifx\POE@key@extnode\@empty\else
      \ifPOE@backlayer
        \multido{\i=1+1}{\POE@key@extnode@cnt}{%
          \pnode(! \POE@dict{
            @xref \i\space 1 sub get 
            @yref \i\space 1 sub get
            DefineExtNode}){\oenode{Ext\i}{}}%
          \pnode(\oenode{Ext1}{}){\oenodeExt{}}%
        }%
        \POE@Verb{%
          tx@NodeDict begin /N@\oenodeExt{} load
          \ifnum9<1\POE@key@compname
            /N@ExtNode 
          \else
            /N@\POE@key@compname ExtNode 
          \fi
          ED end 
        }%
      \fi
    \fi
  }%
  \@ifundefined{#1@ref}{}{\@nameuse{#1@ref}}%
  \begingroup
  \ifPOE@endbox
    \psset[optexp]{abspos={%
      \POE@dict{%
        /N@\POE@refnodeA\space @GetCenter \tx@UserCoor 
        /N@\POE@refnodeB\space @GetCenter \tx@UserCoor 
        @ABDist @@x0 @@x add add 
      }%
    }}%
  \else\ifPOE@startbox
    \psset[optexp]{abspos={\POE@dict{ @@x0 neg @@x sub }}}%
  \fi\fi
  \POE@disablepos
  \ncline[linestyle=none,fillstyle=none,npos=,arrows=-,ArrowInside=-]%
    {\POE@refnodeA}{\POE@refnodeB}%
%    \end{macrocode}
% Positioning of the component
%    \begin{macrocode}
    \psset{style=OptComp}%
%    \end{macrocode}
% linestyle to use, if component should be marked as optional
%    \begin{macrocode}
    \ifPOE@component@optional
      \psset{style=OptionalStyle}%
    \fi
%    \end{macrocode}
% If parameter \opt{position} is given, use it for \opt{npos}.
%    \begin{macrocode}
    \ifx\POE@key@abspos\@empty
%    \end{macrocode}
% Then check if absolute positioning with \opt{abspos} is wanted.
%    \begin{macrocode}
      \ifx\POE@key@position\@empty
        \ncput[nrot=:U,npos=]{\POE@putcomp{\POE@comp}}%
      \else
        \ncput[nrot=:U,npos=\POE@key@position]{\POE@putcomp{\POE@comp}}%
      \fi
    \else
      \POE@nlput[nrot=:U](\POE@refnodeA)(\POE@refnodeB)%
        {\POE@key@abspos}{\POE@putcomp{\POE@comp}}%
    \fi
  \endgroup
  \ifPOE@backlayer
    \POE@transformnodes
  \fi
  \ifPOE@frontlayer
    \POE@putlabel{#2}%
  \fi
%    \end{macrocode}
% Show some special dots for debugging
%    \begin{macrocode}
  \ifPOE@debug@showoptdots
    \ifPOE@frontlayer
      \psdot[linecolor=red](\oenodeCenter{})
      \psdot[linecolor=red, dotstyle=x, dotscale=1.5](\oenodeLabel{})
      \psdot[linecolor=black](\oenodeRefA{})
      \psdot[linecolor=black](\oenodeRefB{})
      \psdot[linecolor=black, dotstyle=x, 
             dotscale=1.5](\oenodeTrefA{})
      \psdot[linecolor=black, dotstyle=x, 
             dotscale=1.5](\oenodeTrefB{})
    \fi
  \fi
  \ifPOE@debug@showinterfaces
    \ifPOE@frontlayer
      \POE@drawinterfaces[style=IfcStyle]
    \fi
  \fi
  \ifPOE@debug@showifcnodes
    \ifPOE@frontlayer
      \POE@ifcnodes[style=IfcNodeStyle]
    \fi
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{POE@setref}
%    \begin{macrocode}
\let\POE@setref\POE@Verb
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{POE@transformnode}
%   Transform node \opt{\#1} according to the positioning parameters
%   (\opt{compshift}, \opt{position}, and \opt{abspos}) with respect to the
%   rotation reference node and define it as \opt{\#2}.
%    \begin{macrocode}
\def\POE@transformnode#1#2{%
  \pnode(!
    \POE@dict{%
      /N@\oenodeRotref{} @GetCenter 2 copy
      /N@#1 @GetCenter 
      \POE@key@comp@Xshift\space\POE@key@comp@Yshift\space
      \tx@ScreenCoor VecAdd 4 2 roll @ABVect 
      \POE@key@angle\space matrix rotate dtransform VecAdd
      \tx@UserCoor
    }){#2}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@ifcnodes}
%    \begin{macrocode}
\def\POE@ifcnodes{\pst@object{POE@ifcnodes}}
\def\POE@ifcnodes@i{%
  \begin@SpecialObj%
  \solid@star%
  \addto@pscode{
    \psk@dotsize
    \@nameuse{psds@\psk@dotstyle}
    \POE@dict{[ (\oenode{}{}) false GetInternalBeamNodes %]
      counttomark 2 idiv { Dot } repeat
      pop}
    }%
  \end@SpecialObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@drawinterfaces}
%    \begin{macrocode}
\def\POE@drawinterfaces{\pst@object{POE@drawinterfaces}}
\def\POE@drawinterfaces@i{%
  \begin@OpenObj%
  \addto@pscode{%
    \psk@dotsize
    \@nameuse{psds@\psk@dotstyle}
    \pst@optexpdict
    /\oenode{}{} load begin
      1 1 N {
        IfcName load begin
          X Y
          CompMtrx transform CM itransform 2 copy
          currentdict /RX known { 0 0 }{ DX DY } ifelse
          CompMtrx dtransform CM idtransform 2 copy
          NAlow 0 eq NAup 0 eq and { 
            -0.5 VecScale 4 2 roll 0.5 VecScale
          } {
            \tx@UserCoor NAlow VecScale 4 2 roll \tx@UserCoor NAup VecScale
          } ifelse
        end
        8 -2 roll VecAdd moveto VecAdd lineto
      } for
    end end }%
  \pst@stroke
  \use@pscode
  \end@OpenObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{POE@extnodes}
%    \begin{macrocode}
\def\POE@extnodes{\pst@object{POE@extnodes}}
\def\POE@extnodes@i#1{%
  \begin@SpecialObj
    \let\POE@setref\addto@pscode
    \addto@pscode{\pst@optexpdict InitOptexpComp }
    \@ifundefined{#1@ref}{}{\@nameuse{#1@ref}}%
    \solid@star%
    \addto@pscode{
      \psk@dotsize
      \@nameuse{psds@\psk@dotstyle}
      @@x 0 eq { [0] }{ [ @@x neg 0 @@x ] } ifelse
      {
        @@y 0 eq { [0] }{ [@@y neg 0 @@y ] } ifelse
        {
          exch dup 3 1 roll
          @@x0 add exch @@y0 add \tx@ScreenCoor
          /\oenode{}{} load begin CompMtrx end transform CM itransform
          Dot
        } forall
        pop
      } forall
      end
    }%
  \end@SpecialObj
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@tripole@nodes}
%    \begin{macrocode}
\def\POE@tripole@nodes{%
  \newOptexpComp{{0 0} {1 0} @@x neg @@x refl {PlainIfc} 1}%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@dipole@nodes}
%    \begin{macrocode}
\def\POE@dipole@nodes{%
  \newOptexpComp{%
    {@@x0 @@x sub 0} {0 1} @@y0 @@y sub @@y0 @@y add trans {PlainIfc} 
    @@x 0 eq not {
      {@@x0 @@x add 0} {0 1} @@y0 @@y sub @@y0 @@y add trans {PlainIfc}
    } if \POE@key@n }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{POE@fiberdipole@nodes}
%    \begin{macrocode}
\def\POE@fiberdipole@nodes{%
  \newOptexpFiberComp{%
    {@@x0 @@x sub 0}
    @@x 0 eq not {
      {@@x0 @@x add 0}
    } if }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\let\POE@elecdipole@nodes\POE@fiberdipole@nodes
%    \end{macrocode}
%
% \begin{macro}{POE@comp@rectangle}
%    \begin{macrocode}
\def\POE@comp@rectangle{%
  \psframe[dimen=outer](!\POE@dict{@@x neg @@y0 @@y sub})%
                       (!\POE@dict{@@x @@y0 @@y add})%
}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Free-ray components}
%
% \subsubsection{mirror}
%
% \begin{macro}{\mirror@ref}
%    \begin{macrocode}
\def\mirror@ref{%
  \ifdim\POE@key@mirrorradius pt=0pt
    \ifx\POE@key@mirrortype\POE@str@piezo
      \POE@setref{/@@y0 \pst@number\psyunit def}%
      \bgroup
        \psset{style=PiezoMirror}%
        \POE@setref{%
          \pst@number\psyunit @@y0 div 
          \POE@key@mirrorwidth\space 0.5 mul mul 2.5 div /@@y0 ED
        }%
      \egroup
    \else
      \POE@setref{/@@x \POE@key@mirrorwidth\space 0.5 mul def}%
      \ifx\POE@key@mirrortype\POE@str@plain\else
        \POE@setref{\POE@key@mirrordepth\space 0.5 mul dup /@@y0 ED /@@y ED}%
      \fi
    \fi
  \else
    \POE@setref{/@@x \POE@key@mirrorwidth\space 0.5 mul def}%
    \ifx\POE@key@mirrortype\POE@str@plain\else
      \POE@setref{\POE@key@mirrordepth\space 0.5 mul dup /@@y0 ED /@@y ED}%
    \fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\mirror@nodes}
%    \begin{macrocode}
\def\mirror@nodes{%
  \begin@CompIfc
%    \end{macrocode}
% Add this one reflective interface in any case
%    \begin{macrocode}
  \ifdim\POE@key@mirrorradius pt=0pt
    \addto@pscode{%
      {0 0} {1 0} 
      \POE@key@mirrorwidth\space -0.5 mul dup neg 
      refl {PlainIfc} }%
  \else
    \addto@pscode{%
      {0 0} {0 \POE@key@mirrorradius\space neg} 
      \POE@key@mirrorwidth\space -0.5 mul dup neg 
      refl {CurvedIfc} }%
  \fi
%    \end{macrocode}
% A second interface exists only for semitrans mirrors
%    \begin{macrocode}
  \ifx\POE@key@mirrortype\POE@str@semitrans
%    \end{macrocode}
% if no second mirror radius was specified, use the same curvature of the first interface.
%    \begin{macrocode}
    \ifx\POE@key@mirrorradiusB\@empty 
      \ifdim\POE@key@mirrorradius pt=0pt
        \addto@pscode{%
          {0 \POE@key@mirrordepth} {1 0} 
          @@x neg @@x trans {PlainIfc} }%
      \else
        \addto@pscode{%
          {0 \POE@key@mirrordepth}
          {0 \POE@key@mirrorradius\space neg}
          \POE@key@mirrorwidth\space -0.5 mul dup neg
          trans {CurvedIfc} }%
      \fi
    \else
%    \end{macrocode}
% the second interface is plain if it should not have the curvature of the first interface.
%    \begin{macrocode}
      \addto@pscode{%
        {0 \POE@key@mirrordepth
        dup \POE@key@mirrorradius\space mul 0 lt {
          dup sign \POE@key@mirrorradius\space @@x capHeight mul add
        } if} 
       {1 0} @@x neg @@x trans {PlainIfc} }%
     \fi
%    \end{macrocode}
% Rearrange the two interfaces depending on the sign of mirrordepth
%    \begin{macrocode}
    \addto@pscode{%
      \ifdim\POE@key@mirrordepth pt<-0.0001pt
        12 6 roll 2
      \else
        \ifdim\POE@key@mirrordepth pt< 0.0001pt
          6 {pop} repeat
        \fi
        1
      \fi
      \POE@key@n
    }%
    \end@AmbCompIfc
  \else
    \addto@pscode{1 }%
    \end@CompIfc
  \fi
  \pnode(0,0){\oenodeCenter{}}
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\mirror@comp}
%    \begin{macrocode}
\def\mirror@comp{%
  \edef\@ht{%
    \POE@key@mirrorwidth\space\pst@number\psyunit mul 0.5 mul %
  }%
  \edef\@dp{\POE@key@mirrordepth\space\pst@number\psxunit mul }%
  \edef\@r{\POE@key@mirrorradius\space\pst@number\psxunit mul }%
  \edef\@postcode{%
    neg 5 -1 roll exch 5 2 roll 90 add exch 90 add exch ArcR %
  }%
  \edef\@extpostcode{%
    neg \@dp add 5 -1 roll exch 5 2 roll 90 add exch 90 add %
  }%
  \ifdim\POE@key@mirrorradius pt=0pt
%    \end{macrocode}
% plain mirror 
%    \begin{macrocode}
    \edef\@ht{\POE@key@mirrorwidth\space 0.5 mul }%
    \ifx\POE@key@mirrortype\POE@str@piezo
      \psframe[style=PiezoMirror,
               dimen=outer](! \@ht 4 div 0)%
                           (! \@ht -4 div \@ht 2.5 div)
      \ifx\POE@key@extnode\@empty
        \psbezier[fillstyle=none](! 0 \@ht 2.5 div)%
                                 (! 0 \@ht 1.5 div)%
                                 (! \@ht 2 div \@ht 2 div)%
                                 (! \@ht 4 div \@ht)
      \fi
    \else\ifx\POE@key@mirrortype\POE@str@extended
      \psframe[style=ExtendedMirror]%
        (! \@ht neg \POE@key@mirrordepth\space )%
        (! \@ht 0)
    \else\ifx\POE@key@mirrortype\POE@str@semitrans
      \psframe[style=SemitransMirror]%
        (! \@ht neg \POE@key@mirrordepth\space )%
        (! \@ht 0)
    \fi\fi\fi
    \ifx\POE@key@mirrortype\POE@str@semitrans
      \psline[linewidth=\POE@key@mirrorlinewidth]%
        (! \@ht neg 0)(! \@ht 0)
    \else
      \psline[linewidth=\POE@key@mirrorlinewidth]%
        (! \@ht neg \POE@clwh)(! \@ht \POE@clwh)
    \fi
  \else
%    \end{macrocode}
% concave/convex mirror
%    \begin{macrocode}
    \ifdim\POE@key@mirrorradius pt<0pt
      \def\POE@temparc{arc }
    \else
      \def\POE@temparc{arcn }
    \fi
    \ifodd
      \ifx\POE@key@mirrortype\POE@str@extended 1
      \else\ifx\POE@key@mirrortype\POE@str@semitrans 1
      \else 0
      \fi\fi
%    \end{macrocode}
% extended or semitrans mirrortype
%    \begin{macrocode}
      \bgroup
      \ifx\POE@key@mirrortype\POE@str@extended
        \psset{style=ExtendedMirror}
      \else\ifx\POE@key@mirrortype\POE@str@semitrans
        \psset{style=SemitransMirror}
      \fi\fi
        \begin@ClosedObj
          \addto@pscode{%
            \pst@optexpdict \@ht \@r rightCurvedIfc \@postcode
            \ifx\POE@key@mirrorradiusB\@empty
              \@ht \@r rightCurvedIfc \@extpostcode \POE@temparc
            \else
              0 \@dp
%    \end{macrocode}
% For positive mirrorradius and positive mirror depth, add the cap
% height so that mirrordepth is the minimum mirror depth. For both
% negative radius and depth, subtract the cap height.
%    \begin{macrocode}
              \POE@key@mirrordepth\space\POE@key@mirrorradius\space
              mul 0 gt {
                dup sign \@r \@ht capHeight mul add
              } if
              rlineto 2 \@ht mul 0 rlineto
            \fi
            closepath end}%
        \end@ClosedObj
      \egroup
    \fi
%    \end{macrocode}
% draw the reflective interface
%    \begin{macrocode}
    \bgroup
      \psset{linewidth=\POE@key@mirrorlinewidth, fillstyle=none}
      \begin@OpenObj
        \addto@pscode{\POE@dict{ \@ht \@r rightCurvedIfc \@postcode }}%
      \end@OpenObj
    \egroup
  \fi
  \ifPOE@variable
    \psarc[style=VariableStyle]%
      (! \POE@key@mirrorwidth\space 0.5 mul 0.4 sub 
         \ifdim\POE@key@mirrorradius pt=0pt
           0
         \else
           \POE@key@mirrorradius\space dup \POE@dict{sign} neg exch
           \POE@key@mirrorwidth\space  0.5 mul \POE@dict{capHeight} mul
         \fi){0.6}{-20}{20}
    \psarc[style=VariableStyle]%
      (! 0.4 \POE@key@mirrorwidth\space 0.5 mul sub
         \ifdim\POE@key@mirrorradius pt=0pt
           0
         \else
           \POE@key@mirrorradius\space dup \POE@dict{sign} neg exch
           \POE@key@mirrorwidth\space  0.5 mul \POE@dict{capHeight} mul
         \fi){0.6}{160}{200}
   \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{parabolicmirror}
%
% \begin{macro}{\parabolicmirror@nodes}
%    \begin{macrocode}
\def\parabolicmirror@nodes{%
  \pssavepath[linestyle=none, arrows=-,ArrowInside=-]{\oenode@Path{A}}{%
    \parametricplot[algebraic, VarStep, VarStepEpsilon=1e-7, plotstyle=cspline]%
      {0}{\POE@key@parmirrorheight\space 0.5 mul}%
      {-\POE@key@parmirrorwidth/(0.25*\POE@key@parmirrorheight^2)*t^2|-t}}
  \pssavepath[linestyle=none, arrows=-,ArrowInside=-]{\oenode@Path{B}}{%
    \parametricplot[algebraic, VarStep, VarStepEpsilon=1e-7, plotstyle=cspline]%
      {0}{\POE@key@parmirrorheight\space 0.5 mul}%
      {-\POE@key@parmirrorwidth/(0.25*\POE@key@parmirrorheight^2)*t^2|t}}
  \newOptexpComp{%
    {-\POE@key@parmirrorwidth\space 0.16 mul \POE@key@parmirrorheight\space -0.2 mul} 
      tx@IntersectDict /\PIT@name{\oenode@Path{A}} get 0 0 refl {PathIfc}
    {0 0} {1 0} 0 0 trans {PlainIfc}
    {-\POE@key@parmirrorwidth\space 0.16 mul \POE@key@parmirrorheight\space 0.2 mul}
      tx@IntersectDict /\PIT@name{\oenode@Path{B}} get 0 0 refl {PathIfc}
    1 }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\parabolicmirror@comp}
%    \begin{macrocode}
\def\parabolicmirror@comp{%
  \pstracecurve{\oenode@Path{A}}
  \pstracecurve{\oenode@Path{B}}
\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{lens}
%
% \begin{macro}{\lens@ref}
%    \begin{macrocode}
\def\lens@ref{%
  \ifdim\POE@key@lensradiusleft pt=0pt
    \edef\@th{0 }%
  \else
    \edef\@th{%
      \ifPOE@thicklens 
        \POE@key@lenswidth\space 0.5 mul
      \else
        \ifdim\POE@key@lensradiusleft pt<0pt
          \POE@key@lensheight\space 0.075 mul
        \else
          \POE@key@lensradiusleft
          \POE@key@lensheight\space 0.5 mul capHeight
        \fi
      \fi
    \space}%     
  \fi
  \ifdim\POE@key@lensradiusright pt=0pt\else
    \edef\@th{%
      \@th\space
      \ifPOE@thicklens 
        \POE@key@lenswidth\space 0.5 mul
      \else
        \ifdim\POE@key@lensradiusright pt<0pt
          \POE@key@lensheight\space 0.075 mul
        \else
          \POE@key@lensradiusright
          \POE@key@lensheight\space 0.5 mul capHeight
        \fi
      \fi
      \space add
    \space}%
  \fi
  \POE@setref{%
    /@@y \POE@key@lensheight\space 0.5 mul def
    /@@x \@th 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\lens@nodes}
%    \begin{macrocode}
\def\lens@nodes{%
  \newOptexpComp{%
    {@@x neg 0} 
    \ifdim\POE@key@lensradiusleft pt=0pt 
      {0 1} 
      \POE@key@lensheight\space -0.5 mul dup neg
      trans {PlainIfc}
    \else 
      {\POE@key@lensradiusleft\space 0} 
      \POE@key@lensheight\space -0.5 mul dup neg
      trans {CurvedIfc}
    \fi
    {@@x 0} 
    \ifdim\POE@key@lensradiusright pt=0pt
      {0 1} 
      \POE@key@lensheight\space -0.5 mul dup neg
      trans {PlainIfc}
    \else
      {\POE@key@lensradiusright\space neg 0} 
      \POE@key@lensheight\space -0.5 mul dup neg
      trans {CurvedIfc} 
    \fi
    \POE@key@n
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\lens@comp}
%    \begin{macrocode}
\def\lens@comp{%
  \addbefore@par{linejoin=1}%
  \begin@ClosedObj
  \addto@pscode{\pst@optexpdict }%
  \def\@th{0}%
  \def\@wd{\POE@key@lenswidth\space\pst@number\psxunit mul 2 div }%
  \def\@ht{\POE@key@lensheight\space\pst@number\psyunit mul 2 div }%
  \def\@rL{\POE@key@lensradiusleft\space\pst@number\psrunit mul }%
  \def\@rR{\POE@key@lensradiusright\space\pst@number\psrunit mul }%
  \ifdim\POE@key@lensradiusleft pt=0pt\else
    \addto@pscode{ \@ht \@rL leftCurvedIfc }%
  \fi
  \ifdim\POE@key@lensradiusright pt=0pt\else
    \addto@pscode{ \@ht \@rR rightCurvedIfc }%
  \fi
  \def\@@x{@@x \pst@number\psxunit mul }%
%    \end{macrocode}
% Check some special cases:
%
% 1) Left is plain - right concave / convex
%    \begin{macrocode}
  \ifdim\POE@key@lensradiusleft pt=0pt
    \ifdim\POE@key@lensradiusright pt=0pt\else
      \addto@pscode{%
        \@@x sub neg 5 1 roll
        \@@x neg \@ht neg moveto ArcR
        \@@x neg \@ht lineto
      }%
    \fi
  \fi
%    \end{macrocode}
% 2) Right is plain - left concave / convex
%    \begin{macrocode}
  \ifdim\POE@key@lensradiusright pt=0pt
    \ifdim\POE@key@lensradiusleft pt=0pt\else
      \addto@pscode{%
        \@@x sub 5 1 roll
        \@@x \@ht moveto ArcL
        \@@x \@ht neg lineto
      }%
    \fi
  \fi
%    \end{macrocode}
% 3) right and left are both curved
%    \begin{macrocode}
  \ifdim\POE@key@lensradiusright pt=0pt\else
    \ifdim\POE@key@lensradiusleft pt=0pt\else
      \addto@pscode{%
        \@@x dup
        7 1 roll sub neg 5 1 roll
        ArcR sub 5 1 roll ArcL
      }%
    \fi
  \fi
  \addto@pscode{closepath 1 setlinejoin end }%
  \end@ClosedObj
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{Aspheric lens}
%
% \begin{macro}{\asphericlens@nodes}
%    \begin{macrocode}
\def\asphericlens@nodes{%
  \def\POE@asphere##1{%
    (##1)^2*(1/(\POE@key@asphereradiusleft*(1+sqrt(1-(1+\POE@key@asphereconstant)*(##1)^2/\POE@key@asphereradiusleft^2)))+%
    (##1)^2*(\POE@key@asphereAfour % 
      + (##1)^2*(\POE@key@asphereAsix %
        + ((##1)^2*(\POE@key@asphereAeight %
          + \POE@key@asphereAten*(##1)^2)))))}%
  \def\POE@arcright##1{%
    (##1)^2/(\POE@key@asphereradiusright*sqrt(1-(##1)^2/\POE@key@asphereradiusright^2))}%
  \POE@Verb{%
    tx@Dict begin 
      /POEasphereleftx0 (\POE@asphere{0.5*\POE@key@asphereheight}) AlgParser cvx exec def
      /POEasphererightx0
      \ifdim\POE@key@asphereradiusright pt>0pt
        (\POE@arcright{0.5*\POE@key@asphereheight}) AlgParser cvx exec
      \else
        0
      \fi
      def
      \POE@key@aspherewidth\space POEasphereleftx0 POEasphererightx0 add sub dup 0 gt {
        POEasphererightx0 add /POEasphererightx0 exch def
      } {
        pop
      } ifelse
    end
  }%
  \pssavepath[linestyle=none, arrows=-,ArrowInside=-]{\oenode@Path{A}}{%
    \psparametricplot[algebraic, plotstyle=cspline]%
      {\POE@key@asphereheight\space -0.5 mul}%
      {\POE@key@asphereheight\space 0.5 mul}%
      {\POE@asphere{t}-POEasphereleftx0|t}}%
  \ifdim\POE@key@asphereradiusright pt>0pt
    \pssavepath[linestyle=none, arrows=-,ArrowInside=-]{\oenode@Path{B}}{%
      \psparametricplot[algebraic, plotstyle=cspline]%
        {\POE@key@asphereheight\space 0.5 mul}%
        {\POE@key@asphereheight\space -0.5 mul}%
        {-\POE@arcright{t}+POEasphererightx0|t}}%
  \fi
  \newOptexpComp{%
    {POEasphereleftx0 neg 0} tx@IntersectDict /\PIT@name{\oenode@Path{A}} get 0 0 trans {PathIfc}
    {POEasphererightx0 0}
    \ifdim\POE@key@asphereradiusright pt>0pt
      tx@IntersectDict /\PIT@name{\oenode@Path{B}} get 0 0 trans {PathIfc}
    \else
      {0 1} 0 0 trans {PlainIfc}
    \fi
    \POE@key@n }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\asphericlens@comp}
%    \begin{macrocode}
\def\asphericlens@comp{%
  \pscustom[arrows=-]{%
    \pstracecurve{\oenode@Path{A}}%
    \ifdim\POE@key@asphereradiusright pt>0pt
      \pstracecurve{\oenode@Path{B}}
    \else
      \lineto(!POEasphererightx0 \POE@key@asphereheight\space 0.5 mul)
      \lineto(!POEasphererightx0 \POE@key@asphereheight\space -0.5 mul)
    \fi
    \closepath}%
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{pinhole}
%
% \begin{macro}{\pinhole@ref}
%    \begin{macrocode}
\def\pinhole@ref{%
  \POE@setref{/@@y \POE@key@outerheight\space 0.5 mul def}%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pinhole@nodes}
%    \begin{macrocode}
\def\pinhole@nodes{%
  \newOptexpComp{%
    {-1e-4 0} {0 1} @@y0 @@y sub @@y0 @@y add trans {PlainIfc}
    {0 0} {0 1} \POE@key@innerheight\space -0.5 mul dup neg 
    trans {PlainIfc}  
    {1e-4 0} {0 1} @@y0 @@y sub @@y0 @@y add trans {PlainIfc}
    \POE@key@n }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pinhole@comp}
%    \begin{macrocode}
\def\pinhole@comp{%
  \ifdim\POE@key@phwidth pt=0pt
    \psline[linewidth=\POE@key@phlinewidth]%
      (! 0 \POE@key@outerheight\space 2 div)%
      (! 0 \POE@key@innerheight\space 2 div)%
    \psline[linewidth=\POE@key@phlinewidth]%
      (! 0 \POE@key@outerheight\space -2 div)%
      (! 0 \POE@key@innerheight\space -2 div)%
  \else
    \pspolygon*[linestyle=none]%
      (! 0 \POE@key@innerheight\space 2 div)%
      (! 0 \POE@key@outerheight\space 2 div)%
      (! \POE@key@phwidth\space\POE@key@outerheight\space 2 div)%
      (! \POE@key@phwidth\space\POE@key@innerheight\space dup neg
         \POE@key@outerheight\space add 2 div add 2 div)%
    \pspolygon*[linestyle=none]%
      (! 0 \POE@key@innerheight\space -2 div)%
      (! 0 \POE@key@outerheight\space -2 div)%
      (! \POE@key@phwidth\space\POE@key@outerheight\space -2 div)%
      (! \POE@key@phwidth\space\POE@key@innerheight\space dup neg 
         \POE@key@outerheight\space add 2 div add -2 div)%
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{beamsplitter}
%
% \begin{macro}{\beamsplitter@ref}
%    \begin{macrocode}
\def\beamsplitter@ref{%
  \POE@setref{/@@x \POE@key@bssize\space 0.5 sqrt mul def }%
}%
% \begin{macro}{\beamsplitter@nodes}
%    \begin{macrocode}
\def\beamsplitter@nodes{%
  \edef\@bs@wd{\POE@key@bssize\space 0.5 mul }%
  \ifx\POE@key@bsstyle\POE@str@cube
    \newOptexpCompAmb{%
      {\@bs@wd 2 sqrt div neg dup} {-1 1} \@bs@wd neg \@bs@wd 
      trans {PlainIfc}
      {\@bs@wd 2 sqrt div dup neg} {1 1} \@bs@wd neg \@bs@wd
      trans {PlainIfc}
      {0 0} {1 0} \@bs@wd 2 sqrt mul dup neg exch 
      trans {PlainIfc}
      {\@bs@wd 2 sqrt div dup} {-1 1} \@bs@wd neg \@bs@wd 
      trans {PlainIfc}
      {\@bs@wd 2 sqrt div neg dup neg} {1 1} \@bs@wd neg \@bs@wd 
      trans {PlainIfc} 
      3 \POE@key@n
    }%
  \else\ifx\POE@key@bsstyle\POE@str@plate
    \newOptexpCompAmb{%
      {0 0} {1 0} \@bs@wd neg \@bs@wd trans {PlainIfc} 1 1 }%
  \fi\fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\beamsplitter@comp}
%    \begin{macrocode}
\def\beamsplitter@comp{%
  \edef\@bs@wd{\POE@key@bssize\space 2.0 div }%
  \ifx\POE@key@bsstyle\POE@str@cube
    \psline[arrows=cc-cc](! \@bs@wd neg 2 sqrt mul 0)
                  (! \@bs@wd 2 sqrt mul 0)
    \rput[c]{45}(0,0){%
      \psframe(! \@bs@wd neg \@bs@wd neg)(! \@bs@wd \@bs@wd)
    }
  \else\ifx\POE@key@bsstyle\POE@str@plate
    \psline(! \@bs@wd neg 2 sqrt mul 0)(! \@bs@wd 2 sqrt mul 0)
  \fi\fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{crystal}
%
% \begin{macro}{\crystal@ref}
%    \begin{macrocode}
\def\crystal@ref{%
  \let\POE@key@optboxwidth\POE@key@crystalwidth
  \let\POE@key@optboxheight\POE@key@crystalheight
  \optbox@ref
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\crystal@comp}
%    \begin{macrocode}
\def\crystal@comp{%
  \edef\@wd{\POE@key@crystalwidth\space 0.5 mul }
  \edef\@ht{\POE@key@crystalheight\space 0.5 mul }
  \psframe(! \@wd neg \@ht neg)(! \@wd \@ht)
  \ifPOE@voltage%
    \psline(!\@wd 4 div 3 mul neg \@ht)%
           (! \@wd 4 div 3 mul neg \@ht 0.16 add)
    \pscircle[fillstyle=solid, fillcolor=white]%
      (! \@wd 4 div 3 mul neg \@ht 0.2 add){0.04}
    \psline(! \@wd 4 div 3 mul neg \@ht neg)%
           (! \@wd 4 div 3 mul neg \@ht neg 0.2 sub)%
    \psline(! \@wd 4 div 3 mul neg 0.15 sub \@ht neg 0.2 sub)%
           (! \@wd 4 div 3 mul neg 0.15 add \@ht neg 0.2 sub)%
  \fi
  \ifPOE@lamp
    \rput(! \@wd \@ht){%
      \psset{style=CrystalLamp}%
      \rput(0, 0.4){\crystal@lamp}%
    }%
  \fi
  \ifdim\POE@key@caxislength pt=0pt\else
    \def\@cl{%
      \POE@key@caxislength\space 
      \ifPOE@caxisinv -1 mul\space\fi
    }%
    \psline[style=CrystalCaxis](! 0 \@cl \POE@dict{sign} \@ht mul)%
                               (! 0 \@cl \POE@dict{sign} neg \@ht mul \@cl sub)%
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\crystal@lamp}
%    \begin{macrocode}
\def\crystal@lamp{%
  \pscurve[fillstyle=none](-0.015, 0)(-0.03, -0.045)(-0.06, -0.075)%
          (-0.075, -0.15)(0, -0.21)(0.075, -0.15)(0.06, -0.075)%
          (0.03, -0.045)(0.015, 0)
  \multido{\i=-30+40}{7}{%
    \rput{\i}(0, -0.135){%
      \psline(-0.105, 0)(-0.18, 0)
    }%
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{polarization}
%
% \begin{macro}{\polarization@comp}
%    \begin{macrocode}
\def\polarization@comp{%
  \edef\@sz{\POE@key@polsize\space 0.5 mul }%
  \psset{style=Polarization}%
  \ifx\POE@key@poltype\POE@str@parallel
    \psline[arrows=<->](! 0 \@sz neg)(! 0 \@sz)
  \fi
  \ifx\POE@key@poltype\POE@str@perp
    \psdot(0,0)
    \pscircle[fillstyle=none](0,0){0.12}
  \fi
  \ifx\POE@key@poltype\POE@str@misc
    \psline[arrows=<->](! 0 \@sz neg)(! 0 \@sz)
    \psdot(0,0)
    \pscircle[fillstyle=none](0,0){0.12}
  \fi
  \ifx\POE@key@poltype\POE@str@rcirc
    \psellipticarc[fillstyle=none, arrows=->]%
      (0,0)(! \@sz 2 div \@sz){20}{-20}
  \fi
  \ifx\POE@key@poltype\POE@str@lcirc
    \psellipticarc[fillstyle=none, arrows=<-]%
      (0,0)(! \@sz 2 div \@sz){20}{-20}
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optgrating}
%
% \begin{macro}{\optgrating@ref}
%    \begin{macrocode}
\def\optgrating@ref{%
  \POE@setref{/@@x \POE@key@gratingwidth\space 0.5 mul def}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optgrating@comp}
%    \begin{macrocode}
\def\optgrating@comp{%
  \edef\@cnt{\POE@key@gratingcount\space}%
  \edef\@wd{\POE@key@gratingwidth\space 0.5 mul }%
  \ifdim\POE@key@gratingheight pt<\POE@key@gratingdepth pt
    \edef\@ht{\POE@key@gratingdepth\space}%
  \else
    \edef\@ht{\POE@key@gratingheight\space}%
  \fi
%    \end{macrocode}
% Shift the grating by its depth if gratingalign is set to 'center'.
%    \begin{macrocode}
  \ifx\POE@key@gratingalign\POE@str@top
    \edef\@dp{\POE@key@gratingdepth\space}%
    \edef\@bl{0 }%
  \else
    \edef\@dp{0 }%
    \edef\@bl{\POE@key@gratingdepth\space neg }%
    \edef\@ht{\@ht \POE@key@gratingdepth\space sub }%
  \fi
  \edef\@step{\POE@key@gratingwidth\space\@cnt div }%
  \ifx\POE@key@gratingtype\POE@str@blazed
    \pscustom[linewidth=\POE@key@gratinglinewidth, linejoin=1]{%
      \psline[liftpen=1](! \@wd \@dp)(! \@wd \@ht)%
                        (! \@wd neg \@ht)(! \@wd neg \@dp)%
      \multido{\i=0+1}{\POE@key@gratingcount}{%
        \psline[liftpen=1]%
          (! \@wd neg \i\space \@step mul add \@dp)%
          (! \@wd neg \i\space 
             \ifPOE@reverse\else 1 add \fi \@step mul add \@bl)%
          (! \@wd neg \i\space 1 add \@step mul add \@dp)%
      }%
      \closepath
    }%
  \else\ifx\POE@key@gratingtype\POE@str@binary
    \pscustom[linewidth=\POE@key@gratinglinewidth, linejoin=1]{%
      \psline[liftpen=1](! \@wd \@dp)(! \@wd \@ht)%
                        (! \@wd neg \@ht)(! \@wd neg \@dp)%
      \multido{\i=0+1}{\POE@key@gratingcount}{%
        \psline[liftpen=1]%
          (! \@wd neg \i\space \@step mul add \@dp)%
          (! \@wd neg \i\space \@step mul add \@bl)%
          (! \@wd neg \i\space 0.5 add \@step mul add \@bl)%
          (! \@wd neg \i\space 0.5 add \@step mul add \@dp)%
          (! \@wd neg \i\space 1 add \@step mul add \@dp)%
      }%
      \closepath
    }%
  \fi\fi
  \ifPOE@variable
    \psarc[style=VariableStyle]%
      (! \POE@key@gratingwidth\space 0.5 mul 0.4 sub
         \POE@key@gratingheight\space 0.5 mul){0.6}{-20}{20}
    \psarc[style=VariableStyle]%
      (! 0.4 \POE@key@gratingwidth\space 0.5 mul sub
         \POE@key@gratingheight\space 0.5 mul){0.6}{160}{200}
   \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{transmissiongrating}
%
% \begin{macro}{\transmissiongrating@ref}
%    \begin{macrocode}
\def\transmissiongrating@ref{%
  \POE@calcAngle
  \POE@setref{/@@x \POE@key@gratingwidth\space 0.5 mul def}%
  \edef\POE@key@angle{%
    \POE@dict{ exch@ref@\oenode{}{} { -90 }{ 90 } ifelse }
    \POE@key@angle\space add
  }%
  \POE@Verb{%
    @xref @yref
    exch@ref@\oenode{}{} { 
      [ exch { neg } forall ]
    } if
    /@xref ED
    exch@ref@\oenode{}{} { 
      [ exch { neg } forall ]
    } if
    /@yref ED
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\transmissiongrating@nodes}
%    \begin{macrocode}
\def\transmissiongrating@nodes{%
  \newOptexpComp{%
    {0 0} {1 0} \POE@key@gratingwidth\space -0.5 mul dup neg 
    refltrans {PlainIfc} 1}%
}%
\let\transmissiongrating@comp\optgrating@comp
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optbox}
%
% \begin{macro}{\optbox@ref}
%    \begin{macrocode}
\def\optbox@ref{%
  \POE@setref{%
    /@@x \POE@key@optboxwidth\space 0.5 mul def
    /@@y \POE@key@optboxheight\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\optbox@comp}
%    \begin{macrocode}
\let\optbox@comp\POE@comp@rectangle
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optsource}
%
% \begin{macro}{\optsource@ref}
%    \begin{macrocode}
\def\optsource@ref{%
  \let\POE@key@optboxwidth\POE@key@sourcewidth
  \let\POE@key@optboxheight\POE@key@sourceheight
  \optbox@ref
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optsource@nodes}
%    \begin{macrocode}
\def\optsource@nodes{%
  \POE@dipole@nodes
  \POE@Verb{%
    \oenode{}{} begin
    4 dict dup /source exch def begin
      \if\POE@key@sourcebeamangle\relax\else
        /beamangle \POE@key@sourcebeamangle\space def
      \fi
      \if\POE@key@sourcebeamdiv\relax\else
        /beamdiv \POE@key@sourcebeamdiv\space def
      \fi
      \if\POE@key@sourcebeamwidth\relax\else
        /beamwidth \POE@key@sourcebeamwidth\space def
      \fi
      \if\POE@key@sourcebeamalign\relax\else
        /beamalign \POE@key@sourcebeamalign\space def
      \fi
    end
    source length 0 eq { currentdict /source undef } if
    end }%
}%
%
% \begin{macro}{\optsource@comp}
%    \begin{macrocode}
\let\optsource@comp\POE@comp@rectangle
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{optplate}
%
% \begin{macro}{\optplate@ref}
%    \begin{macrocode}
\def\optplate@ref{%
  \POE@setref{/@@y \POE@key@plateheight\space 0.5 mul def }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optplate@comp}
%    \begin{macrocode}
\def\optplate@comp{%
   \psline[linewidth=\POE@key@platelinewidth]%
     (! \POE@dict{0 @@y neg})(! \POE@dict{0 @@y})
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{optdetector}
%
% \begin{macro}{\optdetector@ref}
%    \begin{macrocode}
\def\optdetector@ref{%
  \ifx\POE@key@detsize\@empty
    \POE@setref{%
      /@@y \POE@key@detheight\space 0.5 mul def
      /@@x \POE@key@detwidth\space 0.5 mul def
    }%
  \else
    \POE@setref{%
      /@@y \POE@key@detsize\space 0.5 mul def
      /@@x \POE@key@detsize\space 0.5 mul
      \ifx\POE@key@dettype\POE@str@round 0.5 mul\fi
      \space def
    }%
  \fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\optdetector@nodes}
%    \begin{macrocode}
\def\optdetector@nodes{%
  \POE@dipole@nodes
  \ifx\POE@key@dettype\POE@str@round
    \pnode(! \POE@dict{@@x0 @@x -0.2 mul add} 0){\oenodeCenter{}}%
  \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optdetector@comp}
%    \begin{macrocode}
\def\optdetector@comp{%
  \ifx\POE@key@dettype\POE@str@round
    \psellipticwedge(!\POE@dict{@@x0 @@x sub @@y0})%
      (!\POE@dict{@@x 2 mul @@y}){-90}{90}%
  \else\ifx\POE@key@dettype\POE@str@diode
    \ifx\POE@key@detsize\@empty
      \ifdim\POE@key@detwidth pt<\POE@key@detheight pt
        \def\@sz{\POE@key@detwidth\space 0.5 mul }%
      \else
        \def\@sz{\POE@key@detheight\space 0.5 mul }%
      \fi
    \else
      \def\@sz{\POE@key@detsize\space 0.5 mul }%
    \fi
    \POE@comp@rectangle
    \bgroup
      \psset{style=DetectorStyle}
      \pspolygon(! \@sz -0.2 mul \@sz -0.4 mul)%
                (! \@sz 0.6 mul \@sz -0.4 mul)%
                (! \@sz 0.2 mul \@sz 0.4 mul)%
      \psline(! \@sz -0.2 mul \@sz 0.4 mul \POE@clwh add)%
             (! \@sz 0.6 mul \@sz 0.4 mul \POE@clwh add)
      \psset{arrows=->, arrowinset=0, arrowscale=0.8}%
      \psline(! \@sz -0.8 mul \@sz 0.3 mul)%
             (! \@sz -0.3 mul \@sz 0.15 mul)%
      \psline(! \@sz -0.8 mul 0)(! \@sz -0.3 mul \@sz -0.15 mul)%
    \egroup
  \fi\fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{optdetector@conn}
%    \begin{macrocode}
\def\optdetector@conn{%
  \ifPOE@startbox\else
    \ifPOE@beam
      \drawbeam[raytrace=false](\oenodeRefA{}){}
    \else\ifPOE@fiberin@
      \drawfiber@{FiberIn}(\oenodeRefA{}){}
    \else\ifPOE@wirein@
      \drawwire@{WireIn}(\oenodeRefA{}){}
    \fi\fi\fi
  \fi
  \ifPOE@endbox\else
    \ifPOE@wirepresetout@
      \drawwire@{WireOut}{}(\oenodeRefB{})
    \else\ifPOE@fiberout@
      \drawfiber@{FiberOut}{}(\oenodeRefB{})
    \fi\fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
% \subsubsection{optretplate}
%
% \begin{macro}{\optretplate@ref}
%    \begin{macrocode}
\def\optretplate@ref{%
   \POE@setref{%
     /@@y \POE@key@plateheight\space 0.5 mul def
     /@@x \POE@key@platewidth\space 0.5 mul def
   }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optretplate@comp}
%    \begin{macrocode}
\def\optretplate@comp{%
   \edef\@ht{\POE@key@plateheight\space 0.5 mul }%
   \edef\@wd{\POE@key@platewidth\space 0.5 mul }%
   \psframe(! \@wd neg \@ht neg)(! \@wd \@ht)
   \psline{cc-cc}(! \@wd neg \@ht)(! \@wd \@ht neg)
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optdiode}
%
% \begin{macro}{\optdiode@ref}
%    \begin{macrocode}
\def\optdiode@ref{%
  \POE@setref{%
    \POE@key@optdiodesize\space 0.5 mul dup dup /@@y ED /@@x ED 
    0.4 mul /@@sz ED
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optdiode@comp}
%    \begin{macrocode}
\def\optdiode@comp{%
   \POE@comp@rectangle
   \pspolygon(!\POE@dict{@@sz neg dup})
             (!\POE@dict{@@sz neg @@sz})
             (!\POE@dict{@@sz 0})
   \psline(!\POE@dict{@@sz \POE@clwh add @@sz})%
          (!\POE@dict{@@sz \POE@clwh add @@sz neg})
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{doveprism}
%
% \begin{macro}{doveprism@ref}
%    \begin{macrocode}
\def\doveprism@ref{%
  \POE@setref{/@@x \POE@key@doveprismwidth\space 0.5 mul def
              /@@y \POE@key@doveprismheight\space 0.5 mul def}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\doveprism@nodes}
%    \begin{macrocode}
\def\doveprism@nodes{%
  \newOptexpComp{%
    /@htsq @@y 2 sqrt mul def
    {@@x neg @@y add 0} {1 1} 
    @htsq neg @htsq trans {PlainIfc}
    {0 @@y neg} {1 0} 
    @@x neg dup neg
    refl {PlainIfc}
    {@@x @@y sub 0} {-1 1} 
    @htsq neg @htsq trans {PlainIfc} 
    \POE@key@n true 
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\doveprism@comp}
%    \begin{macrocode}
\def\doveprism@comp{%
   \pspolygon(!\POE@dict{@@x neg @@y neg})%
             (!\POE@dict{@@x @@y neg})%
             (!\POE@dict{@@x @@y 2 mul sub @@y})%
             (!\POE@dict{@@y 2 mul @@x sub @@y})
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{glanthompson}
%
% \begin{macro}{\glanthompson@ref}
%    \begin{macrocode}
\def\glanthompson@ref{%
  \POE@setref{%
    /@@x \POE@key@glanthompsonwidth\space 0.5 mul def
    /@@y \POE@key@glanthompsonheight\space 0.5 mul def
  }%
}%      
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\glanthompson@nodes}
%    \begin{macrocode}
\def\glanthompson@nodes{%
  \newOptexpCompAmb{%
    {@@x neg 0} {0 1} @@x neg @@x trans {PlainIfc}
    {@@x 0} {0 1} @@x neg @@x trans {PlainIfc}
    {\POE@key@glanthompsongap\space -0.5 mul 0} {@@x neg @@y} 0 0 trans {PlainIfc}
    {0 @@y neg} {1 0} @@y neg @@y trans {PlainIfc}
    {0 @@y} {1 0} @@y neg @@y trans {PlainIfc}
    3 \POE@key@n
  }
}%      
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\glanthompson@comp}
%    \begin{macrocode}
\def\glanthompson@comp{%
  \ifdim\POE@key@glanthompsongap pt>0pt
    \pspolygon(!\POE@dict{@@x neg @@y})%
              (!\POE@dict{@@x neg @@y neg})%
              (!\POE@dict{@@x \POE@key@glanthompsongap\space sub @@y neg})
    \pspolygon(!\POE@dict{@@x neg \POE@key@glanthompsongap\space add @@y})%
              (!\POE@dict{@@x @@y})%
              (!\POE@dict{@@x @@y neg})%
  \else
    \psframe(!\POE@dict{@@x neg @@y neg})(!\POE@dict{@@x @@y})
    \psline[arrows=cc-cc](!\POE@dict{@@x neg @@y})(!\POE@dict{@@x @@y neg})
  \fi
}%      
%    \end{macrocode}
% \end{macro}
% \subsubsection{pentaprism}
%
% \begin{macro}{\pentaprism@nodes}
%    \begin{macrocode}
\def\pentaprism@nodes{%
  \edef\@sz{\POE@key@pentaprismsize\space}%
  \newOptexpComp{%
    {\@sz 2 sqrt -2 mul div dup } {-1 1} 
    \@sz -0.5 mul dup neg trans {PlainIfc}
    {\@sz 2 sqrt div 67.5 cos \@sz mul 
      67.5 sin 2 mul div sub \@sz 2 div}
    {67.5 cos \@sz mul 67.5 sin div neg \@sz} 
     \@sz 22.5 cos div -0.5 mul dup neg refl {PlainIfc}
    {\@sz 2 sqrt div neg 67.5 cos \@sz mul 
      67.5 sin 2 mul div add \@sz 2 div}
    {67.5 cos \@sz mul 67.5 sin div \@sz}
     \@sz 22.5 cos div -0.5 mul dup neg refl {PlainIfc}
    {\@sz 2 sqrt 2 mul div dup neg} {1 1} 
    \@sz -0.5 mul dup neg trans {PlainIfc} 
    \POE@key@n
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pentaprism@comp}
%    \begin{macrocode}
\def\pentaprism@comp{%
  \edef\@sz{\POE@key@pentaprismsize\space}%
  \pscustom{%
    \psline(! \@sz 2 sqrt div 0)%
           (! \@sz 2 sqrt div 67.5 cos \@sz mul 
              67.5 sin div sub \@sz)%
           (! 67.5 cos \@sz mul 67.5 sin div \@sz 
              2 sqrt div sub \@sz)%
           (! \@sz 2 sqrt div neg 0)%
           (! 0 \@sz 2 sqrt div neg)%
    \closepath
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optprism}
%
% \begin{macro}{\optprism@ref}
%    \begin{macrocode}
\def\optprism@ref{%
  \POE@calcAngle
  \ifx\POE@key@prismtype\POE@str@reflective
    \edef\POE@key@labelrefangle{180}%
  \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optprism@nodes}
%    \begin{macrocode}
\def\optprism@nodes{%
  \edef\@sz{\POE@key@prismsize\space}%
  \edef\@ang{\POE@key@prismangle\space 0.5 mul\space}%
  \edef\@hshift{%
    \ifx\POE@key@prismalign\POE@str@auto
      \POE@dict{OEangle} 1e-5 lt {
        0
      } {
        \@sz 0.6 mul \@ang tan mul \POE@dict{OEangle} 0.5 mul tan div 
      } ifelse
    \else
      0
    \fi
  }%
  \begingroup
    \edef\POE@temp{\ifx\POE@key@prismtype\POE@str@reflective neg \fi}%
    \pnode(! 0 \@hshift neg){\oenodeCenter{}}%
    \newOptexpComp{%
      {\@sz -0.6 mul \@ang tan mul \@hshift neg} 
      {90 \@ang sub dup cos exch sin \POE@temp} 
      \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc}
      {\@sz 0.6 mul \@ang tan mul \@hshift neg} 
      {90 \@ang add dup cos exch sin \POE@temp} 
      \@sz \@ang cos div dup -0.4 mul exch 0.6 mul trans {PlainIfc} 
%    \end{macrocode}
% Need to change the order of the two interfaces on the stack and add an
% additional interface.
%    \begin{macrocode}
      \ifx\POE@key@prismtype\POE@str@reflective
        12 6 roll
        {0 \@sz 0.4 mul \@hshift sub } 
        {1 0} \@ang tan \@sz mul dup neg exch refl {PlainIfc}
        12 6 roll
      \fi
      \POE@key@n true }%
  \endgroup
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optprism@comp}
%    \begin{macrocode}
\def\optprism@comp{%
  \edef\@sz{\POE@key@prismsize\space}%
  \edef\@altan{\POE@key@prismangle\space 0.5 mul tan }%
  \edef\@hshift{%
    \ifx\POE@key@prismalign\POE@str@auto
      \POE@dict{OEangle} 1e-5 lt {
        0
       } {
        \@sz 0.6 mul \@altan mul \POE@dict{OEangle} 0.5 mul tan div 
       } ifelse
    \else
      0
    \fi
  }%
  \edef\POE@temp{\ifx\POE@key@prismtype\POE@str@reflective -1 mul \fi}%
  \pspolygon(! \@sz neg \@altan mul \@sz -0.4 mul \POE@temp \@hshift sub)
            (! \@sz \@altan mul \@sz -0.4 mul \POE@temp \@hshift sub)
            (! 0 \@sz 0.6 mul \POE@temp \@hshift sub)
}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{rightangleprism}
%
% \begin{macro}{\rightangleprism@ref}
%   All tripole components are aligned such, that the x-axis is normal
%   to the angle bisector (Winkelhalbierende), but for the right angle
%   prism the x-axis must be oriented normal to the bisector
%   (Seitenhalbierende). So we must correct for the difference in both
%   orientations, which is stored in dOEangle.
%    \begin{macrocode}
\def\rightangleprism@ref{%
  \POE@calcAngle
  \POE@Verb{%
    /@htA @myht def
    /@OEtrafo {dOEangle matrix rotate dtransform } bind def
  }%
%    \end{macrocode}
% Correct also the label reference angle for nonsymmetric reference nodes.
%    \begin{macrocode}
  \let\POE@temp\POE@key@labelrefangle
  \edef\POE@key@labelrefangle{\POE@temp \POE@dict{dOEangle add} }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rightangleprism@nodes}
%    \begin{macrocode}
\def\rightangleprism@nodes{%
  \edef\@sz{\POE@key@raprismsize\space 0.5 mul }%
  \POE@Verb{%
    \ifx\POE@key@raprismalign\POE@str@auto
      /@corrshift {} bind def
    \else
      /@corrshift {@htA sub \@sz 0.5 mul add } bind def%
    \fi
  }%
  \newOptexpComp{%
    {@htA neg @htA \@sz sub @corrshift @OEtrafo} {1 0 @OEtrafo} 
    @htA \@sz sub @htA trans {PlainIfc}
    {@htA neg 0 @corrshift @OEtrafo} {1 1 @OEtrafo} 
    @htA 2 sqrt mul dup \@sz 0.5 sqrt div sub exch refl {PlainIfc}
    {@htA 0 @corrshift @OEtrafo} {-1 1 @OEtrafo} 
    @htA 2 sqrt mul dup \@sz 0.5 sqrt div sub exch refl {PlainIfc}
    {@htA dup \@sz sub @corrshift @OEtrafo} {1 0 @OEtrafo} 
     @htA neg \@sz @htA sub trans {PlainIfc} 
    \POE@key@n 
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rightangleprism@comp}
%    \begin{macrocode}
\def\rightangleprism@comp{%
  \edef\@sz{\POE@key@raprismsize\space 0.5 mul }%
  \ifx\POE@key@raprismalign\POE@str@auto
    \pspolygon(!\POE@dict{\@sz neg @htA \@sz sub @OEtrafo})
              (!\POE@dict{\@sz @htA \@sz sub @OEtrafo})
              (! 0 \POE@dict{@htA @OEtrafo})%
  \else
    \pspolygon(!\POE@dict{\@sz \@sz -0.5 mul @OEtrafo})%
              (!\POE@dict{\@sz neg \@sz -0.5 mul @OEtrafo})%
              (!\POE@dict{0 \@sz 0.5 mul @OEtrafo})
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{optaom}
%
% \begin{macro}{\optaom@ref}
%    \begin{macrocode}
\def\optaom@ref{%
  \POE@setref{/@@x \POE@key@aomwidth\space 0.5 mul def }%
  \POE@setref{/@@y \POE@key@aomheight\space 0.5 mul def }%
  \POE@calcAngle
  \ifx\POE@key@aomalign\POE@str@symmetric\else
    \edef\POE@key@angle{\POE@key@angle\space 180 \POE@dict{OEangle} sub 0.5 mul sub }%
  \fi
  \edef\POE@key@angle{\POE@key@angle\space 180 add }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\optaom@nodes}
%    \begin{macrocode}
\def\optaom@nodes{%
  \ifodd
    \ifx\POE@key@aomalign\POE@str@symmetric
      \ifx\POE@key@aomreflalign\POE@str@parallel 1\else 0\fi
    \else 0\fi
%    \end{macrocode}
%
% A 'parallel' reflection interface is possible only, if the aomalign is
% symmetric, because otherwise it is probable, that the incoming beam is
% parallel to that interface.
%    \begin{macrocode}
    \newOptexpCompAmb{%
      {@@x neg 0} {0 1} @@y neg @@y
      trans {PlainIfc}
      {0 0}
      \ifx\POE@key@aomalign\POE@str@symmetric
        {1 0}
      \else
        {1 0 180 OEangle sub 0.5 mul matrix rotate dtransform}
      \fi
      0 0 trans {PlainIfc}
      {@@x @@y} {0 1} @@y -2 mul 0
      trans {PlainIfc}
      {@@x @@y neg} {0 1} 0 @@y 2 mul
      trans {PlainIfc}
      2 1
    }%
  \else
    \newOptexpCompAmb{%
      {@@x neg 0} {0 1} @@y neg @@y trans {PlainIfc}
      {0 0}
      \ifx\POE@key@aomalign\POE@str@symmetric
        {0 1}
      \else
        {0 1 180 OEangle sub 0.5 mul matrix rotate dtransform}
      \fi
      0 0 refltrans {PlainIfc}
      {@@x @@y} {0 1} @@y -2 mul 0
      trans {PlainIfc}
      {@@x @@y neg} {0 1} 0 @@y 2 mul
      trans {PlainIfc}
      2 1
    }%
  \fi
  \POE@Verb{%
    gsave
      tx@Dict begin
        STV {CP T} stopped pop
      end
      (C) (\oenode{}{}) GetPlaneVec 2 copy
      /N@\oenodeRefA{} @GetCenter
      /N@\oenodeCenter{} @GetCenter 
      @ABVect 90 matrix rotate dtransform
      NormalVec ReflectVec ToVec dup
      \oenode{}{} begin
        {0 0} exch 0 0 refltrans name (C-1) {PlainIfc} {sc} NewCompIfc
        (C) (C1) IfcAlias
        2 1 \POE@key@diffractionorders\space {% vec i
          2 copy neg dup 5 string cvs (C) exch strcat % vec i vec -i (C-i)
              3 -1 roll exec 4 -1 roll % vec i (C-i) X Y -i
              1 add 180 OEangle sub 0.5 mul mul 
              matrix rotate dtransform ToVec % vec i (C-i) {X' Y'}
              {0 0} exch 0 0 refltrans name 7 -1 roll {PlainIfc} {sc} NewCompIfc
          2 copy 3 -1 roll 5 string cvs (C) exch strcat % vec i vec i (C-i)
              3 -1 roll exec 4 -1 roll % vec i (Ci) X Y i
              1 add 180 OEangle sub 0.5 mul mul 
              matrix rotate dtransform ToVec % vec i (Ci) {X' Y'}
              {0 0} exch 0 0 refltrans name 7 -1 roll {PlainIfc} {sc} NewCompIfc
            } for pop
        /grating true def
      end
    grestore 
  }%
  \POE@saveDiffractionNodes
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\optaom@comp}
%    \begin{macrocode}
\def\optaom@comp{%
  \POE@comp@rectangle
  \ifx\POE@key@aomcomp\POE@str@default
    \multido{\i=0+1}{\POE@key@aomgratingcount}{%
      \psrline(!\POE@dict{@@x -0.7 mul \POE@key@aomgratingcount\space 2 div dup 1.5 add 
                 @@y exch div exch 0.5 sub \i\space sub mul})%
              (!\POE@dict{@@x 1.4 mul 0})%
    }%
  \else
    \POE@key@aomcomp
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{off-axis parabolic mirror}
%
% \begin{macro}{\oapmirror@nodes}
%    \begin{macrocode}
\def\oapmirror@nodes{%
  \POE@calcAngle
  \POE@Verb{%
    gsave
      STV CP T
      /N@\oenodeRefA{} @GetCenter 
      /N@\oenodeCenter{} @GetCenter
      @ABVect NormalizeVec 2 copy 
      90 matrix rotate dtransform
      /N@\oenodeRefB{} @GetCenter
      /N@\oenodeCenter{} @GetCenter @ABVect
      \tx@UserCoor 2 copy 6 2 roll 
    grestore
    DotProd tx@Dict begin /POEzonalradius ED end
    DotProd 
    % y = ax^2, a = 1/(2x_0^2) (-h + sqrt(h^2 + x_0^2)), x_0 = @zonalradius.
    tx@Dict begin 
    dup /POEoapheight ED neg dup dup mul POEzonalradius dup mul add sqrt add 0.5 POEzonalradius dup mul div mul
    dup /POEoappar ED
    /POEangle 180 OEangle sub 0.5 mul POEzonalradius 0 gt { 90 add } if DegToRad def
    end
  }%
  \def\POE@tempX{((POEoappar*(t^2))-(0.25/POEoappar)+POEoapheight)}%
  \def\POE@tempY{(-t+POEzonalradius)}%
  \pssavepath[linestyle=none, arrows=-,ArrowInside=-]{\oenode@Path{A}}{%
    \psparametricplot[algebraic]%
      {POEzonalradius dup 0 gt {\POE@key@oapmirroraperture@outer}{\POE@key@oapmirroraperture@inner} ifelse add}%
      {POEzonalradius dup 0 gt {\POE@key@oapmirroraperture@inner}{\POE@key@oapmirroraperture@outer} ifelse sub}%
      {(cos(POEangle)*\POE@tempX+sin(POEangle)*\POE@tempY)|(cos(POEangle)*\POE@tempY-sin(POEangle)*\POE@tempX)}}%
  \newOptexpComp{%
    {0 0} tx@IntersectDict /\PIT@name{\oenode@Path{A}} get 0 0 refl {PathIfc}
    1 }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\oapmirror@comp}
%    \begin{macrocode}
\def\oapmirror@comp{%
  \pstracecurve{\oenode@Path{A}}%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Axicon}
%
% \begin{macro}{axicon@nodes}
%    \begin{macrocode}
\def\axicon@nodes{%
  \POE@setref{%
    /@@right \POE@key@axiconheight\space 0.5 mul \POE@key@axiconangle\space dup sin exch cos div mul def
    @@right \POE@key@axiconwidth\space max 0.5 mul /@@x exch def
    /@@y \POE@key@axiconheight\space 0.5 mul def
    /@@right 
  }%
  \pssavepath[linestyle=none, arrows=-,ArrowInside=-]{\oenode@Path{A}}{%
    \psline(!\POE@dict{@@x @@right sub @@y})
           (!\POE@dict{@@x 0})
           (!\POE@dict{@@x @@right sub @@y neg})
  }%
  \newOptexpComp{%
    {@@x neg 0} {0 1} @@y neg @@y trans {PlainIfc}
    {@@x 0}
      tx@IntersectDict /\PIT@name{\oenode@Path{A}} get 0 0 trans {PathIfc}
    \POE@key@n }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{axicon@comp}
%    \begin{macrocode}
\def\axicon@comp{%
  \pspolygon[arrows=-]%
    (!\POE@dict{@@x neg @@y})(!\POE@dict{@@x @@right sub @@y})
    (!\POE@dict{@@x 0})(!\POE@dict{@@x @@right sub @@y neg})
    (!\POE@dict{@@x neg @@y neg})
    %(!\POE@key@axiconwidth\space neg \POE@key@axiconheight\space -0.5 mul)
    %(!\POE@key@axiconwidth\space neg \POE@key@axiconheight\space 0.5 mul)
    %(! 0 \POE@key@axiconheight\space 0.5 mul)
    %(! \POE@key@axiconheight\space 0.5 mul \POE@key@axiconangle\space tan mul 0)
    %(! 0 \POE@key@axiconheight\space -0.5 mul)
}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{optwedge}
%
% \begin{macro}{optwedge@nodes}
%    \begin{macrocode}
\def\optwedge@nodes{%
  \POE@Verb{%
    /@@xl \POE@key@wedgeheight\space \POE@key@wedgeangleleft\space tan mul def
    /@@xr \POE@key@wedgeheight\space \POE@key@wedgeangleright\space tan mul def
    /@@xa \POE@key@wedgewidth\space @@xl @@xr add sub dup 0 gt {0.5 mul}{pop 0} ifelse def
  }%
  \newOptexpComp{%
    {@@xl @@xa add -0.5 mul 0} {\POE@key@wedgeangleleft\space tan 1} 0 0 trans {PlainIfc}
    {@@xr @@xa add 0.5 mul 0} {\POE@key@wedgeangleright\space tan -1} 0 0 trans {PlainIfc}
  \POE@key@n }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{optwedge@comp}
%    \begin{macrocode}
\def\optwedge@comp{%
  \pspolygon[arrows=-](!\POE@dict{@@xa} \POE@key@wedgeheight\space 0.5 mul)
                      (!\POE@dict{@@xa @@xr} add \POE@key@wedgeheight\space -0.5 mul)
                      (!\POE@dict{@@xa @@xl} add neg \POE@key@wedgeheight\space -0.5 mul)
                      (!\POE@dict{@@xa} neg \POE@key@wedgeheight\space 0.5 mul)
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Fiber components}
%
% \subsubsection{optfiber}
%
% \begin{macro}{optfiber@ref}
%    \begin{macrocode}
\def\optfiber@ref{%
  \POE@setref{%
    /@@x \POE@key@fiberloopsep\space\POE@key@fiberloops\space
    1 sub mul 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\optfiber@nodes}
%    \begin{macrocode}
\def\optfiber@nodes{%
  \newOptexpFiberComp{{@@x neg 0} {@@x 0}}%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optfiber@comp}
%    \begin{macrocode}
\def\optfiber@comp{%
  \pscustom[style=Fiber, arrows=-]{%
    \multido{\i=0+1}{\POE@key@fiberloops}{%
      \parametricplot[liftpen=1, plotpoints=100]{0}{1}{%
        t 360 mul sin 1 t 360 mul cos sub
        \POE@key@fiberloopradius\space dup 3 1 roll mul 3 1 roll mul
        \POE@key@fiberloops\space 1 sub -2 div \i\space add
        \POE@key@fiberloopsep\space mul add exch
      }%
    }%
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optmzm}
%
% \begin{macro}{\optmzm@ref}
%    \begin{macrocode}
\def\optmzm@ref{%
  \POE@setref{%
    /@@x \POE@key@optmzmwidth\space 0.5 mul def
    /@@y \POE@key@optmzmheight\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optmzm@comp}
%    \begin{macrocode}
\def\optmzm@comp{%
  \POE@comp@rectangle
  \begingroup
    \POE@usefiberorwirestyle
    \psline(! \POE@dict{@@x} neg 0)(! \POE@dict{@@x} -0.7 mul 0)%
           (! \POE@dict{@@x} -0.4 mul \POE@dict{@@y} 0.6 mul)%
           (! \POE@dict{@@x 0.4 mul @@y 0.6 mul})%
           (! \POE@dict{@@x} 0.7 mul 0)(! \POE@dict{@@x} 0)%
           (! \POE@dict{@@x} 0.7 mul 0)%
           (! \POE@dict{@@x 0.4 mul @@y -0.6 mul})%
           (! \POE@dict{@@x -0.4 mul @@y -0.6 mul})%
           (! \POE@dict{@@x} -0.7 mul 0)%
  \endgroup
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{optfilter} 
%
% \begin{macro}{\optfilter@ref}
%    \begin{macrocode}
\def\optfilter@ref{%
  \POE@setref{%
    \POE@key@filtersize\space 0.5 mul dup /@@y ED /@@x ED 
    \ifx\POE@key@innercompalign\POE@str@absolute\else
      /@@ang \POE@key@filterangle\space def
    \fi
  }%
}%
\let\optfilter@nodes\POE@dipole@nodes
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optfilter@comp}
%    \begin{macrocode}
\def\optfilter@comp{%
  \def\POE@filter@curve{%
    \parametricplot[plotstyle=curve,arrows=-]{-1}{1}{%
      \POE@dict{@@x} dup t mul 0.7 mul exch t Pi mul RadtoDeg 
      90 add cos 0.2 mul mul}%
  }%
  \def\POE@strike@line{%
    \psline(!\POE@dict{@@x -0.3 mul @@y -0.15 mul})%
           (!\POE@dict{@@x 0.3 mul @@y 0.15 mul})
  }%
  \POE@comp@rectangle
  \psrotate(\oenodeCenter{}){!\POE@dict{@@ang}}{%
  \psset{style=FilterStyle}%
    \ifx\POE@key@filtertype\POE@str@bandpass
      \rput(!\POE@dict{0 @@x -0.5 mul}){\POE@strike@line\POE@filter@curve}
      \rput(0, 0){%
        \POE@usefiberorwirestyle
        \POE@filter@curve}
      \rput(!\POE@dict{0 @@x 0.5 mul}){\POE@strike@line\POE@filter@curve}
    \else\ifx\POE@key@filtertype\POE@str@bandstop
      \begingroup
        \POE@usefiberorwirestyle
        \rput(!\POE@dict{0 @@x -0.5 mul}){\POE@filter@curve}
        \rput(!\POE@dict{0 @@x 0.5 mul}){\POE@filter@curve}
      \endgroup
      \rput(0,0){\POE@strike@line\POE@filter@curve}
    \else\ifx\POE@key@filtertype\POE@str@lowpass
      \rput(!\POE@dict{0 @@x -0.5 mul}){%
        \POE@usefiberorwirestyle
        \POE@filter@curve}
        \rput(0, 0){\POE@strike@line\POE@filter@curve}
        \rput(!\POE@dict{0 @@x 0.5 mul}){\POE@strike@line\POE@filter@curve}
    \else\ifx\POE@key@filtertype\POE@str@highpass
      \rput(!\POE@dict{0 @@x 0.5 mul}){%
        \POE@usefiberorwirestyle
        \POE@filter@curve}
        \rput(0, 0){\POE@strike@line\POE@filter@curve}
        \rput(!\POE@dict{0 @@x -0.5 mul}){\POE@strike@line\POE@filter@curve}
  \fi\fi\fi\fi
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
%\subsubsection{optamp}
%
% \begin{macro}{optamp@ref}
%    \begin{macrocode}
\def\optamp@ref{%
  \POE@setref{%
    /@@x \POE@key@optampwidth\space 0.5 mul def
    /@@y \POE@key@optampheight\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\optamp@nodes}
%    \begin{macrocode}
\def\optamp@nodes{%
  \newOptexpFiberComp{{@@x neg 0} {@@x 0}}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optamp@comp}
%    \begin{macrocode}
\def\optamp@comp{%
  \pspolygon(!\POE@dict{@@x 0})%
            (!\POE@dict{@@x neg @@y})%
            (!\POE@dict{@@x neg @@y neg})
}%
%    \end{macrocode}
% \end{macro} 
%
%\subsubsection{polcontrol}
%
% \begin{macro}{polcontrol@ref}
%    \begin{macrocode}
\def\polcontrol@ref{%
  \ifx\POE@key@polcontroltype\POE@str@linear
    \POE@setref{/@@x \POE@key@polcontrolsize\space 2 mul def}%
  \else
    \POE@setref{/@@x \POE@key@polcontrolsize\space 1.5 mul def}%
  \fi
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\polcontrol@nodes}
%    \begin{macrocode}
\def\polcontrol@nodes{%
  \newOptexpFiberComp{{@@x neg 0} {@@x 0}}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\polcontrol@comp}
%    \begin{macrocode}
\def\polcontrol@comp{%
  \edef\@sz{\POE@key@polcontrolsize\space}%
  \ifPOE@optexpenv
    \psline[style=Fiber, arrows=-, ArrowInside=-](\oenodeIn{})(\oenodeOut{})
  \fi
  \bgroup
    \POE@usefiberorwirestyle
    \ifx\POE@key@polcontroltype\POE@str@linear
      \multips(! -2 \@sz mul \@sz)(! 2 \@sz mul 0){3}{%
        \pscircle(0,0){\POE@key@polcontrolsize}%
      }%
    \else
      \pscircle(! -1.5 \@sz mul \@sz neg){\POE@key@polcontrolsize}
      \pscircle(! 0 \@sz){\POE@key@polcontrolsize}%
      \pscircle(! 1.5 \@sz mul \@sz neg){\POE@key@polcontrolsize}
    \fi
  \egroup
  \ifPOE@optexpenv\else
    \psline[style=Fiber, arrows=-, ArrowInside=-](\oenodeIn{})(\oenodeOut{})
  \fi  
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optisolator}
%
% \begin{macro}{\optisolator@ref}
%    \begin{macrocode}
\def\optisolator@ref{%
  \POE@setref{%
    /@@x \POE@key@isolatorwidth\space 0.5 mul def
    /@@y \POE@key@isolatorheight\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optisolator@comp}
%    \begin{macrocode}
\def\optisolator@comp{%
  \POE@comp@rectangle
  \psline[style=IsolatorArrow, arrows=->]%
    (!\POE@dict{@@x neg 0.6 mul 0})%
    (!\POE@dict{@@x 0.6 mul 0})
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optfiberpolarizer}
% \begin{macro}{\optfiberpolarizer@ref}
%    \begin{macrocode}
\def\optfiberpolarizer@ref{%
  \POE@setref{%
    /@@x \POE@key@fiberpolwidth\space 0.5 mul def
    /@@y \POE@key@fiberpolheight\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optfiberpolarizer@comp}
%    \begin{macrocode}
\def\optfiberpolarizer@comp{%
  \POE@comp@rectangle
  \psline(!\POE@dict{@@x -0.2 mul @@y neg})(!\POE@dict{@@x 0.2 mul @@y})
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{optswitch}
%
% \begin{macro}{\optswitch@ref}
%    \begin{macrocode}
\def\optswitch@ref{%
  \POE@setref{%
    /@@x \POE@key@switchwidth\space 0.5 mul def
    /@@y \POE@key@switchheight\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optswitch@comp}
%    \begin{macrocode}
\def\optswitch@comp{%
  \POE@comp@rectangle
%    \end{macrocode}
% storing the linewidth of the object allows for some aesthetic fine tuning 
%    \begin{macrocode}
  \pstVerb{tx@Dict begin /@lw \POE@clw def end}%
  \bgroup
    \POE@usefiberorwirestyle
    \psset{arrows=-, ArrowInside=-}%
    \psline(! \POE@dict{@@x} neg 0)(! \POE@dict{@@x} -0.6 mul @lw sub 0)%
    \psline(! \POE@dict{@@x} 0.6 mul 0)(! \POE@dict{@@x} 0)%
  \egroup
  \ifx\POE@key@switchstyle\POE@str@closed%
    \bgroup
      \POE@usefiberorwirestyle
      \psdot[dotsize=3\pslinewidth](! \POE@dict{@@x} 0.6 mul 0)%
      \psdot[dotsize=3\pslinewidth](! \POE@dict{@@x} -0.6 mul 0)%
      \psline[arrows=-, ArrowInside=-, linewidth=1.5\pslinewidth]%
        (! \POE@dict{@@x} -0.6 mul @lw)(! \POE@dict{@@x} 0.6 mul @lw)%      
    \egroup
  \else
    \psline[arrows=-, ArrowInside=-, linewidth=1.5\pslinewidth]%
      (! \POE@dict{@@x} -0.6 mul @lw add @lw 0.5 mul)%
      (! \POE@dict{@@x 0.45 mul @@y 0.6 mul})%
    \pscircle(! \POE@dict{@@x} -0.6 mul 0){\pslinewidth}%
    \psdot[dotsize=3\pslinewidth](! \POE@dict{@@x} 0.6 mul 0)%
  \fi
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{fiberdelayline}
%
% \begin{macro}{\fiberdelayline@ref}
%    \begin{macrocode}
\def\fiberdelayline@ref{%
  \POE@setref{%
    /@@y \POE@key@fdlheight\space 0.5 mul def
    /@@x \POE@key@fdlwidth\space 0.5 mul def
  }%
}%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\def\POE@get@yarrowscale#1 #2 #3 #4\@nil{%
  \def\POE@tempA{#3\space}%
}%
%    \end{macrocode}
% \begin{macro}{\fiberdelayline@comp}
%    \begin{macrocode}
\def\fiberdelayline@comp{%
  \POE@comp@rectangle
  \begingroup
    \psset{style=FdlArrow}
    \use@par
    \pst@expandafter\POE@get@yarrowscale{\psk@arrowscale}\@nil
    \def\@arrowshift{%
      \psk@arrowlength\space \psk@arrowsize\space
      \pst@number\pslinewidth\space mul add mul
      \POE@tempA mul
      @@y 2.9 mul @@x 0.6 mul atan 2 copy cos mul 3 1 roll sin mul
      \tx@UserCoor abs exch abs exch\space
    }%
    \psline(! \POE@dict{@@x -0.4 mul @@y -1.6 mul})%
           (! \POE@dict{@@x 0.2 mul @@y 1.3 mul \@arrowshift VecAdd})
  \endgroup
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% 
%    \begin{macrocode}
\newOptexpDipole{optarrowcomp}{}
\def\optarrowcomp@ref{%
  \POE@setref{%
    \ifx\POE@key@arrowcompshape\POE@str@rectangle
      /@@x \POE@key@arrowcompwidth\space 0.5 mul def
      /@@y \POE@key@arrowcompheight\space 0.5 mul def
    \else
      \POE@key@arrowcompwidth\space\POE@key@arrowcompheight\space
      min 0.5 mul dup /@@x ED /@@y ED
    \fi
    \POE@key@arrowcompangle\space dup 0 gt {
      { dup 180 ge { 180 sub } { exit } ifelse } loop
    } {
      { dup 0 lt { 180 add } { exit } ifelse } loop
    } ifelse dup /@arrowangle ED dup dup
    @@y @@x atan gt exch @@y @@x neg atan lt and {
      /@@dy @@y def
      tan @@y exch div /@@dx ED
    }{
      /@@dx @@x def
      tan @@x mul /@@dy ED
    } ifelse
  }%
}%
\def\optarrowcomp@comp{%
  \ifx\POE@key@arrowcompshape\POE@str@rectangle
    \POE@comp@rectangle
  \else
    \pscircle(!\POE@dict{@@x0 @@y0}){!\POE@dict{@@x}}
  \fi
  \begingroup
%    \end{macrocode}
% Set the style and execute the options directly, so we can use the correct 
% arrowscale and linewidth for the calculations.
%    \begin{macrocode}
    \psset{style=ArrowCompStyle}
    \use@par
    \pst@expandafter\POE@get@yarrowscale{\psk@arrowscale}\@nil
    \def\@arrowshift{%
      \psk@arrowlength\space \psk@arrowsize\space
      \pst@number\pslinewidth\space mul add mul 
      \POE@tempA mul
      @arrowangle 2 copy cos mul 3 1 roll sin mul 
      \tx@UserCoor\space
    }%
    \ifx\POE@key@arrowcompshape\POE@str@rectangle
      \psline(!\POE@dict{@@dx -1.5 mul @@dy -1.5 mul})%
             (!\POE@dict{@@dx 1.3 mul @@dy 1.3 mul \@arrowshift VecAdd})
    \else
      \psline(!\POE@dict{@arrowangle dup cos @@x -1.5 mul mul exch sin @@x -1.5 mul mul})
             (!\POE@dict{@arrowangle dup cos @@x 1.3 mul mul exch sin @@x 1.3 mul mul \@arrowshift VecAdd})
    \fi
  \endgroup
\ignorespaces}%
%    \end{macrocode}
%
%    \begin{macrocode}
\newOptexpDipole{optbarcomp}{}
\def\optbarcomp@ref{%
  \POE@setref{%
    \ifx\POE@key@barcompshape\POE@str@rectangle
      /@@x \POE@key@barcompwidth\space 0.5 mul def
      /@@y \POE@key@barcompheight\space 0.5 mul def
    \else
      \POE@key@barcompwidth\space\POE@key@barcompheight\space
      min 0.5 mul dup /@@x ED /@@y ED
    \fi
    \POE@key@barcompangle\space dup 0 gt {
      { dup 180 ge { 180 sub } { exit } ifelse } loop
    } {
      { dup 0 lt { 180 add } { exit } ifelse } loop
    } ifelse dup /@barangle ED dup dup
    @@y @@x atan gt exch @@y @@x neg atan lt and {
      /@@dy @@y def
      tan @@y exch div /@@dx ED
    }{
      /@@dx @@x def
      tan @@x mul /@@dy ED
    } ifelse
  }%
}%
\def\optbarcomp@comp{%
  \ifx\POE@key@barcompshape\POE@str@rectangle
    \POE@comp@rectangle
    \psline[style=BarCompStyle](!\POE@dict{ @@dx neg @@dy neg })%
                               (!\POE@dict{@@dx @@dy})
  \else
    \pscircle(!\POE@dict{@@x0 @@y0}){!\POE@dict{@@x}}
    \psline[style=BarCompStyle]%
      (!\POE@dict{@barangle dup cos @@x neg mul exch sin @@x neg mul})
      (!\POE@dict{@barangle dup cos @@x mul exch sin @@x mul})
  \fi
\ignorespaces}%
%    \end{macrocode}
%
%
% \subsubsection{fiberbox}
% \begin{macro}{fiberbox@ref}
%    \begin{macrocode}
\def\fiberbox@ref{%
  \POE@setref{%
    /@@x \POE@key@fiberboxwidth\space 0.5 mul def
    @@inht 0 eq @@outht 0 eq and {
      /@@inht \POE@key@fiberboxcountin\space\POE@key@fiberboxsepin\space mul def
      /@@outht \POE@key@fiberboxcountout\space\POE@key@fiberboxsepout\space mul def
    } if
    @@inht \POE@key@fiberboxcountin\space dup 1 add 3 1 roll div mul
    @@outht \POE@key@fiberboxcountout\space dup 1 add 3 1 roll div mul
    max 
    \POE@key@fiberboxheight\space dup @@inht @@outht max gt {
      exch
    } if pop 0.5 mul /@@y exch def
  }%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fiberbox@nodes}
%    \begin{macrocode}
\def\fiberbox@nodes{%
  \newOptexpFiberComp{%
    0 1 \POE@key@fiberboxcountin\space 1 sub {
      \POE@key@fiberboxcountin\space 1 sub 0.5 mul dup 3 -1 roll sub exch
      0 gt {
        @@inht \POE@key@fiberboxcountin\space 1 sub div mul
      } if
      @@x neg exch ToVec
    } for
    0 1 \POE@key@fiberboxcountout\space 1 sub {
      \POE@key@fiberboxcountout\space 1 sub 0.5 mul dup 3 -1 roll sub exch
      0 gt {
        @@outht \POE@key@fiberboxcountout\space 1 sub div mul
      } if
      @@x exch ToVec
    } for
  }
}%
\let\fiberbox@comp\POE@comp@rectangle
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{optcoupler}
% \begin{macro}{\optcoupler@nodes}
%    \begin{macrocode}
\def\optcoupler@nodes{%
  \newOptexpFiberComp{%
    {@@x neg @@y0 @@sep add}
    {@@x neg @@y0 @@sep sub}
    {@@x @@y0 @@sep add}
    {@@x @@y0 @@sep sub} }%
  \pnode(0,0){\oenodeCenter{}}
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@coupler@ref}
%    \begin{macrocode}
\def\POE@coupler@ref{%
  \POE@setref{%
    /@@x \POE@key@couplerwidth\space 0.5 mul def
    \ifx\POE@key@couplertype\POE@str@none
      \ifx\POE@key@couplersep\@empty
        /@@y \POE@key@couplerheight\space 0.5 mul 0.05 0.2 0.8 mul div mul def
      \else
        /@@y \POE@key@couplersep\space 0.5 mul def
      \fi
      /@@sep @@y def
    \else
      /@@y \POE@key@couplerheight\space 0.5 mul def
      \ifx\POE@key@couplersep\@empty
        \ifx\POE@key@couplertype\POE@str@ellipse
          /@@sep @@y 0.05 0.2 0.8 mul div mul def
        \else
          /@@sep @@y 0.5 mul def
        \fi
      \else
        /@@sep \POE@key@couplersep\space 0.5 mul def
      \fi
    \fi
    /@@y0 @@sep
    \ifx\POE@key@coupleralign\POE@str@bottom
    \else\ifx\POE@key@coupleralign\POE@str@top
      neg
    \else
      pop 0
    \fi\fi
    def
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
%    \begin{macrocode}
\let\optcoupler@ref\POE@coupler@ref
%    \end{macrocode}
%
% \begin{macro}{\wdmcoupler@ref}
% The \cs{wdmcoupler} and \cs{wdmsplitter} need a little correction for centered alignment and \opt{couplertype} set to \opt{none}.
%    \begin{macrocode}
\def\wdmcoupler@ref{%
  \POE@coupler@ref
  \ifx\POE@key@couplertype\POE@str@none
    \ifx\POE@key@coupleralign\POE@str@center
      \POE@setref{/@@y 0 def }%
    \fi
  \fi
}%
\let\wdmsplitter@ref\wdmcoupler@ref
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\optcoupler@comp}
%    \begin{macrocode}
\def\optcoupler@comp{%
  \ifx\POE@key@couplertype\POE@str@none
    \psline[style=Fiber](\oenode{1}{})(\oenode{3}{})
    \psline[style=Fiber](\oenode{2}{})(\oenode{N}{})
  \fi
  \POE@coupler@comp
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\POE@coupler@comp}
%    \begin{macrocode}
\def\POE@coupler@comp{%
  \ifx\POE@key@couplertype\POE@str@none
  \else\ifx\POE@key@couplertype\POE@str@ellipse
    \psellipse(! 0 \POE@dict{@@y0})(! \POE@dict{@@x @@y})
  \else
    \POE@comp@rectangle
    \ifx\POE@key@couplertype\POE@str@cross
      \psline(! \POE@dict{@@x -0.5 mul @@y0 @@y 0.5 mul sub})%
             (! \POE@dict{@@x 0.5 mul @@y0 @@y 0.5 mul add})%
      \psline(! \POE@dict{@@x -0.5 mul @@y0 @@y 0.5 mul add})%
             (! \POE@dict{@@x 0.5 mul @@y0 @@y 0.5 mul sub})%
    \fi
  \fi\fi
  \ifx\POE@key@couplertype\POE@str@cross\else
    \ifPOE@variable
      \begingroup
%    \end{macrocode}
% we set the style this way to be able to access the arrow and line parameters
% already before the psline command
%    \begin{macrocode}
        \psset{style=VariableCoupler}
        \use@par
        \pst@expandafter\POE@get@yarrowscale{\psk@arrowscale}\@nil
        \def\@arrowshift{%
          \psk@arrowlength\space\psk@arrowsize\space
          \pst@number\pslinewidth\space mul add mul 
          \POE@tempA mul 
          1.6 0.8 atan 2 copy cos mul 3 1 roll sin mul
          \tx@UserCoor abs exch abs exch\space
        }%
        \psline(!\POE@dict{@@x -0.4 mul @@y0 @@x sub})%
               (!\POE@dict{@@x 0.4 mul @@x 0.7 mul @@y0 add 
                 \@arrowshift VecAdd})
      \endgroup
    \fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{wdmcoupler}
% \begin{macro}{\wdmcoupler@nodes}
%    \begin{macrocode}
\def\wdmcoupler@nodes{%
  \newOptexpFiberComp{%
%    \end{macrocode}
% A coupler may have only a single input node, which must then be duplicated
%    \begin{macrocode}
    /@@nodecount \the\POE@couplernodecount\space dup 1 le { pop 2 } if def
    @@y0 \POE@key@couplersep\space 0.5 mul add
    \POE@key@couplersep\space @@nodecount 1 sub div
    \ifx\POE@key@couplertype\POE@str@none
      \ifx\POE@key@coupleralign\POE@str@center
        pop pop @@y0 0
      \fi
    \fi
    1 1 @@nodecount
    {
      3 copy 1 sub mul sub exch pop [ @@x neg 3 -1 roll ] cvx 3 1 roll
    } for
    pop pop
    {@@x 0}
  }%
  \pnode(0,0){\oenodeCenter{}}
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\wdmcoupler@comp}
%    \begin{macrocode}
\def\wdmcoupler@comp{%
  \ifx\POE@key@couplertype\POE@str@none
    \ifx\POE@key@coupleralign\POE@str@top
      \psline[style=Fiber](\oenode{1}{})(\oenodeOut{})
      \psline[style=Fiber]%
        (!/N@\oenodeOut{} \POE@dict{@GetCenter} 
          \tx@UserCoor \POE@key@couplersep\space sub)(\oenode{2}{})
    \else
      \psline[style=Fiber](\oenode{\the\POE@couplernodecount}{})(\oenodeOut{})
      \ifx\POE@key@coupleralign\POE@str@bottom
        \psline[style=Fiber]%
          (!/N@\oenodeOut{} \POE@dict{@GetCenter} 
            \tx@UserCoor \POE@key@couplersep\space add)(\oenode{1}{})
      \fi
    \fi
  \fi
  \POE@coupler@comp
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{wdmsplitter}
% \begin{macro}{\wdmsplitter@nodes}
%    \begin{macrocode}
\def\wdmsplitter@nodes{%
  \newOptexpFiberComp{%
    {@@x neg 0}
%    \end{macrocode}
% A coupler may have only a single output node, which must then be duplicated
%    \begin{macrocode}
    /@@nodecount \the\POE@couplernodecount\space dup 2 gt { 1 sub } if def
    @@y0 \POE@key@couplersep\space 0.5 mul add
    \POE@key@couplersep\space @@nodecount 1 sub div
    \ifx\POE@key@couplertype\POE@str@none
      \ifx\POE@key@coupleralign\POE@str@center
        pop pop @@y0 0
      \fi
    \fi
    1 1 @@nodecount
    {
      3 copy 1 sub mul sub exch pop [ @@x 3 -1 roll ] cvx 3 1 roll
    } for
    pop pop
  }%
  \pnode(0,0){\oenodeCenter{}}
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\wdmsplitter@comp}
%    \begin{macrocode}
\def\wdmsplitter@comp{%
  \ifx\POE@key@couplertype\POE@str@none
    \ifx\POE@key@coupleralign\POE@str@top
      \psline[style=Fiber](\oenodeIn{})(\oenode{2}{})
      \psline[style=Fiber](! \POE@dict{/N@\oenodeIn{} @GetCenter}
        \tx@UserCoor \POE@key@couplersep\space sub)(\oenode{N}{})
    \else
      \psline[style=Fiber](\oenodeIn{})(\oenode{N}{})
      \ifx\POE@key@coupleralign\POE@str@bottom
        \psline[style=Fiber](! \POE@dict{/N@\oenodeIn{} @GetCenter}
          \tx@UserCoor \POE@key@couplersep\space add)(\oenode{2}{})
      \fi
    \fi
  \fi
  \POE@coupler@comp
}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{optcirculator}
%
% \begin{macro}{optcirculator@ref}
%    \begin{macrocode}
\def\optcirculator@ref{%
  \POE@setref{\POE@key@optcircsize\space 0.5 mul dup /@@x ED /@@y ED }%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\optcirculator@nodes}
%    \begin{macrocode}
\def\optcirculator@nodes{%
  \newOptexpFiberComp{{@@x neg 0} {0 @@y neg} {@@x 0}}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\optcirculator@comp}
%    \begin{macrocode}
\def\optcirculator@comp{%
  \edef\@sz{\POE@key@optcircsize\space 0.5 mul }%
  \pscircle(0,0){! \@sz}
  \psarc[style=OptCircArrow](0,0)%
    {! \POE@key@optcircsize\space 0.5 mul}%
    {\POE@key@optcircangleA}%
    {\POE@key@optcircangleB}
}%
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{fibercollimator}
%
% \begin{macro}{fibercollimator@ref}
%    \begin{macrocode}
\def\fibercollimator@ref{%
  \POE@setref{%
    /@@x \POE@key@fibercolwidth\space 0.5 mul def
    /@@y \POE@key@fibercolheight\space 0.5 mul def}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fibercollimator@nodes}
%    \begin{macrocode}
\def\fibercollimator@nodes{%
  \pnode(!\POE@dict{@@x neg} 0){\oenodeIn{}}
  \newOptexpComp{{@@x neg 0} {0 1} @@y neg @@y trans {PlainIfc} 
                 {@@x 0} {0 1} 0 0 trans {PlainIfc} 1 }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\fibercollimator@comp}
%    \begin{macrocode}
\def\fibercollimator@comp{%
  \pspolygon(!\POE@dict{@@x neg \POE@clwh add @@y neg})%
            (!\POE@dict{@@x 0})%
            (!\POE@dict{@@x neg \POE@clwh add @@y})
}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Electrical components}
%
% \subsubsection{elecsynthesizer}
%
% \subsubsection{elecmixer}
%
% \begin{macro}{\elecmixer}
%    \begin{macrocode}
\def\elecmixer{\pst@object{elecmixer}}%
\def\elecmixer@i(#1)(#2)(#3){%
  \@ifnextchar\bgroup%
    {\elecmixer@ii(#1)(#2)(#3)}%
    {\elecmixer@ii(#1)(#2)(#3){}}%
}%
\def\elecmixer@ii(#1)(#2)(#3)#4{%
  \addafter@par{ref@angle=0}%
  \begin@OptexpObj
    \POE@calcCircRefNodes{#1}{#2}{#3}%
    \POE@drawcomponent{elecmixer}{#4}
    \ifPOE@backlayer
      \ifPOE@wirepresetin@top
        \drawwire@{WireIn}[stopnode=1](#1){}
      \else\ifPOE@fiberin@top
        \drawfiber@{FiberIn}[stopnode=1](#1){}
      \fi\fi
      \ifPOE@wirepresetout@top
        \drawwire@{WireOut1}[startnode=N]{}(#2)
      \else\ifPOE@fiberout@top
        \drawfiber@{FiberOut1}[startnode=N]{}(#2)
      \fi\fi
      \ifPOE@wirepresetout@bottom
        \drawwire@{WireOut2}[startnode=2, wirealign=center]{}(#3)
      \else\ifPOE@fiberout@bottom
        \drawfiber@{FiberOut2}[starnode=2, fiberalign=center]{}(#3)
      \fi\fi
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{elecmixer@ref}
%    \begin{macrocode}
\def\elecmixer@ref{%
  \POE@setref{\POE@key@elecmixersize\space 0.5 mul dup /@@x ED /@@y ED }%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\elecmixer@nodes}
%    \begin{macrocode}
\def\elecmixer@nodes{%
  \newOptexpElecComp{{@@x neg 0} {0 @@y neg} {@@x 0}}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\elecmixer@comp}
%    \begin{macrocode}
\def\elecmixer@comp{%
  \edef\@sz{\POE@key@elecmixersize\space 0.5 mul }%
  \pscircle(0,0){! \@sz}
  \psline(!\@sz 2 sqrt div neg dup)(!\@sz 2 sqrt div dup)
  \psline(!\@sz 2 sqrt div dup neg exch)(!\@sz 2 sqrt div dup neg)
}%
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Electrical coupler}
%
% \begin{macro}{\eleccoupler}
%    \begin{macrocode}
\def\eleccoupler{\pst@object{eleccoupler}}%
\def\eleccoupler@i(#1)(#2){%
  \@ifnextchar(%)
    {\eleccoupler@ii(#1)(#2)}%
    {\eleccoupler@ii(#1)(#1)(#2)(#2)}%
}%
\def\eleccoupler@ii(#1)(#2)(#3)(#4){%
  \@ifnextchar\bgroup%
    {\eleccoupler@iii(#1)(#2)(#3)(#4)}%
    {\eleccoupler@iii(#1)(#2)(#3)(#4){}}%
}%
\def\eleccoupler@iii(#1)(#2)(#3)(#4)#5{%
  \begin@OptexpObj
    \ifPOE@backlayer
      \ifx\POE@key@eleccoupleralign\POE@str@top
        \pnode(#1){\oenodeRefA{}}
        \pnode(#3){\oenodeRefB{}}
      \else\ifx\POE@key@eleccoupleralign\POE@str@bottom
        \pnode(#2){\oenodeRefA{}}
        \pnode(#4){\oenodeRefB{}}
      \else
        \pst@getcoor{#1}\POE@tempa%
        \pst@getcoor{#2}\POE@tempb%
        \pnode(!\POE@tempa \POE@tempb 
                \POE@dict{VecAdd 0.5 VecScale}
                \tx@UserCoor){\oenodeRefA{}}
        \pst@getcoor{#3}\POE@tempa%
        \pst@getcoor{#4}\POE@tempb%
        \pnode(!\POE@tempa \POE@tempb 
                \POE@dict{VecAdd 0.5 VecScale}
                \tx@UserCoor){\oenodeRefB{}}
      \fi\fi
    \fi
    \POE@drawcomponent{eleccoupler}{#5}
    \ifPOE@backlayer
      \POE@Verb{%
        (1) (3) (\oenode{}{}) CorrectDipoleIfc 
        (2) (4) (\oenode{}{}) CorrectDipoleIfc 
      }%
      \ifPOE@wirepresetin@top
        \drawwire@{WireIn1}[stopnode=1](#1){}
      \else\ifPOE@fiberin@top
        \drawfiber@{FiberIn1}[stopnode=1](#1){}
      \fi\fi
      \ifPOE@wirepresetout@top
        \drawwire@{WireOut1}[startnode=3](#3){}
      \else\ifPOE@fiberout@top
        \drawfiber@{FiberOut1}[startnode=3](#3){}
      \fi\fi
      \ifx\POE@key@eleccouplertype\POE@str@directional
        \ifx\POE@key@eleccouplerinput\POE@str@left
          \ifPOE@wirepresetout@bottom
            \drawwire@{WireOut2}[startnode=N](#4){}
          \else\ifPOE@fiberout@bottom
            \drawfiber@{FiberOut2}[startnode=N](#4){}
          \fi\fi
        \else
          \ifPOE@wirepresetin@bottom
            \drawwire@{WireIn2}[stopnode=2](#2){}
          \else\ifPOE@fiberin@bottom
            \drawfiber@{FiberIn2}[stopnode=2](#2){}
          \fi\fi
        \fi
      \else
        \ifPOE@wirepresetout@bottom
          \drawwire@{WireOut2}[startnode=N](#4){}
        \else\ifPOE@fiberout@bottom
          \drawfiber@{FiberOut2}[startnode=N](#4){}
        \fi\fi
        \ifPOE@wirepresetin@bottom
          \drawwire@{WireIn2}[stopnode=2](#2){}
        \else\ifPOE@fiberin@bottom
          \drawfiber@{FiberIn2}[stopnode=2](#2){}
        \fi\fi
      \fi
    \fi
  \end@OptexpObj
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eleccoupler@ref}
%    \begin{macrocode}
\def\eleccoupler@ref{%
  \POE@setref{%
    /@@x \POE@key@eleccouplerwidth\space 0.5 mul def
    /@@y \POE@key@eleccouplerheight\space 0.5 mul def
    \ifx\POE@key@eleccouplersep\@empty
      /@@sep @@y 0.75 mul def
    \else
      /@@sep \POE@key@eleccouplersep\space 0.5 mul def
    \fi
    /@@y0 @@sep
    \ifx\POE@key@eleccoupleralign\POE@str@bottom
    \else\ifx\POE@key@eleccoupleralign\POE@str@top
      neg
    \else
      pop 0
    \fi\fi
    def
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eleccoupler@nodes}
%    \begin{macrocode}
\def\eleccoupler@nodes{%
  \newOptexpElecComp{%
    {@@x neg @@y0 @@sep add}
    {@@x neg @@y0 @@sep sub}
    {@@x @@y0 @@sep add}
    {@@x @@y0 @@sep sub} }%
  \pnode(0,0){\oenodeCenter{}}
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eleccoupler@comp}
%    \begin{macrocode}
\def\eleccoupler@comp{%
  \POE@comp@rectangle
  \psline(!\POE@dict{@@x -0.7 mul  @@y0 @@sep sub @@y 0.15 mul add})%
         (!\POE@dict{@@x 0.7 mul @@y0 @@sep add @@y 0.15 mul sub})%
  \psline(!\POE@dict{@@x 0.7 mul  @@y0 @@sep sub @@y 0.15 mul add})%
         (!\POE@dict{@@x -0.7 mul @@y0 @@sep add @@y 0.15 mul sub})%
  \psline[style=Wire, arrows=-, ArrowInside=-](\oenodeIfc{1}{})(\oenodeIfc{3}{})
  \ifx\POE@key@eleccouplertype\POE@str@directional
    \ifx\POE@key@eleccouplerinput\POE@str@left
      \psline[style=Wire, arrows=-, ArrowInside=-]([Xnodesep=-0.1]\oenodeIfc{2}{})(\oenodeIfc{N}{})
    \else
      \psline[style=Wire, arrows=-, ArrowInside=-](\oenodeIfc{2}{})([Xnodesep=0.1]\oenodeIfc{N}{})
    \fi
    \pscustom[style=OptComp]{%
      \moveto(!\POE@dict{@@x 0.15 add
               \ifx\POE@key@eleccouplerinput\POE@str@left neg \fi
               @@y0 @@sep sub 0.14 add})
      \rlineto(0,-0.04)
      \multido{\rx=0.12+-0.08}{4}{%
        \rlineto(0.05,-0.02)
        \rlineto(-0.1,-0.04)
        \rlineto(0.05,-0.02)
      }%
      \rlineto(0,-0.04)
    }%
  \else
    \psline[style=Wire, arrows=-, ArrowInside=-](\oenodeIfc{2}{})(\oenodeIfc{N}{})
  \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newOptexpElecDipole}
%    \begin{macrocode}
\def\newOptexpElecDipole{%
  \@ifnextchar[%]
    {\POE@newelecdipole}{\POE@newelecdipole[]}%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\POE@newfiberdipole}
%    \begin{macrocode}
\def\POE@newelecdipole[#1]#2{%
  \@ifnextchar\bgroup
    {\POE@newelecdipole@i[#1]{#2}}{\POE@newelecdipole@i[#1]{#2}{}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\POE@newelecdipole@i}
%    \begin{macrocode}
\def\POE@newelecdipole@i[#1]#2#3{%
  \@ifundefined{#2@i}{%
    \@namedef{#2}{\pst@object{#2}}%
    \expandafter\def\csname #2@i\endcsname(##1)(##2){%
      \@ifnextchar\bgroup%
        {\@nameuse{#2@ii}(##1)(##2)}%
        {\@nameuse{#2@ii}(##1)(##2){}}%
    }%
    \expandafter\def\csname #2@ii\endcsname(##1)(##2)##3{%
      \addbefore@par{#3}%
      \addafter@par{#1}%
      \begin@OptexpObj
        \ifPOE@backlayer
          \POE@regNodes{##1}{##2}
        \fi
        \POE@drawcomponent{#2}{##3}
        \ifPOE@backlayer
          \POE@Verb{ (1) (N) (\oenode{}{}) CorrectDipoleIfc }%
          \POE@PresetWireConn
        \fi
      \end@OptexpDipole
    }%
    \@ifundefined{#2@nodes}{\expandafter\def\csname #2@nodes\endcsname{\POE@elecdipole@nodes}}{}%
  }{%
    \PackageError{pst-optexp}{%
      elecdipole component '#2' already defined}%
  }%
\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\elecsynthesizer@ref}
%    \begin{macrocode}
\newOptexpElecDipole{elecsynthesizer}{position=start, innercompalign=absolute}
\def\elecsynthesizer@ref{%
  \POE@setref{%
    \POE@key@synthwidth\space 0.5 mul
    \POE@key@synthheight\space 0.5 mul
    2 copy min /@@sz ED
    \ifx\POE@key@synthshape\POE@str@circle
      pop pop @@sz dup
    \fi
    /@@y ED /@@x ED
  }%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\elecsynthesizer@comp}
%    \begin{macrocode}
\def\elecsynthesizer@comp{%
  \ifx\POE@key@synthshape\POE@str@circle
    \pscircle(!\POE@dict{@@x0 @@y0}){!\POE@dict{@@x}}
  \else
    \POE@comp@rectangle
  \fi
  \psrotate(\oenodeCenter{}){!\POE@dict{@@ang}}{%
  \psset{style=SynthStyle}%
  \begingroup
%    \end{macrocode}
% Negative units are not possible with parametric or function plots.
%    \begin{macrocode}
    \let\POE@tempA\@empty
    \let\POE@tempB\@empty
    \ifdim\psxunit<0pt 
      \psset{xunit=-\psxunit}
      \def\POE@tempA{-1 mul\space}%
    \fi
    \ifdim\psyunit<0pt 
      \psset{yunit=-\psyunit}
      \def\POE@tempB{-1 mul\space}%
    \fi
    \ifx\POE@key@synthtype\POE@str@sine
      \parametricplot[plotpoints=100]{-1}{1}{%
        \POE@dict{@@sz 0.7 mul t mul t 180 mul \POE@tempA sin @@y -0.35 mul mul \POE@tempB }}%
    \else\ifx\POE@key@synthtype\POE@str@pulse
      \psplot[plotpoints=100]{-0.25}{0.25}{2.7182818 x 0.04 div dup mul neg exp 0.3 mul 0.13 sub \POE@tempB}%
    \fi\fi
  \endgroup
  \ifx\POE@key@synthtype\POE@str@rectangle
    \psline(!\POE@dict{@@sz -0.7 mul @@sz -0.35 mul})%
           (!\POE@dict{@@sz 0.7 mul -1 1 \POE@key@synthrectwidth\space sub 2 mul add mul @@sz -0.35 mul})%
           (!\POE@dict{@@sz 0.7 mul -1 1 \POE@key@synthrectwidth\space sub 2 mul add mul @@sz 0.35 mul})%
           (!\POE@dict{@@sz 0.7 mul @@sz 0.35 mul})%
           (!\POE@dict{@@sz 0.7 mul @@sz -0.35 mul})
  \else\ifx\POE@key@synthtype\POE@str@sawtooth
    \psline(!\POE@dict{@@sz -0.6 mul @@sz -0.4 mul})%
           (!\POE@dict{@@sz 0.6 mul @@sz 0.4 mul})%
           (!\POE@dict{@@sz 0.6 mul @@sz -0.4 mul})
  \else\ifx\POE@key@synthtype\POE@str@triangle
    \psline(!\POE@dict{@@sz -0.6 mul @@sz -0.4 mul})%
           (!\POE@dict{0 @@sz 0.4 mul})%
           (!\POE@dict{@@sz 0.6 mul @@sz -0.4 mul})
  \else
    \@ifundefined{elecsynthesizer@custom}{}{\elecsynthesizer@custom}%
  \fi\fi\fi}%
}%
%    \end{macrocode}
% \end{macro}
%</stylefile> 
%
% \chapter{The Postscript header file}
% \makeatletter
%^^A Copied this definition from doc.sty and changed it not to add a
%^^A backslash to the Postscript procedure name in the index.
% \def\SpecialIndex@#1#2{%
%    \@SpecialIndexHelper@#1\@nil
%    \def\@tempb{ }%
%    \ifcat \@tempb\@gtempa
%       \special@index{\quotechar\space\actualchar
%                      \string\verb\quotechar*\verbatimchar
%                      \quotechar\space\verbatimchar#2}%
%    \else
%      \def\@tempb##1##2\relax{\ifx\relax##2\relax
%           \def\@tempc{\special@index{\quotechar##1\actualchar
%                       \string\verb\quotechar*\verbatimchar
%                       \quotechar##1\verbatimchar#2}}%
%         \else
%           \def\@tempc{\special@index{##1##2\actualchar
%                        \string\verb\quotechar*\verbatimchar##1##2\verbatimchar#2}}%
%         \fi}%
%      \expandafter\@tempb\@gtempa\relax
%      \@tempc
%    \fi}
% \makeatother
%
%<*prolog>
%
% This is the dictionary where all components are stored in.
%    \begin{macrocode}
/tx@OptexpDict 200 dict def
tx@OptexpDict begin
/DebugOE false def
/DebugDepth 0 def
/DebugBegin { 
  DebugOE {
    /DebugProcName ED
    DebugDepth 2 mul string
    0 1 DebugDepth 2 mul 1 sub {
      dup 2 mod 0 eq { (|) }{( )} ifelse
      3 -1 roll dup 4 2 roll
      putinterval
    } for
    DebugProcName strcat ==
    /DebugDepth DebugDepth 1 add def
  }{
    pop
  } ifelse
} bind def
/DebugEnd {
  DebugOE {
    /DebugDepth DebugDepth 1 sub def
    DebugDepth 2 mul 2 add string
    0 1 DebugDepth 2 mul 1 sub {
      dup 2 mod 0 eq { (|) }{ ( ) } ifelse
      3 -1 roll dup 4 2 roll
      putinterval
    } for
    dup DebugDepth 2 mul (+-) putinterval
    ( done) strcat ==
  } if
} bind def
/DebugMsg { 
  DebugOE {
    DebugDepth 1 add 2 mul string
    0 1 DebugDepth 2 mul 1 add {
      dup 2 mod 0 eq { (|) }{( )} ifelse
      3 -1 roll dup 4 2 roll
      putinterval
    } for
    exch strcat ==
  }{
    pop
  } ifelse
} bind def
%    \end{macrocode}
% \begin{macro}{strcat}
% Concatenate two strings and leave the result on the stack
% \begin{pssyntax}
%   \PSstring{str1} \PSstring{str2} \PSop{strcat} \PSstring{str1str2}
% \end{pssyntax}
%    \begin{macrocode}
/strcat {
    exch 2 copy
    length exch length add
    string dup dup 5 2 roll
    copy length exch
    putinterval
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{nametostr}
%   Convert a literal name to string. This is required, because some PSTricks
%   parameter like \opt{angleA} do not allow round braces in the argument, so
%   some string must be passed as name and then converted to a string.
% \begin{pssyntax}
%   \PSname{name} \PSop{nametostr} \PSstring{name}
% \end{pssyntax}
%    \begin{macrocode}
/nametostr {
    dup length string cvs
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{PrintWarning}
%   Print a warning about the raytracing. This is enabled or disabled via option
%   \opt{pswarning}.
%    \begin{macrocode}
/PrintWarning {
  (Warning pst-optexp: ) exch strcat (\n) strcat print
} bind def
/CompUnknownWarning {
  (Component ') exch strcat (' unknown) strcat Warning
} bind def
/OneFiberCompWarning {
  (Found only one unsupported component in beam path, drawing no beam) Warning
} bind def
/FiberCompWarning {
  (Found an unsupported component in beam path, stopping beam path) Warning
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{inttostr}
%    Convert an integer to a string.
% \begin{pssyntax}
%   \PSvar{int} \PSop{inttostr} \PSstring{int}
% \end{pssyntax}
%    \begin{macrocode}
/inttostr {
  dup type /integertype eq {
    dup log 1 add floor cvi string cvs
  } if
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{calcNodes}
%   Calculate the reference node coordinates for reflective components and
%   stores them as \PSvar{X@A}, \PSvar{Y@A}, \PSvar{X@B} and \PSvar{Y@B}.
% \begin{pssyntax}
%   \PSvar{XA} \PSvar{YA} \PSvar{XB} \PSvar{YB} \PSvar{XG} \PSvar{YG} \PSop{calcNodes}
% \end{pssyntax}
%    \begin{macrocode}
/calcNodes {
  (calcNode) DebugBegin
  /YG exch def /XG exch def
  /by exch YG sub def
  /bx exch XG sub def
  /ay YG 3 -1 roll sub def
  /ax XG 3 -1 roll sub def
  ax ay NormalizeVec bx by NormalizeVec VecAdd
  2 copy Pyth abs 1e-4 lt { 
    pop pop ax ay -90 matrix rotate dtransform
  } if
  /cy ED /cx ED
  /c ax bx add ay by add Pyth def
%    \end{macrocode}
% If $c=0$, then set the coordinates of the vector manually depending whether
% \PSvar{a} and \PSvar{b} are parallel or antiparallel.
%    \begin{macrocode}
  c 0 eq {
    ax ay bx by DotProd 0 gt {
%    \end{macrocode}
% $\text{dotprod} > 0$, i.e. \PSvar{a} and \PSvar{b} are parallel.
%    \begin{macrocode}
      /cx ax def
      /cy ay def
    }{
      /cx ay def
      /cy ax neg def
    } ifelse
  } if
  cx cy NormalizeVec 2 copy
  XG YG VecAdd /Y@A ED /X@A ED
  XG YG 4 2 roll VecSub /Y@B ED /X@B ED
%    \end{macrocode}
% Test the chirality (the order) of the input points. Input angles $> 90$\textdegree
% don't make sense, in this case we exhange the calculated reference nodes.
%    \begin{macrocode}
  true
  ax by mul ay bx mul sub 0 le {
    pop false
    Y@A X@A 
    /X@A X@B def
    /Y@A Y@B def
    /X@B exch def
    /Y@B exch def
  } if
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{capHeight}
% Calculate the height \PSvar{a} of a pole cap, used for curved interfaces.
% \begin{pssyntax}
%   \PSvar{R} \PSvar{h} \PSop{capHeight} \PSvar{a}
% \end{pssyntax}
% \PSvar{R} is the circle radius and \PSvar{h} the width of the pole cap.
%    \begin{macrocode}
/capHeight {
    dup mul neg exch abs dup 3 1 roll dup mul add sqrt sub
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{leftCurvedIfc}
%   Calculate some parameters for the «left» interface of a lens. Defines and
%   \PSname{ArcL} which is used later in the code to actually draw the interface
%   curve.
% \begin{pssyntax}
%   \PSvar{h R1} \PSop{leftCurvedIfc} \PSvar{y |R1| alpha\textunderscore b
%     alpha\textunderscore t R1}
% \end{pssyntax}
%    \begin{macrocode}
/leftCurvedIfc {
  /R1 exch def /h exch def
  0 R1 abs dup R1 h capHeight exch sub R1 sign mul dup
  h exch atan exch
  h neg exch atan
  R1 0 lt {
    /ArcL /arcn load def
  } {
    /ArcL /arc load def
  } ifelse
  R1
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{rightCurvedIfc}
%   Analogous to \PSname{leftCurvedIfc} for «right» interfaces, defines
%   \PSname{ArcR} for later use.
% \begin{pssyntax}
%   \PSvar{h R2} \PSop{rightCurvedIfc} \PSvar{y |R2| alpha\textunderscore b
%     alpha\textunderscore t R2}
% \end{pssyntax}
%    \begin{macrocode}
/rightCurvedIfc {
  /R2 exch def /h exch def
  0 R2 abs dup R2 h capHeight sub R2 sign mul dup
  h neg exch atan exch
  h exch atan
  R2 0 lt {
    /ArcR /arcn load def
  } {
    /ArcR /arc load def
  } ifelse
  R2
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{SlopeAngle}
%   Calculate slope angle of a line from \PSname{nodeA} to \PSname{nodeB}.
%   \begin{pssyntax}
%     \PSname{nodeB} \PSname{nodeA} \PSop{SlopeAngle} \PSvar{angle}
%   \end{pssyntax}
%    \begin{macrocode}
/SlopeAngle {
  (SlopeAngle) DebugBegin
  @GetCenter 3 -1 roll @GetCenter @ABVect exch atan
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{DefineExtNode}
%   Constructs the coordinates of an external node based on values that have
%   been set beforehand. \PSvar{xref} and \PSvar{yref} are the values which are
%   defined by \opt{extnode} parameter. \PSvar{RefFac} is defined by parameter
%   \opt{extnodealign}, which determines it the reference of the external node
%   position should be the global coordinate system, or the line between the
%   reference nodes.
% \begin{pssyntax}
%   \PSvar{xref yref} \PSop{DefineExtNode} \PSvar{X Y}  
% \end{pssyntax}
%    \begin{macrocode}
/DefineExtNode {%
  (DefineExtNode) DebugBegin
  @@y mul RefFac mul @@y0 add 
  exch @@x mul RefFac mul @@x0 add exch
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetInternalNodeNames}
%   Push all internal node names of \PSstring{basicname} on the
%   stack. If \PSvar{reverse} is \PSvar{true}, the names are pushed in
%   reverse order.
%   \begin{pssyntax}
%     \PSstring{basicname} \PSvar{reverse} \PSop{GetInternalNodeNames}
%     \PSname{N@basicnameN} \ldots{} \PSname{N@basicname1} (if
%     \PSvar{reverse = false})
%   \end{pssyntax}
%    \begin{macrocode}
/GetInternalNodeNames {
  (GetInternalNodeNames) DebugBegin
  /reverse ED
  dup cvn load /N get dup
  reverse { -1 1 } { 1 1 3 -1 roll } ifelse
  { inttostr
    3 -1 roll dup 4 1 roll exch NodeName 3 1 roll
  } for
  pop pop
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetInternalBeamNodes}
%   This is like \PSvar{GetInternalNodeNames}, but leaves the node
%   coordinates on the stack
% \begin{pssyntax}
%   \PSstring{basicnodename} \PSvar{reverse} \PSop{GetInternalBeamNodes}
%   \PSvar{XN YN \ldots\ X1 Y1} (if \PSvar{reverse = false})
% \end{pssyntax}
%    \begin{macrocode}
/GetInternalBeamNodes {
  (GetInternalBeamNodes) DebugBegin
  [ 3 1 roll GetInternalNodeNames ]
  { @GetCenter } forall
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{InitOptexpComp}
%   Initialize some global variables for positioning of external
%   nodes. This is called at the beginning of every component.
%    \begin{macrocode}
/InitOptexpComp {%
  /@@x 0 def
  /@@y 0 def
  /@@x0 0 def
  /@@y0 0 def
  /@xref [0] def
  /@yref [0] def
  /RefFac 1 def
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{NewTempNodeComp}
%   If \cs{draw*beam} is invoked with a node as parameter, a
%   temporary \cs{optplane} is defined. The plane vector of this temporary plane
%   is set such that it is perpendicular to the connection between the node and the following
%   interface node. 
%
%   This is the only procedure which sets the \PSname{adjustRel} flag
%   which indicates adjustment of the plane vector rotation depending on
%   the incoming or outgoing connection direction.
% 
%   For an explanation of all other dictionary members, please see
%   \PSvar{NewOptexpComp}.
%   \begin{pssyntax}
%     \PSproc{x y} \PSproc{dx dy} \PSstring{name} \PSproc{scaling}
%     \PSop{NewTempNodeComp}
%   \end{pssyntax}
%    \begin{macrocode}
/NewTempNodeComp {
  (NewTempNodeComp) DebugBegin
  /sc ED
  dup cvn
  6 dict dup 3 1 roll def begin
    /ambiguous false def
    /allowbeaminside false def
    /forcebeaminside false def
    /name ED
    /correct false def
%    \end{macrocode}
% This definition does not work like for \PSvar{NewOptexpComp}, because
% a current point may not be available. Therefore, we translate to the
% $(X, Y)$ node and define $X = Y = 0$.
%    \begin{macrocode}
    {0 0} exch 3 -1 roll exec
    gsave
      translate
      /CompMtrx CM def
    grestore
    /N 1 def
    /n bgRefIndex def
    5 dict dup dup /P@1 ED /P@N ED
    begin
      /mode trans def
      {} 0 0 PlainIfc
    end
  /adjustRel true def
  end
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{CurvedIfc}
% Defines a curved interface.
% \begin{pssyntax}
%   \PSproc{X Y} \PSproc{DX DY} \PSproc{scl} \PSvar{NAlow NAup} \PSop{CurvedIfc}
% \end{pssyntax}
%    \begin{macrocode}
/CurvedIfc {
  5 2 roll
  2 copy 5 3 roll exec 3 -1 roll exec VecAdd 
  5 -1 roll exec /Y ED /X ED
  exch exec 3 -1 roll 3 copy exec /RY ED /RX ED
  3 1 roll NormalizeVec 3 -1 roll exec
  tx@Dict begin Pyth end dup
  3 1 roll mul 1.00001 mul /NAup ED
  mul 1.00001 mul /NAlow ED
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{PlainIfc}
%   \begin{pssyntax}
%     \PSproc{X Y} \PSproc{DX DY} \PSproc{scl} \PSvar{NAlow NAup} \PSop{PlainIfc}
%   \end{pssyntax}
%    \begin{macrocode}
/PlainIfc {
  5 2 roll
  dup 3 -1 roll exec NormalizeVec 3 -1 roll exec 2 copy /DY ED /DX ED
  tx@Dict begin Pyth end dup 4 2 roll
  exch exec 3 -1 roll exec /Y ED /X ED
  3 1 roll mul 1.00001 mul /NAup ED
  mul 1.00001 mul /NAlow ED
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{PathIfc}
% Define an interface which is given by an arbitrary path.
%   \begin{pssyntax}
%     \PSproc{X Y} \PSarray{path} \PSproc{scl} \PSvar{NAlow NAup} \PSop{PathIfc}
%   \end{pssyntax}
%    \begin{macrocode}
/PathIfc {
  pop pop /NAup 0 def /NAlow 0 def 
%    \end{macrocode}
% This kind of interface doesn't allow to switch off the NA-settings,
% because the interface is defined only inside the NA.
%    \begin{macrocode}
  3 1 roll /Path ED
  exec 3 -1 roll exec /Y ED /X ED
} bind def
%    \end{macrocode}
% \end{macro}
% \begin{macro}{NewCompIfc}
% Defines a new interface of a component, must be called within \PSvar{NewOptexpComp}.
% \begin{pssyntax}
%   \PSproc{x y} \PSproc{dx dy|rx ry} \PSvar{NAlow NAup mode} 
%   \PSstring{CompName} \PSstring{Name} \PSproc{New\ldots Ifc} \PSproc{scaling} 
%   \PSop{NewCompIfc}
% \end{pssyntax}
% \begin{psarglist}
% \psargitem{\PSproc{x y}} The coordinates of the interface node which lies on the optical axis.??
% \psargitem{\PSproc{dx dy | rx ry}} For a plane interface, this is the vector that describes the plane, for a curved interface this is the
% \psargitem{\PSvar{NAlow NAup}}
% \psargitem{\PSvar{mode}} An integer which characterizes if an interface is
%   reflective or transmittive. You should use the predefined variable
%   \PSname{refl} and \PSname{trans} for this.
% \psargitem{\PSstring{CompName}} The name of the component we are in.
% \psargitem{\PSstring{Name}} The name of the new interface. It is prefixed by «P@».
% \psargitem{\PSproc{\ldots Ifc}} Contain the actual procedure to define the
%   concrete interface type, can be \PSproc{PlainIfc}, \PSproc{CurvedIfc} or \PSproc{PathIfc}.
% \end{psarglist}
%    \begin{macrocode}
/NewCompIfc {
  /scl ED
  /next ED
  dup (P@) exch strcat cvn
  6 dict dup
  3 1 roll def
  begin
    3 -1 roll
    /mode ED
    6 -1 roll dup 7 -1 roll
    {scl} 8 -2 roll next
  end
%    \end{macrocode}
% store a new node \PSname{N@NameX}, with X=1..N this node always
% represents the intersection of an untilted and unshifted incoming beam
% on the optical axis with the respective interface
%    \begin{macrocode}
  exec scl ToVec 3 1 roll NodeName @NewNode
} bind def
%    \end{macrocode}
% \end{macro}
% 
% Define some constants.
%
% These are used for checks of the \opt{beamalign} and \opt{fiberalign} parameters.
%    \begin{macrocode}
/relative 0 def /absolute 1 def /center 2 def /firstcomp 3 def
%    \end{macrocode}
% 
% These constants are used to describe the characteristics of interfaces.
%    \begin{macrocode}
/refl 0 def /trans 1 def /absorb 2 def /refltrans 3 def /auto 4 def /undefined -1 def
%    \end{macrocode}
% 
% These give the ordering of the internal interfaces of a component.
%    \begin{macrocode}
/desc 0 def /asc 1 def /amb 2 def
%    \end{macrocode}
% 
% The possible status after computing the outgoing vector at an interface.
%    \begin{macrocode}
/ok 0 def /tir 1 def /missed 2 def
/bgRefIndex 0 def
%    \end{macrocode}
% 
% \begin{macro}{NewOptexpComp}
% \PSvar{NewOptexpComp} creates a new dictionary that contains everything needed
% for an optical component. It contains the following variables:
% \begin{psarglist} 
%   \psargitem{\PSvar{n}} The basic refractive index which was set for the
%   component. This may be overwritten with the \opt{n} option of the
%   \nxLcs{drawbeam} macros.
%
%   \psargitem{\PSvar{CompMtrx}} The transformation matrix at time of
%   the component definition. The method is the same as for the
%   \nxLPack{pst-node} nodes.
%
%   \psargitem{\PSvar{name}} The name of the component. This is build of
%   several components which are put together in the \TeX\ code.
%
%   \psargitem{\PSvar{N}} The number of interfaces of the component.
%
%   \psargitem{\PSvar{P@1\ldots P@N}} The actual
%   interfaces. \PSvar{P@1} and \PSvar{P@N} are always defined, even if
%   \PSvar{N = 1}. In that case the two names link to the same
%   dictionary, so that changes in one of them are automatically present
%   also in the second one.
%
%   \psargitem{\PSproc{sc}} The scaling procedure for the coordinates to convert
%   from \TeX{} to Postscript scaling. In should always be defined as
%   \PSproc{\textbackslash psxunit, \textbackslash psyunit}.
%
%   \psargitem{\PSvar{ambiguous}} There is a class of components, which have a central interface
%   \PSvar{P@C} which can be either transmittive or reflective,
%   depending on the previous and following component positions. The
%   mode of the \PSvar{P@C} is determined at the time of the beam
%   drawing and requires special attention.
%
%   \psargitem{\PSvar{correct}} If \opt{true}, the input vectors after
%   the transmittive interfaces are corrected when using
%   \opt{connectifc}.
% \end{psarglist}
%
% \begin{pssyntax}
%   \PSvar{[} \PSproc{x y} \PSproc{dx dy | rx ry} \PSvar{NAlow NAup} 
%   \PSvar{type} \PSproc{\ldots Ifc} 
%   \PSvar{\ldots{} [n] correct? amb? allowbeaminside? forcebeaminside?} 
%   \PSstring{CompName} \PSproc{scaling} \PSop{NewOptexpComp}
% \end{pssyntax}
%    \begin{macrocode}
/NewOptexpComp {
  (NewOptexpComp) DebugBegin
  /sc ED dup cvn
  gsave
  13 dict dup 3 1 roll def begin
  /name ED
  /forcebeaminside ED
  /allowbeaminside ED
  /ambiguous ED
  /grating false def
  dup type /booleantype eq not { false } if /correct ED
  tx@Dict begin
    STV {CP T} stopped pop
  end
  /CompMtrx CM def
  grestore
  counttomark dup 6 idiv dup /N ED 6 mul eq { 1 } if 
  cvx 1 EvalRefIndex /n ED
%    \end{macrocode}
% This defines for ambiguous components, which interface coincides with the
% ambiguous interface. 0 indicates that there is no ambiguous interface.
%    \begin{macrocode}
  ambiguous { 
    /ambIfc ED 
  }{ 
    /ambIfc 0 def 
  } ifelse
  1 N eq {
%    \end{macrocode}
% only a single plane is specified, create the aliases.
%    \begin{macrocode}
      name (1) 3 -1 roll {sc} NewCompIfc 
      (1) (2) IfcCopy
      (2) (N) IfcAlias
  }{
    N -1 1 { %
      inttostr exch name 3 1 roll {sc} NewCompIfc
    } for
    N inttostr (N) IfcAlias
  } ifelse
  ambiguous ambIfc 0 gt and { 
    ambIfc inttostr (C) IfcCopy
  } if
  end
  pop
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{NewOptexpFiberComp}
% \begin{pssyntax}
%   \PSvar{[} \PSvar{x y} \ldots
%   \PSstring{CompName} \PSproc{scaling} \PSop{NewOptexpFiberComp}
% \end{pssyntax}
%    \begin{macrocode}
/NewOptexpFiberComp {
  (NewOptexpFiberComp) DebugBegin
  /sc ED dup cvn
  gsave
  12 dict dup 3 1 roll def begin
  /name ED
  tx@Dict begin
    STV {CP T} stopped pop
  end
  /CompMtrx CM def
  grestore
  counttomark /N ED
  1 N eq {
%    \end{macrocode}
% only a single plane is specified, create the aliases.
%    \begin{macrocode}
    {0 1} 0 0 trans name (1) {PlainIfc} {sc} NewCompIfc 
    (1) (2) IfcCopy
    (2) (N) IfcAlias
  }{
    N -1 1 {
      inttostr
      {0 1} 0 0 absorb name 6 -1 roll {PlainIfc} {sc} NewCompIfc
    } for
    N inttostr (N) IfcAlias
  } ifelse
  end
  pop
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{IfcCopy}
%   Copy an interface \PSvar{from} to an interface \PSvar{to}, must be called
%   within the respective component dictionary. This involves also copying the
%   node associated with the interface.
%   \begin{pssyntax}
%     \PSvar{from} \PSvar{to} \PSop{CopyIfc}
%   \end{pssyntax}
%    \begin{macrocode}
/IfcCopy { 
  2 copy IfcName exch IfcName load dup
  length dict copy def
  name exch NodeName name 3 -1 roll NodeName 
  tx@NodeDict begin
    load dup length dict copy def
  end
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{IfcAlias}
%   Create an alias of an interface. This involves creating also an
%   alias for the associated node.  Must be called withing
%   \PSvar{NewOptexpComp}.
%
%   \begin{pssyntax}
%     \PSstring{OrigPN} \PSstring{AliasPN} \PSop{IfcAlias}
%   \end{pssyntax}
%    \begin{macrocode}
/IfcAlias {
  2 copy IfcName exch IfcName load def
  tx@NodeDict begin 
    name exch NodeName name 3 -1 roll NodeName load def
  end
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CompAlias}
%   Components which have a \opt{compname} assigned, must also be
%   available by their component number. Here, all necessary
%   informations (nodes, component dictionary) are referenced such that
%   any information is accessible via number or name. 
%   \begin{pssyntax}
%     \PSstring{NameStem} \PSstring{IDStem} \PSop{CompAlias}
%   \end{pssyntax}
%    \begin{macrocode}
/CompAlias {
%    \end{macrocode}
% Copy the component dictionary
%    \begin{macrocode}
  2 copy cvn dup currentdict exch known { 
    load def 
  } { 
    pop 
  } ifelse
  tx@NodeDict begin
%    \end{macrocode}
% Copy all interface nodes of the component.
%    \begin{macrocode}
  1 {
    3 copy inttostr dup 
    3 1 roll 2 copy NodeName
    currentdict exch known {
      NodeName load 3 1 roll NodeName ED
      1 add
    } {
      pop (N) NodeName load 3 1 roll 
      pop (N) NodeName ED
      pop exit
    } ifelse
  } loop
%    \end{macrocode}
% Copy all other nodes associated with the component (reference nodes, center
% node, label node etc).
%    \begin{macrocode}
  mark (A) (B) (@A) (@B) (Center) (Label) (Rotref) 
       (TrefA) (TrefB) (@TrefA) (@TrefB) (Ext) (Origin)
  counttomark {
    counttomark 3 add -2 roll 2 copy counttomark 1 add 2 roll
    3 -1 roll dup 4 1 roll NodeName dup 
    currentdict exch known { 
      load 3 1 roll exch NodeName ED 
    } { 
      pop pop pop 
    } ifelse
  } repeat pop 
%    \end{macrocode}
% Copy additional external nodes, the maximum is 8 (all combinations of
% l, r, t, b, c). Old and new node name stems are still on the stack.
%    \begin{macrocode}
  exch 1 1 8 {
    3 copy
    (Ext) exch 5 string cvs strcat dup 3 1 roll 
    NodeName 3 1 roll NodeName
    dup currentdict exch known {
      load def pop
    } {
      pop pop pop exit
    } ifelse
  } for
  pop pop
  end
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetPlaneVec}
%   Push the coordinates of the plane vector on the stack, for curved interfaces
%   this is the tangent at the interface node.
%   \begin{pssyntax}
%     \PSvar{IfcNum} \PSstring{CompName} \PSop{GetPlaneVec} \PSvar{dX dY}
%   \end{pssyntax}
%    \begin{macrocode}
/GetPlaneVec {
  (GetPlaneVec) DebugBegin
  cvn load begin
    IfcName load begin
      currentdict /RX known {
        RX RY CompMtrx dtransform CM idtransform
        neg exch
      } {
        DX DY CompMtrx dtransform CM idtransform
      } ifelse
    end
  end
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetIfcCenter}
% Get the center node of a interface, either by specifying the name of the component and the interface number
%   \begin{pssyntax}
%     \PSvar{IfcNum} \PSstring{CompName} \PSop{GetIfcCenter} \PSvar{X Y}
%   \end{pssyntax}
% or by passing an interface procedure generated by \PSvar{PushAllPlanesOnStack}.
%   \begin{pssyntax}
%     \PSproc{Ifc} \PSop{GetIfcCenter} \PSvar{X Y}
%   \end{pssyntax}
%    \begin{macrocode}
/GetIfcCenter {
  (GetIfcCenter) DebugBegin
  dup type /stringtype eq not {
    dup xcheck not {
%    \end{macrocode}
% ambiguous
%    \begin{macrocode}
      0 get (C) exch
    } {
      exec pop pop pop
    } ifelse
  } if
  cvn load begin
    IfcName load begin
      currentdict /RX known {
        X RX sub Y RY sub
      } {
        X Y
      } ifelse
      CompMtrx transform CM itransform
    end
  end
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GetIfcCenterCorr}
%   Get the coordinates of an interface node. This checks if corrected
%   coordinates for proper connection handling are available.
%   \begin{pssyntax}
%     \PSvar{IfcNum} \PSstring{CompName} \PSop{GetIfcCenterCorr} \PSvar{X|XCorr Y|YCorr}
%   \end{pssyntax}
%    \begin{macrocode}
/GetIfcCenterCorr {
  (GetIfcCenterCorr) DebugBegin
  cvn load begin
    IfcName load begin
      currentdict /XCorr known {
        XCorr YCorr
      }{
        X Y
      } ifelse
      currentdict /RX known {
        RX neg RY neg VecAdd
      } if
      CompMtrx transform CM itransform
    end
  end
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{TransformInVec}
%   Transform the input vector as specified with \opt{beamangle} and
%   \opt{beamdiv} from coordinates relative to the connection between first and
%   second components to absolute coordinates.
%   \begin{pssyntax}
%     \PSproc{Ifc2} \PSproc{Ifc1} \PSproc{InVec} \PSop{TransformInVec} \PSproc{InVec'}
%   \end{pssyntax}
%    \begin{macrocode}
/TransformInVec {
  (TransformInVec) DebugBegin
  3 1 roll
  GetIfcCenter 4 2 roll
  GetIfcCenter 5 -2 roll
  @ABVect
  3 -1 roll exec 2 copy 6 2 roll
  0 eq exch 0 eq and not {
%    \end{macrocode}
% invec != (0,0)
%    \begin{macrocode}
    exch atan matrix rotate dtransform
  } {
    4 2 roll pop pop
  } ifelse
  ToVec
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{TransformStartPos}
% Startpos is relative to the connection between first and second components
% transform to absolute coordinates and shift by first plane center
% Plane2 Plane1 \PSproc{StartPos} -> \PSproc{StartPos'+Plane1Center}
%    \begin{macrocode}
/TransformStartPos {
  (TransformStartPos) DebugBegin
  exec 2 copy 6 2 roll 0 eq exch 0 eq and not
  3 1 roll GetIfcCenter 4 2 roll
  GetIfcCenter 5 2 roll {
    2 copy 8 2 roll
    @ABVect exch atan matrix rotate dtransform
    VecAdd
  } {
    6 2 roll pop pop pop pop
  } ifelse
  ToVec
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetNearestPlane}
%   \begin{pssyntax}
%     \PSvar{X Y} \PSstring{CompName} \PSop{GetNearestPlane} \PSvar{PlaneNumber}
%   \end{pssyntax}
%    \begin{macrocode}
/GetNearestPlane {
  (GetNearestPlane) DebugBegin
  3 copy 1 exch GetIfcCenter @ABDist /dist ED /nearestPlane 1 def
  dup cvn load /N get 2 1 3 -1 roll {
%    \end{macrocode}
% iterate through plane 2 to plane N of CompName 
%    \begin{macrocode}
    4 copy exch GetIfcCenter @ABDist dup dist lt {
      /dist ED /nearestPlane ED
    } {
      pop pop
    } ifelse
  } for
  pop pop pop nearestPlane
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{PushAmbCompPlanesOnStack}
% Components which do not have an unambiguous behaviour (beamslitter, can
% transmit and reflect) like lenses (transmission only) or mirrors (reflection
% only), must be evaluated to see which mode should be used.  Argument is
% [(name) draw], draw is a boolean which is true if the inner beams should be
% drawn.
%    \begin{macrocode}
/PushAmbCompPlanesOnStack {
 (PushAmbCompPlanesOnStack) DebugBegin 
  currentdict /outToPlane undef
  PN IfcCnt eq not {
%    \end{macrocode}
% not the last component, there should be another one on the stack
%    \begin{macrocode}
    exch dup 3 1 roll % nextifc ambcomp nextifc
    dup xcheck not {
%    \end{macrocode}
% the next component is also ambiguous, use its center point as reference.
%    \begin{macrocode}
      0 get (C) exch
    } {
%    \end{macrocode}
% otherwise use the interface on the stack
%    \begin{macrocode}
      exec pop pop pop
    } ifelse
    [ 3 1 roll ] cvx /outToPlane ED
%    \end{macrocode}
% outToPlane is \PSproc{(PN) (compName)}
%    \begin{macrocode}
  } if
%    \end{macrocode}
% the old plane number, without counting the additional planes of the current ambcomp
%    \begin{macrocode}
  /IfcCntTmp IfcCnt def
%    \end{macrocode}
% Load some parameters from \opt{ambcomp}
%    \begin{macrocode}
  aload pop /draw ED /name ED
  name cvn load /N get dup /N ED
%    \end{macrocode}
% If the ambiguous component has only one interface, there exists no internal beam
%    \begin{macrocode}
  1 eq { /draw true def } if
%    \end{macrocode}
% \PSvar{CurrTmp} is the current point of the beam on the interface
% prior to the ambiguos component, \PSvar{CurrVecTmp} its outgoing
% vector. For wide beams, the lower ray is used. These vectors will be
% changed inside this procedure.
%    \begin{macrocode}
  currentdict /Curr known {
    /CurrTmp /Curr load def
    /CurrVecTmp /CurrVec load def
  } {
    /CurrTmp /CurrLow load def
    /CurrVecTmp /CurrVecLow load def
  } ifelse
  PN 1 eq {
%    \end{macrocode}
% If it is the first interface, the starting point is always the (C)
% plane, the mode is set arbitrarily to transmittive.
%    \begin{macrocode}
    [ (C) name name GetRefIndex trans draw] cvx
%    \end{macrocode}
% Now check which is the outgoing plane
%    \begin{macrocode}
    name /outToPlane load GetNextPlane
    dup 0 eq not {
%    \end{macrocode}
% If there is one, i.e. if \PSvar{GetNextPlane} leaves something not
% equal to \PSvar{0} on the stack, this is the plane.
%    \begin{macrocode}
      [ exch name bgRefIndex trans draw ] cvx exch
      /IfcCntTmp IfcCntTmp 1 add def
    } {
      pop
    } ifelse
  }{
%    \end{macrocode}
% It is not the first component, check which interface of the component
% is the nearest one to the current beam point and save its name in
% \PSvar{firstPlane}.
%    \begin{macrocode}
    CurrTmp name GetNearestPlane dup /firstPlane ED
    name isAmbiguousIfc not {
%    \end{macrocode}
% The first interface is not the ambiguous one, put it on the stack and
% calculated the new beam vector.
%    \begin{macrocode}
      firstPlane name
      name firstPlane GetIfcMode
      connectifc { bgRefIndex }{ name GetRefIndex } ifelse
      CurrTmp CurrVecTmp
      10 dict begin HandleInterface end pop 
      ToVec /CurrVecTmp ED ToVec /CurrTmp ED
      [ firstPlane name
      connectifc {
        bgRefIndex
      }{
        name GetRefIndex
      } ifelse
      name firstPlane GetIfcMode
%    \end{macrocode}
% always draw to first interface
%    \begin{macrocode}
      true ] cvx
      /IfcCntTmp IfcCntTmp 1 add def
    } if
    PN IfcCnt eq {
%    \end{macrocode}
% Its the last comp, just put the ambiguous interface on the stack, the mode is irrelevant.
%    \begin{macrocode}
      [ (C) name
      name GetRefIndex
      trans draw ] cvx
      IfcCntTmp IfcCnt gt { exch } if
    }{
%    \end{macrocode}
% Otherwise put the ambiguous interface on the stack and check its mode.
%    \begin{macrocode}
      beamdiffractionorder null eq not name cvn load /grating get and {
%    \end{macrocode}
% A grating (AOM) and a beamdiffractionorder was selected. In that case,
% \opt{beammode} has no effect, and for beamdiffractionorder=0 the
% interface is transmittive, otherwise refl or refltrans
%    \begin{macrocode}
        beamdiffractionorder dup 0 eq { pop () } if
        (C) exch 20 string cvs strcat 
        dup (P@) exch strcat cvn name cvn load exch known not {
%    \end{macrocode}
% The choosen beamdiffractionorder is not defined, select the closest one and issue a warning
%    \begin{macrocode}
          pop beamdiffractionorder dup sign neg 1 {
            (C) exch 5 string cvs dup 3 1 roll strcat 
            dup (P@) exch strcat cvn name cvn load exch known {
              3 -1 roll pop
              (Diffraction order ) beamdiffractionorder 5 string cvs strcat
              ( is not defined, using ) 4 -1 roll strcat strcat Warning
              exit
            } {
              pop
            } ifelse
          } for
        } if
        /@@centerifc ED
        mark @@centerifc name name GetRefIndex
        beamdiffractionorder 0 eq { 
          trans 
        }{ 
          name @@centerifc GetIfcMode refltrans eq {
            refltrans
          }{
            refl
          } ifelse
        } ifelse
      }{ 
        /@@centerifc (C) def
        [ @@centerifc name
        name GetRefIndex
        beammode auto eq {
          CurrVecTmp @@centerifc name GetPlaneVec 
          name @@centerifc GetIfcMode refltrans eq { -90 matrix rotate dtransform } if
          NormalVec outToPlane GetIfcCenter @@centerifc name GetIfcCenter @ABVect DotProd
          0 lt { 
            trans 
          }{ 
            name @@centerifc GetIfcMode 
            refltrans eq { 
              refltrans 
            }{ 
              refl 
            } ifelse 
          } ifelse
        } {
          beammode dup refl eq { 
%    \end{macrocode}
% in case, the ambiguous interface is refltrans
%    \begin{macrocode}
            pop name @@centerifc GetIfcMode dup refltrans eq not { pop refl } if
          } if
        } ifelse
      } ifelse
      dup 6 1 roll
%    \end{macrocode}
% if the ambiguous interface is the first, always draw to it
%    \begin{macrocode}
      IfcCntTmp IfcCnt eq { true }{ draw } ifelse
      ] cvx 
      @@centerifc name 4 -1 roll
      connectifc { bgRefIndex }{ name GetRefIndex } ifelse
      CurrTmp CurrVecTmp
      10 dict begin HandleInterface end pop
      ToVec /CurrVecTmp ED ToVec /CurrTmp ED
%    \end{macrocode}
% now check which is the outgoing plane
%    \begin{macrocode}
      name /outToPlane load GetNextPlane
      dup dup name isAmbiguousIfc exch 0 eq or not {
        [ exch name bgRefIndex trans draw ] cvx exch
        firstPlane name isAmbiguousIfc not { 3 -1 roll } if
        /IfcCntTmp IfcCntTmp 1 add def
      } {
        pop
%    \end{macrocode}
% The ambiguous interface is the last one, correct it to have the bgRefIndex.
%    \begin{macrocode}
        exec 3 -1 roll pop bgRefIndex 3 1 roll [ 6 1 roll ] cvx
        firstPlane name isAmbiguousIfc not { exch } if
      } ifelse
    } ifelse
  } ifelse
  /IfcCnt IfcCntTmp def
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetNextPlane}
% \PSstring{comp} \PSproc{outToPlane} \PSop{GetNextPlane} \PSvar{PlaneNumber}
%    \begin{macrocode}
/GetNextPlane {
  (GetNextPlane) DebugBegin
  2 copy (C) 3 -1 roll
  GetIfcCenter 3 -1 roll
  exec GetIfcCenter
  4 2 roll 4 copy @ABVect ToVec /Vec ED
  @ABDist /centerDist ED
  /sprod 1 def
  /nextPlane 0 def
  exch dup 3 1 roll
  cvn load dup /ambIfc get /ambIfc ED /N get 1 1 3 -1 roll {
%    \end{macrocode}
% iterate through all interfaces of CompName which do not coincide with the ambiguous interface
%    \begin{macrocode}
   dup ambIfc eq not {
      3 copy 3 -1 roll 2 copy
      GetPlaneVec Vec 4 2 roll NormalVec 
      Vec DotProd dup sprod lt 5 2 roll
      GetIfcCenter 3 -1 roll exec GetIfcCenter @ABDist 
      centerDist lt and
      centerDist -1 eq { pop dup 0 gt } if
      { /sprod ED /nextPlane ED } { pop pop } ifelse
    } {
      pop
    } ifelse
  } for
  pop pop nextPlane
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{TraceBeam}
% [ CompN ... Comp1 \PSproc{options} \PSproc{start point} \PSvar{beamangle}
% -> Yn Xn drawToN? ... Y1 X1 drawTo1? Y0 X0
%    \begin{macrocode}
/TraceBeam {
  (Tracebeam) DebugBegin
  AngToVec /InVec ED /StartPoint ED
  /oldbeaminsidelast currentdict /beaminsidelast known { 
    beaminsidelast 
  } { 
    false 
  } ifelse def
%    \end{macrocode}
% execute options
%    \begin{macrocode}
  exec
  connectifc {
    /nbeam bgRefIndex def
  } if
  /startinside startinside beaminsidefirst or def
  /stopinside stopinside beaminsidelast or def
  /PrevCorrect false def
  PrearrangePlanes
  PushAllPlanesOnStack
  currentdict /lastVecTmp known {
    lastVecTmp beamangle matrix rotate dtransform ToVec
  } {
    counttomark 2 ge beamalign relative eq and {
      2 copy /InVec load TransformInVec
    } {
      /InVec load
    } ifelse
  } ifelse
  /CurrVec ED
  currentdict /lastBeamPointTmp known {
    /lastBeamPointTmp load /Curr ED
  }{
    counttomark 2 ge {
      2 copy /StartPoint load  TransformStartPos 
    } {
      /StartPoint load 
    } ifelse
    /Curr ED
  } ifelse
  counttomark /IfcCnt ED 
%    \end{macrocode}
% Init the refractive index
%    \begin{macrocode}
  /n1 bgRefIndex def
  /PN 1 def
  (start looping) DebugMsg
  {
    PN IfcCnt gt {
      exit
    } if
    (checked) DebugMsg
    beampathcount 0 eq {
      cleartomark mark exit
    } if
%    \end{macrocode}
% iterate over all planes
%    \begin{macrocode}
    dup xcheck not {
%    \end{macrocode}
% array, not executable
%    \begin{macrocode}
      PushAmbCompPlanesOnStack
    } if
    exec
    /draw ED /Mode ED /n2 ED 2 copy /CompName ED /IfcNum ED
    GetIfcCenter ToVec /CurrCenter ED
    Curr CurrVec 
    connectifc PrevCorrect PN 2 gt and PN 2 eq or and {
      CurrVec CurrCenter PrevCenter PrevMode 
      currentdict /relAngle known 
      { relAngle } { 0 } ifelse connectInterfaces
      /relAngle ED
    } if
%    \end{macrocode}
% Adjust the alignment of a node interface, if it is to be aligned
% perpendicular to the beam vector (beamnodealign=vector).
%    \begin{macrocode}
    CompName cvn load begin 
      currentdict /adjustRel known aligntovector and {
        IfcNum IfcName load begin
          currentdict /RX known not {
%    \end{macrocode}
% Only exchange the coordinates of the beam vector, the sign is not
% important for the interface vector.
%    \begin{macrocode}
            2 copy neg exch CM dtransform CompMtrx idtransform
            /DY ED /DX ED
          } if
        end
      } if
    end
    IfcNum CompName Mode n2 8 4 roll HandleInterface
    missed eq {
      counttomark PN 1 sub 3 mul sub {pop} repeat
      (The beam missed an interface) Warning exit
      exit
    } if
    PN 1 eq {
      pop pop
      /draw beaminsidefirst oldbeaminsidelast xor def
    } {
      ToVec /CurrVec ED
    } ifelse
    2 copy
    ToVec /Curr ED 
    draw PN beampathskip 1 add gt and
    counttomark 3 roll
    /PrevCenter /CurrCenter load def
    /lastBeamPointTmp /Curr load def
    currentdict /lastVecTmp known {
      /prevVecTmp /lastVecTmp load def
      /lastVecTmp /CurrVec load def
    } {
      /CurrVec load dup /lastVecTmp ED /prevVecTmp ED
    } ifelse
    /PrevMode Mode def
    CompName cvn load /correct get /PrevCorrect ED
    PN IfcCnt eq {
      exit
    } {
      CurrVec 0 eq exch 0 eq and {
        IfcCnt PN sub {pop} repeat
        (Total internal reflection occured, this is not supported)
        Warning
        exit
      } if
      beampathcount 1 add PN eq {
        IfcCnt PN sub {pop} repeat
        exit
      } if
      /PN PN 1 add def
    } ifelse
  } loop
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% 
% \begin{macro}{sign}
%    \begin{macrocode}
/sign {
    0 ge { 1 } { -1 } ifelse
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Chirality}
%    \begin{macrocode}
/Chirality {
  4 -1 roll mul 3 1 roll mul sub sign
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{TraceInterfacePath}
%    \begin{macrocode}
/TraceInterfacePath {
  tx@IntersectDict begin
    /ArrowA { {currentpoint} stopped {moveto}{pop pop pop pop} ifelse } def
    {} TraceCurveOrPath 
    currentdict /ArrowA undef
  end
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{TraceAndFillWideBeam}
% Fill a wide beam. This has an own procedure, because each segment
% of the beam must be filled separately.
% \begin{pssyntax}
%   \PSvar{[} \PSstring{CompN} \PSvar{\ldots{}} \PSstring{Comp1}
%   \PSproc{options} \PSproc{start point up} \PSvar{beamangle\_up}
%   \PSproc{start point low} \PSvar{beamangle\_low} \PSop{FillWideBeam}
% \end{pssyntax}
%    \begin{macrocode}
/TraceAndFillWideBeam {
  (TraceAndFillWideBeam) DebugBegin
  AngToVec /InvecLow ED /StartLow ED 
  AngToVec /InvecUp ED /StartUp ED 
%    \end{macrocode}
% execute user options
%    \begin{macrocode}
  exec
  connectifc {
    /nbeam bgRefIndex def
  } if
  /startinside startinside beaminsidefirst or def
  /stopinside stopinside beaminsidelast or def
%    \end{macrocode}
% Number of segments already drawn
%    \begin{macrocode}
  /DrawnSegm 0 def
%    \end{macrocode}
% whether the previous plane required correction of the input vector (used only with \opt{connectifc})
%    \begin{macrocode}
  /PrevCorrect false def
  PrearrangePlanes
  PushAllPlanesOnStack
  currentdict /lastVecTmpUp known 
  currentdict /lastVecTmpLow known and {
    /CurrVecLow lastVecTmpLow beamangle matrix rotate dtransform ToVec def
    /CurrVecUp lastVecTmpUp beamangle matrix rotate dtransform ToVec def
  }{
%    \end{macrocode}
% If the \opt{beamangle} is not absolute, use the connection between the first
% two planes as reference and transform the input vectors accordingly.
%    \begin{macrocode}
    beamalign relative eq counttomark 2 ge and {
      2 copy /InvecLow load TransformInVec /CurrVecLow ED
      2 copy /InvecUp load TransformInVec /CurrVecUp ED
    } {
      /CurrVecLow /InvecLow load def
      /CurrVecUp /InvecUp load def
    } ifelse
  } ifelse
%    \end{macrocode}
% If \opt{loadbeampoints} is set, the nodes \PSname{lastBeamPointTmpLow} and
% \PSname{lastBeamPointTmpUp} are defined and used as starting points.
%    \begin{macrocode}
  currentdict /lastBeamPointTmpLow known 
  currentdict /lastBeamPointTmpUp known and {
    /lastBeamPointTmpLow load /CurrLow ED
    /lastBeamPointTmpUp load /CurrUp ED
%    \end{macrocode}
% The lower and upper beam vectors must possibly swapped if the
% intersection points are loaded from a previous beam, but the beam
% divergence is specified manually for this beam only. We must make
% sure, that negative divergence gives a contracting beam.
%    \begin{macrocode}
    loadbeam not beamdiv 0 eq not and {
      CurrVecLow CurrVecUp Chirality 
      CurrLow CurrUp @ABVect CurrVecLow CurrVecUp VecAdd Chirality 0 lt { neg } if
      beamdiv sign eq not {
        /CurrVecLow load /CurrVecUp load /CurrVecLow ED /CurrVecUp ED
      } if
    } if
  } {
%    \end{macrocode}
% Transform the beam vectors relative to the connection between the first two interfaces.
%    \begin{macrocode}
    counttomark 2 ge {
      2 copy /StartLow load TransformStartPos /CurrLow ED
      2 copy /StartUp load TransformStartPos /CurrUp ED
    } {
      /StartLow load /CurrLow ED
      /StartUp load /CurrUp ED
    } ifelse
  } ifelse
  /PrevVecUp /CurrVecUp load def
  /PrevVecLow /CurrVecLow load def
%    \end{macrocode}
% \PSvar{IfcCnt} is the number of interfaces pushed on the stack by
% \PSvar{PushAllPlanesOnStack}. This number may be corrected later if an
% ambiguous components is among them.
%    \begin{macrocode}
  counttomark /IfcCnt ED 
  /n1 bgRefIndex def
  /CurrR false def
  /CurrPath false def
  /CurrUpT false def
  /CurrLowT false def
  /ret missed def
  /PN 1 def
  {
    PN IfcCnt gt {
      exit
    } if
    beampathcount 0 eq {
      cleartomark mark exit
    } if
    dup xcheck not {
%    \end{macrocode}
% Found an array (not executable) instead of a procedure. This is an ambiguous
% component, resolve the interfaces depending on the input vector and
% surrounding interfaces. This can change \PSvar{IfcCnt}.
%    \begin{macrocode}
      PushAmbCompPlanesOnStack
    } if
%    \end{macrocode}
% push the interface on the stack
%    \begin{macrocode}
    exec
%    \end{macrocode}
% \PSvar{draw} indicates if the beam to the current interface should be drawn.
%    \begin{macrocode}
    PN beampathskip 1 add gt and /draw ED
%    \end{macrocode}
% \PSvar{Mode} stores the mode (transmittive or reflective) of the current interface.
%    \begin{macrocode}
    /Mode ED /n2 ED 2 copy /CompName ED /IfcNum ED
%    \end{macrocode}
% \PSvar{CurrPCenter} holds the coordinates of the current interface center.
%    \begin{macrocode}
    GetIfcCenter ToVec /CurrPCenter ED
    /oldn1 n1 def
%    \end{macrocode}
% Adjust the alignment of a node interface, if it is to be aligned
% perpendicular to the beam vector (beamnodealign=vector). The alignment
% is carried out with the median vector of upper and lower beam.
%    \begin{macrocode}
    CompName cvn load /adjustRel known aligntovector and {
      connectifc PrevCorrect PN 2 gt and PN 2 eq or and {
        CurrVecUp CurrVecUp CurrPCenter PrevPCenter PrevMode 
        currentdict /relAngleUp known { relAngleUp } { 0 } ifelse 
        connectInterfaces pop
        CurrVecLow CurrVecLow CurrPCenter PrevPCenter PrevMode 
        currentdict /relAngleLow known { relAngleLow } { 0 } ifelse 
        connectInterfaces pop
      } {
        CurrVecUp CurrVecLow
      } ifelse
      VecAdd NormalizeVec
      CompName cvn load begin
        IfcNum IfcName load begin
          currentdict /RX known not {
            CM dtransform CompMtrx idtransform
            /DX ED neg /DY ED
          } {
            pop pop
          } ifelse
        end
      end
    } if
%    \end{macrocode}
% Calculate new upper vector and intersection point
%    \begin{macrocode}
    CurrUp CurrVecUp
    connectifc PrevCorrect PN 2 gt and PN 2 eq or and {
      CurrVecUp CurrPCenter PrevPCenter PrevMode 
      currentdict /relAngleUp known { relAngleUp } { 0 } ifelse 
      connectInterfaces /relAngleUp ED
    } if
    /PrevUp /CurrUp load def
    /PrevUpT /CurrUpT load def
    /PrevPath /CurrPath load def
    IfcNum CompName Mode n2 8 4 roll HandleInterface
    dup /ret ED
    missed eq {
      counttomark {pop} repeat 
      (The upper beam missed an interface) Warning exit
    } if
    ToVec /CurrVecUp ED
    ToVec /CurrUp ED
    currentdict /isectT known currentdict /isectPath known and { 
      /CurrUpT isectT def 
      /CurrPath isectPath def
    } if
    /n1 oldn1 def
%    \end{macrocode}
% Calculate new lower vector and intersection point
%    \begin{macrocode}
    /PrevLow /CurrLow load def
    /PrevLowT /CurrLowT load def
    CurrLow CurrVecLow
    connectifc PrevCorrect PN 2 gt and PN 2 eq or and  {
      CurrVecLow CurrPCenter PrevPCenter PrevMode 
      currentdict /relAngleLow known { relAngleLow } { 0 } ifelse 
      connectInterfaces /relAngleLow ED
    } if
    IfcNum CompName Mode n2 8 4 roll HandleInterface
    dup missed eq {
      /ret ED
      (The lower beam missed an interface) Warning
      counttomark {pop} repeat exit
    } if
    tir eq ret tir eq or {
      /ret tir def
    } {
      /ret ok def
    } ifelse
    ToVec /CurrVecLow ED
    ToVec /CurrLow ED
%    \end{macrocode}
% lower done
%    \begin{macrocode}
    currentdict /isectT known {
      /CurrLowT isectT def
    } if
    /PrevR CurrR def
    PrevR type /realtype eq {
      /CurrCenter load /PrevCenter ED
    } if
    IfcNum CompName isCurvedIfc {
      IfcNum CompName LoadIfc
      tx@Dict begin Pyth end /CurrR ED
      ToVec /CurrCenter ED
    } {
      /CurrR false def
      /CurrCenter false def
    } ifelse
    IfcNum CompName isPathIfc not {
      /CurrPath false def
      /CurrLowT false def
      /CurrUpT false def
    } if
    PN 1 gt currentdict /fillBeam known and {
      draw {
        /DrawnSegm DrawnSegm 1 add def
        PrevUp moveto CurrUp lineto
        IfcNum CompName isCurvedIfc {
          CurrCenter CurrUp CurrLow 
          4 copy 3 -1 roll eq 3 1 roll eq and {
            6 {pop} repeat
          } {
            TangentCrosspoint
            CurrLow CurrR arct
          } ifelse
        } {
          IfcNum CompName isPathIfc {
            CurrPath CurrUpT CurrLowT TraceInterfacePath
          } {
            CurrLow lineto
          } ifelse
        } ifelse
        PrevLow lineto
        PrevPath type /booleantype eq not {
          PrevPath PrevLowT PrevUpT TraceInterfacePath
        } {
          PrevR type /booleantype eq not {
            PrevCenter PrevLow PrevUp
            4 copy 3 -1 roll eq 3 1 roll eq and {
              6 {pop} repeat
            } {
              TangentCrosspoint
              PrevUp PrevR arct
            } ifelse
          } {
            PrevUp lineto
          } ifelse
        } ifelse
      } if
      Mode refl eq draw and
      draw not DrawnSegm 0 gt and or {
        fillBeam newpath
        /DrawnSegm 0 def
      } if
    } if
    PN 1 eq {
%    \end{macrocode}
% At the first interface, we only determine the actual intersection
% points with the interfaces, the beam vectors are not changed and must
% be reset to the previous values.
%    \begin{macrocode}
      /CurrVecUp /PrevVecUp load def
      /CurrVecLow /PrevVecLow load def
    } if
%    \end{macrocode}
% If the beam should also be stroked, push the coordinates and the 'draw' information on the stack
%    \begin{macrocode}
    strokeBeam {
      CurrUp draw CurrLow draw counttomark 1 add 6 roll
    } if
    PN IfcCnt eq ret tir eq or 
    beampathcount 1 add PN eq or {
      DrawnSegm 0 gt currentdict /fillBeam known and { 
        fillBeam newpath 
        /DrawnSegm 0 def
      } if
      IfcCnt PN sub {pop} repeat
      ret tir eq {
        (Total internal reflection occured, this is not supported) 
        Warning
      } if
      exit
    } if
    /PN PN 1 add def
    /PrevVecUp /CurrVecUp load def
    /PrevVecLow /CurrVecLow load def
    /PrevPCenter /CurrPCenter load def
    /PrevMode Mode def
    CompName cvn load /correct get /PrevCorrect ED
  } loop
  DrawnSegm 0 gt currentdict /fillBeam known and {
    fillBeam newpath
    /DrawnSegm 0 def
  } if
  ret missed eq not {
%    \end{macrocode}
% Check if Up and Low must be swapped for next beam. This depends both
% on the relative orientation (chirality) of the incoming beam vector
% and the vector between the two intersection points CurrUp and CurrLow,
% and the direction of the beam vector.
%
% The intersection points are swapped if the angle of the beam vector is
% between $90°+\epsilon$ and $-90°+\epsilon$ and the chirality is
% positive, or if the beam vector points to the right, positive
% half-circle and the chirality is negative. The $\epsilon$ is
% introduced to get the correct order for $\pm 90°$ despite numerical
% errors.
%    \begin{macrocode}
    CurrLow CurrUp @ABVect % from Low to Up
    PrevVecUp PrevVecLow VecAdd
    2 copy 6 2 roll
    Chirality 0 lt
    3 1 roll 2 copy pop -1e-5 lt
    3 1 roll exch 1e-5 lt exch 0 lt and or xor {
%    \end{macrocode}
% swap upper and lower beam points for next beam
%    \begin{macrocode}
      /lastBeamPointTmpUp /CurrLow load def
      /lastBeamPointTmpLow /CurrUp load def
      /lastVecTmpUp /CurrVecLow load def
      /lastVecTmpLow /CurrVecUp load def
    } {
      /lastBeamPointTmpLow /CurrLow load def
      /lastBeamPointTmpUp /CurrUp load def
      /lastVecTmpUp /CurrVecUp load def
      /lastVecTmpLow /CurrVecLow load def
    } ifelse
    /lastVecTmpUp load /lastVecTmpLow load
    /prevVecLow ED /prevVecUp ED
  } if
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{DrawbeamPrepare}
%   Prepare the data points for drawing with \PSop{DrawbeamSimple} and
%   \PSop{DrawbeamArrowInside}.
%    \begin{macrocode}
/DrawbeamPrepare {
%    \end{macrocode}
% Remove trailing empty line parts.
%    \begin{macrocode}
  { 
    counttomark 6 le { exit } if
    3 index not { pop pop pop }{ exit } ifelse
  } loop
%    \end{macrocode}
% Remove heading empty line parts. Note, that the first point must not have
% 'draw = true', because it is the starting point which we have to move to.
%    \begin{macrocode}
  { 
    counttomark 3 le { exit } if
    counttomark 3 sub index not {
      counttomark -3 roll pop pop pop
    }{
      exit
    } ifelse
  } loop
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{DrawbeamSimple}
%    \begin{macrocode}
/DrawbeamSimple {
  pop 5 copy 3 -1 roll pop 
  ArrowA pop pop pop pop
  counttomark 3 idiv -1 2 {
    pop {
      lineto
    }{
      moveto
    } ifelse
  } for
  {CP 4 2 roll ArrowB lineto pop pop } {moveto} ifelse
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{DrawbeamArrowInside}
% This is the /Line definition from \opt{pstricks-add}, adapted to the beam path
% structure which includes the boolean values to indicate if a line is drawn, or
% if we use moveto. There was no way to patch the original definition to account
% for the moveto parts and avoid duplicating the code.
%    \begin{macrocode}
/DrawbeamArrowInside {
  6 copy pop
  /y1 ED /x1 ED pop /y2 ED /x2 ED
  /Alpha y2 y1 sub x2 x1 sub Atan def
  pop 3 -1 roll 5 1 roll 
  ArrowA 
%    \end{macrocode}
% dx add, and dy add, to get the current point at the end of the arrow tip.
%    \begin{macrocode}
  x1 Alpha cos arrowlength mul add
  y1 Alpha sin arrowlength mul add
  5 -1 roll 3 1 roll true
  /N N 1 sub def
  N {
    6 copy pop 
    /y1 ED /x1 ED pop /y2 ED /x2 ED /draw ED
%    \end{macrocode}
% Check for line segment length and draw the arrow only, if the segment is long
% enough. This is in first place to avoid drawing an inside arrow for the
% pinhole which has three interfaces instead of one so that it can be used as
% real spatial filter.
%    \begin{macrocode}
    x1 y1 x2 y2 @ABDist dup
    arrowminlength ge 
    exch arrowmaxlength dup 0 lt 
    3 1 roll le or and {
      x1 y1
      arrowpos 1 gt {
        /Alpha y2 y1 sub x2 x1 sub Atan def
        /dArrowPos dArrowPosStart abs def
        /ArrowPos ArrowPosStart def
        arrowno {
          /ArrowPos ArrowPos dArrowPos add def
          x1 Alpha cos ArrowPos mul add
          y1 Alpha sin ArrowPos mul add
          6 index { ArrowInside } if
          pop pop
        } repeat
      }{
        arrowno 1 gt { 
          1.0 arrowno 1.0 add div
        }{
          dArrowPosStart
        } ifelse /dArrowPos ED
        /ArrowPos ArrowPosStart def
        arrowno {
          /ArrowPos ArrowPos dArrowPos add def
          x2 x1 sub ArrowPos mul x1 add
          y2 y1 sub ArrowPos mul y1 add
          6 index { ArrowInside } if
          pop pop
        } repeat
      } ifelse
      pop pop
    } if
    draw {Lineto}{moveto} ifelse
  } repeat
  {CP 4 2 roll ArrowB lineto pop pop } {moveto} ifelse
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{isAmbiguous}
%   Check if \PSvar{compname} is ambiguous, i.e. if it can have alternating beam
%   paths depending on the input and output plane (e.g. beamsplitter can either
%   transmit or reflect a beam).
%   \begin{pssyntax}
%     \PSstring{compname} \PSop{isAmbiguous} \PSvar{boolean}
%   \end{pssyntax}
%    \begin{macrocode}
/isAmbiguous { 
  cvn load dup /ambiguous known {
    /ambiguous get
  } { 
    pop false
  } ifelse
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{isAmbiguousIfc}
%   Check if interface \PSvar{IfcNum} is the ambiguous interface of \PSvar{compname}.
%   \begin{pssyntax}
%     \PSvar{IfcNum} \PSstring{compname} \PSop{isAmbiguousIfc} \PSvar{boolean}
%   \end{pssyntax}
%    \begin{macrocode}
/isAmbiguousIfc { 
  cvn load dup /ambiguous known {
    /ambIfc get eq
  } { 
    pop pop false
  } ifelse
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{isCurvedIfc}
%  Check if interface \PSvar{IfcNum} of componente \PSvar{compname} is curved.
%   \begin{pssyntax}
%     \PSvar{IfcNum} \PSstring{compname} \PSop{isCurvedIfc} \PSvar{bool}
%   \end{pssyntax}
%    \begin{macrocode}
/isCurvedIfc {
  cvn load begin
    IfcName load /RX known
  end
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{isPathIfc}
%  Check if interface \PSvar{IfcNum} of componente \PSvar{compname} is an arbitrary path.
%   \begin{pssyntax}
%     \PSvar{IfcNum} \PSstring{compname} \PSop{isPathIfc} \PSvar{bool}
%   \end{pssyntax}
%    \begin{macrocode}
/isPathIfc {
  cvn load begin
    IfcName load /Path known
  end
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{HandleInterface}
% \begin{pssyntax}
% \PSvar{IfcNum} \PSstring{CompName} \PSvar{mode n2 X0 Y0 Xin Yin} 
% \PSop{HandleInterface} 
% \PSvar{X0' Y0' Xout Yout status}
% \end{pssyntax}
%    \begin{macrocode}
/HandleInterface {
  (HandleInterface) DebugBegin
  /Yin ED /Xin ED /Y0 ED /X0 ED /n2 ED /mode ED
  currentdict /isectT undef currentdict /isectPath undef
  2 copy 2 copy LoadIfc % IfcNum name IfcNum name path
  dup type /arraytype eq { % is an path interface
    dup /isectPath exch def
    3 1 roll pop pop PathInterface % IfcNum name t X0' Y0' Xout Yout status
    dup missed eq not { 6 -1 roll /isectT exch def } if
  } {
    6 -2 roll 
    isCurvedIfc { CurvedInterface }{ PlainInterface } ifelse
  } ifelse
%    \end{macrocode}
% IfcNum CompName X0' Y0' Xout Yout status
%
% Check if X0' Y0' are within the numerical aperture of the interface
%    \begin{macrocode}
  dup missed eq not useNA connectifc not and and {
    7 3 roll 2 copy 9 2 roll
    4 2 roll 2 copy
    %% X0' Y0' Xout Yout status X0' Y0' IfcNum CompName IfcNum CompName
    cvn load begin IfcName load dup /NAlow get exch /NAup get end
    2 copy lt {
      4 2 roll 2 copy LoadIfc NormalizeVec
      6 -2 roll isCurvedIfc {
        neg exch
      } if
      %% ... X0' Y0' NAlow NAup X Y dXp dYp
      8 -2 roll 6 -2 roll
      %% ... NAlow NAup dXp dYp X0' Y0' X Y
      @ABVect DotProd
      dup 4 -1 roll ge 3 1 roll ge and not 
      {
        pop missed
      } if
    }{
      6 {pop} repeat
    } ifelse
  } {
    7 -2 roll pop pop
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{LoadIfc}
% \begin{pssyntax}
% \PSvar{IfcNum} \PSstring{CompName} \PSop{LoadIfc} \PSvar{X Y} \PSvar{dX|RY dY|RY}
% \end{pssyntax}
%    \begin{macrocode}
/LoadIfc {
  (LoadIfc) DebugBegin
  cvn load begin
    IfcName load begin
      currentdict /Path known {
        Path TransformPath
      } {
        X Y
        CompMtrx transform CM itransform
        currentdict /RX known { RX RY }{ DX DY } ifelse
        CompMtrx dtransform CM idtransform
      } ifelse
    end
  end
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{isFreeray}
%   Check if \PSvar{compname} is a free-ray componente by checking if there is a
%   refractive index associated with it.
%   \begin{pssyntax}
%     \PSstring{compname} \PSop{isFreeray} \PSvar{boolean}
%   \end{pssyntax}
%    \begin{macrocode}
/isFreeray { 
  cvn load /n known 
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{/compIsKnown}
% Check if a component is known.
%    \begin{macrocode}
/compIsKnown {
  dup type /stringtype eq { cvn } if
  tx@OptexpDict exch known
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{PrearrangePlanes}
%   \begin{pssyntax}
%     \PSvar{[} \PSstring{CompN} \PSvar{\ldots} \PSvar{Comp1} \PSop{PrearrangePlanes}\\
%     \PSvar{[} \PSvar{desc|asc} \PSstring{CompN} \PSvar{\ldots} \PSvar{desc|asc} \PSstring{Comp1}
%   \end{pssyntax}
%    \begin{macrocode}
/PrearrangePlanes {
  (PrearrangePlanes) DebugBegin
  counttomark dup 2 lt {
    dup 0 eq { 
      (Found no component on stack, drawing no beam) PrintWarning
    }{
%    \end{macrocode}
% Only one component, draw always in ascending order. We must still
% check in /PushAllPlanesOnStack if the component has only one
% interface.
%    \begin{macrocode}
      exch dup
      compIsKnown {
        dup isFreeray {
          asc exch 3 -1 roll
        }{
          OneFiberCompWarning
          pop
        } ifelse
      }{
        CompUnknownWarning
      } ifelse
    } ifelse
    /N 0 def
  }{
%    \end{macrocode}
% We have a minimum of two components on stack
%    \begin{macrocode}
    /N ED
    /CompA ED dup /CompB ED
%    \end{macrocode}
% Check, if the components have been defined
%    \begin{macrocode}
    CompA compIsKnown CompB compIsKnown and {
      CompA isFreeray {
        CompA isAmbiguous {
          amb dup CompA
        } {
          CompB isAmbiguous {
            1 CompA GetIfcCenter (C) CompB GetIfcCenter @ABDist
            (N) CompA GetIfcCenter (C) CompB GetIfcCenter @ABDist
          } {
            1 CompA GetIfcCenter 
            1 CompB GetIfcCenter 
            (N) CompB GetIfcCenter 
            true OrderNodes exch pop
            (N) CompA GetIfcCenter 
            1 CompB GetIfcCenter 
            (N) CompB GetIfcCenter 
            true OrderNodes exch pop
          } ifelse
          le { desc } { asc } ifelse dup CompA
        } ifelse
        counttomark 2 roll
      }{
        FiberCompWarning
        counttomark 1 sub { pop } repeat
        /N 0 def
      } ifelse
    }{
%    \end{macrocode}
% One of the first two components was not defined, do not draw any beam
%    \begin{macrocode}
      /N 0 def
      CompA compIsKnown not {CompA}{CompB} ifelse
      CompUnknownWarning
    } ifelse
  } ifelse
  2 1 N {
    /i ED exch /CompB ED
    CompB compIsKnown not {
      counttomark i 1 sub 2 mul 1 add sub { pop } repeat
      CompB CompUnknownWarning
      exit
    } if
    CompB isFreeray not {
      counttomark i 1 sub 2 mul 1 add sub { pop } repeat
      FiberCompWarning
      exit
    } if
    CompB isAmbiguous not {
      dup desc eq { 1 } { dup amb eq { (C) }{ (N) } ifelse } ifelse 
      CompA GetIfcCenter
      1 CompB GetIfcCenter
      (N) CompB GetIfcCenter false OrderNodes dup dup
%    \end{macrocode}
% check if we have a NodeIfc
%    \begin{macrocode}
      4 -1 roll CompA exch 5 -1 roll CompB exch
      i 2 eq {
%    \end{macrocode}
% check also the first plane
%    \begin{macrocode}
        4 copy 4 2 roll AdjustRelRot
      } if
      AdjustRelRot
    } {
%    \end{macrocode}
% check if the first plane is an NodeIfc and correct its rotation, the
% node ordering in CompA is irrelevant at this point, so we use desc.
%    \begin{macrocode}
      i 2 eq {
        CompB amb CompA desc AdjustRelRot
      } if
      pop amb dup
    } ifelse
    CompB /CompA CompB def
    counttomark 2 roll
  } for pop
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{AdjustRelRot}
%   Adjusts the relative orientation of \PSstring{CompB} based on the
%   relative connection between \PSstring{CompA} and
%   \PSstring{CompB}. This is only done for ``node interfaces'', which
%   are created automatically when drawing beams through nodes.
%   \begin{pssyntax}
%     \PSstring{CompA} \PSvar{desc|asc} \PSstring{CompB} \PSvar{desc|asc} \PSop{AdjustRelRot}
%   \end{pssyntax}
%    \begin{macrocode}
/AdjustRelRot {
  (AdjustRelRot) DebugBegin
  exch dup cvn load /adjustRel known aligntovector not and {
    dup dup 4 2 roll isAmbiguous { 
      exch pop (C)
    }{ 
      desc eq { (N) }{ 1 } ifelse 
    } ifelse 
    exch GetIfcCenter 5 3 roll
    exch dup 3 1 roll isAmbiguous { 
      pop (C)
    }{ 
      desc eq { 1 }{ (N) } ifelse 
    } ifelse 
    exch GetIfcCenter
    @ABVect exch atan exch
    cvn load begin
      adjustRel {
        matrix rotate CompMtrx matrix concatmatrix /CompMtrx ED
        /adjustRel false def
      } {
        pop
      } ifelse
    end
  } {
    pop pop pop pop
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{PushAllPlanesOnStack}
%   \begin{pssyntax}
%     \PSvar{[} \PSvar{desc|asc} \PSstring{CompN} \PSvar{\ldots} \PSvar{desc|asc} \PSstring{Comp1} 
%     \PSop{PushAllPlanesOnStack}
%     \PSvar{[} \PSproc{PN \PSstring{CompName} n mode draw?} \PSvar{\ldots{}}
%   \end{pssyntax}
%   \begin{psarglist}
%     \psargitem{PN} The number of the plane of the component \PSstring{CompNameN}, can be an integer or a string.
%     \psargitem{CompName} The name of the component which the interface \PSvar{PN} belongs to.
%     \psargitem{n} The refractive index after the respective interface.
%     \psargitem{mode} Specifies if the interface is transmittive (\PSvar{trans}) or reflective (\PSvar{refl}).
%     \psargitem{draw?} Specifies if the connection to this interface should be drawn or if the current point is only moved.
%   \end{psarglist}
%    \begin{macrocode}
/PushAllPlanesOnStack {
  (PushAllPlanesOnStack) DebugBegin
  counttomark 2 div cvi /@N ED
  1 1 @N {
%    \end{macrocode}
% iterate over all components
%    \begin{macrocode}
    /last false def
    /first false def
    dup 1 eq {
      /first true def pop beaminsidefirst
    } {
      @N eq {
        beaminsidelast
        /last true def
      } {
        beaminside
      } ifelse
    } ifelse 
    exch load dup dup 
    /forcebeaminside get {
      3 -1 roll pop true
    } {
      dup /allowbeaminside get 4 -1 roll and 
    } ifelse
    /drawinside ED
    /ambiguous get {
      /name get drawinside [ 3 1 roll ]
      counttomark 1 roll pop
    } {
      begin
%    \end{macrocode}
% Start of the component dict.
%    \begin{macrocode}
        desc eq {
          N N -1 1 1
        } {
          1 1 1 N N
        } ifelse
        first {
          startinside not {
%    \end{macrocode}
% first comp and we do not start inside
%    \begin{macrocode}
            5 -2 roll
            pop pop
            2 copy 5 2 roll
          } {
            startinsidecount 0 gt N startinsidecount sub 1 gt and {
%    \end{macrocode}
% we do not use all segments of the first component
%    \begin{macrocode}
              3 -1 roll dup 4 1 roll
              N 1 sub startinsidecount sub mul
              6 -2 roll pop add dup 5 2 roll
            } if
          } ifelse
        } if
        last stopinsidecount 0 gt N stopinsidecount sub 1 gt and and {
          % 1 1 1 N N
          3 -1 roll dup 4 1 roll stopinsidecount mul
          6 -1 roll dup 7 1 roll add 3 1 roll pop pop dup
        } if
        5 1 roll
        {
%    \end{macrocode}
% iterate over all planes
%    \begin{macrocode}
          3 1 roll 2 copy 5 -1 roll
          dup 3 1 roll
          eq first not and {
%    \end{macrocode}
% always draw the line to the first plane of a component
%    \begin{macrocode}
            true
          } {
%    \end{macrocode}
% the other beams depend on some options
%    \begin{macrocode}
            drawinside
          } ifelse
          exch dup 4 -1 roll eq {
%    \end{macrocode}
% after the last component plane we have always air
%    \begin{macrocode}
            bgRefIndex
          }{
%    \end{macrocode}
% otherwise the respective refractive index of the component
%    \begin{macrocode}
            name GetRefIndex
          } ifelse
          exch inttostr exch
          3 1 roll name
          4 1 roll
          dup IfcName load /mode get
          3 1 roll 5 1 roll
          [ 6 1 roll ] cvx counttomark 1 roll
          last {
            savebeampoints 1 ge stopinside not and
            savebeampoints 1 lt beaminsidelast not and or {
              exit
            } if
          } if
        } for pop pop
      end
    } ifelse
  } for
  DebugEnd
  counttomark 1 eq { pop } if
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{IfcName}
% Construct the interface name from \PSvar{num}.
% \begin{pssyntax}
% \PSvar{num} \PSop{IfcName} \PSname{P@num}
% \end{pssyntax}
%    \begin{macrocode}
/IfcName {
  inttostr (P@) exch strcat cvn
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetIfcMode}
%   \begin{pssyntax}
%     \PSstring{name} \PSvar{num} \PSop{GetIfcMode} \PSvar{mode}
%   \end{pssyntax}
%    \begin{macrocode}
/GetIfcMode {
  exch cvn load begin
    IfcName load /mode get
  end
} bind def
%    \end{macrocode}
% \end{macro}
% \begin{macro}{NodeName}
% Construct the node name from a string or number.
% \begin{pssyntax}
% \PSstring{name} \PSvar{num} \PSop{NodeName} \PSname{N@namenum}
% \end{pssyntax}
%    \begin{macrocode}
/NodeName {
  dup /stringtype eq not { inttostr } if
  strcat (N@) exch strcat cvn
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{OrderNodes}
%   Check if node (\PSvar{XB1}, \PSvar{YB1}) or (\PSvar{XBN}, \PSvar{YBN}) is nearer to node (\PSvar{XA}, \PSvar{YA}). If it
%   \PSvar{B1} is nearer, push \PSvar{asc} on the stack, otherwise
%   \PSvar{desc}. If \PSvar{calcDist} is \opt{true} it leaves also the actual
%   smallest distance on the stack.
%   \begin{pssyntax}
%     \PSvar{XA YA XB1 YB1 XBN YBN calcDist} \PSop{OrderNodes} \PSvar{desc|asc} \PSvar{distance}
%   \end{pssyntax}
%    \begin{macrocode}
/OrderNodes {
   7 1 roll 6 -2 roll 2 copy 8 2 roll
   @ABDist 5 1 roll @ABDist 2 copy gt {
       pop asc exch
   } {
       exch pop desc exch
   } ifelse
   3 -1 roll not {
       pop
   } if
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{NormalVec}
%   Construct a normal vector $\vec{n}$ to the plane such that its
%   scalar product with the incomping wave vector $\vec{v}_\text{in}$ is
%   negative: $\vec{n}\cdot (-\vec{v}_\text{in}) > 0$.
%   \begin{pssyntax}
%     \PSvar{Xin Yin Xplane Yplane} \PSop{NormalVec} \PSvar{Xnorm Ynorm}
%   \end{pssyntax}
%    \begin{macrocode}
/NormalVec {
  neg exch 2 copy 6 2 roll DotProd 0 gt {
    -1 mul exch -1 mul exch
  } if
  NormalizeVec
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{DotProd}
% Scalar product between two vectors.
% \begin{pssyntax}
%   \PSvar{Xa Ya Xb Yb} \PSop{DotProd} \PSvar{val}
% \end{pssyntax}
%    \begin{macrocode}
/DotProd {
    3 -1 roll mul 3 1 roll mul add
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{VecAngle}
% Angle between two vectors $\cos(\alpha) = \frac{ab}{|a||b|}$
% \begin{pssyntax}
%   \PSvar{Xa Ya Xb Yb} \PSop{VecAngle} \PSvar{angle}
% \end{pssyntax}
%    \begin{macrocode}
/VecAngle {
  4 copy 4 copy DotProd 5 1 roll 
  tx@Dict begin 
    Pyth 3 1 roll Pyth 
  end mul 
  div Acos
  5 2 roll mul 4 1 roll 3 -1 roll mul 3 -1 roll sub 
  0 le { -1 }{ 1 } ifelse mul
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{VecAdd}
% Addition of two vectors.
% \begin{pssyntax}
%   \PSvar{Xa Ya Xb Yb} \PSop{VecAdd} \PSvar{Xa+Xb Ya+Yb}
% \end{pssyntax}
%    \begin{macrocode}
/VecAdd {
    3 -1 roll add 3 1 roll add exch
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{VecSub}
% Subtraction of two vectors.
% \begin{pssyntax}
%   \PSvar{Xa Ya Xb Yb} \PSop{VecSub} \PSvar{Xa-Xb Ya-Yb}
% \end{pssyntax}
%    \begin{macrocode}
/VecSub {
    neg 3 -1 roll add 3 1 roll neg add exch
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{VecScale}
% Scale a vector by a factor \PSvar{fac}.
% \begin{pssyntax}
%   \PSvar{Xa Ya fac} \PSop{VecScale} \PSvar{fac}$\cdot$\PSvar{Xa} \PSvar{fac}$\cdot$\PSvar{Ya}
% \end{pssyntax}
%    \begin{macrocode}
/VecScale {
  dup 4 -1 roll mul 3 1 roll mul
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{ToVec}
%   Convert two numbers to a procedure holding the two values. This
%   representation is used to save coordinate values of nodes and vectors.
%   \begin{pssyntax}
%     \PSvar{X Y} \PSop{ToVec} \PSproc{X Y}
%   \end{pssyntax}
%    \begin{macrocode}
/ToVec {
    ToPnt cvx
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{ToPnt}
%   Convert two numbers to an array holding the two values.
%   \begin{pssyntax}
%     \PSvar{X Y} \PSop{ToPnt} \PSarray{X Y}
%   \end{pssyntax}
%    \begin{macrocode}
/ToPnt {
    [ 3 1 roll ]
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{AngToVec}
%   Convert an angle to the related vector representation (normalized). The
%   angle is with respect to the positive $x$-axis.
% \begin{pssyntax}
%   \PSvar{angle} \PSop{AngToVec} \PSproc{X Y}
%   \end{pssyntax}
%    \begin{macrocode}
/AngToVec {
    dup cos exch sin ToVec
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{NormalizeVec}
% Normalize a vector ($X'^2 + Y'^2 = 1$)
% \begin{pssyntax}
%   \PSvar{X Y} \PSop{NormalizeVec} \PSvar{X' Y'}
% \end{pssyntax}
%    \begin{macrocode}
/NormalizeVec {
  2 copy
  tx@Dict begin
    Pyth
  end
  dup 3 1 roll div 3 1 roll div exch
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{@ABVect}
% Vector from (Xb,Yb) to (Xa,Ya)
% \begin{pssyntax}
%   \PSvar{Xa Ya Xb Yb} \PSop{@ABVect} \PSvar{(Ya - Yb) (Xa - Xb)}
% \end{pssyntax}
%    \begin{macrocode}
/@ABVect { 
  3 -1 roll exch sub 3 1 roll sub exch
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{@ABDist}
% \begin{pssyntax}
%   \PSvar{Xa Ya Xb Yb} \PSop{@ABDist} \PSvar{dist}
% \end{pssyntax}
%    \begin{macrocode}
/@ABDist { 
  3 -1 roll sub dup mul 3 1 roll sub dup mul add sqrt 
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{@InterLines}
%   Shorthand definition for \PSvar{InterLines} procedure of the
%   \nxLPack{pst-eucl} package. Takes care of a bug in the
%   \nxLPack{pst-eucl} package, that too many items are popped off the
%   stack if no intersection point exists.
% \begin{pssyntax}
%   \PSvar{X1 Y1 X2 Y2 X3 Y3 X4 Y4} \PSop{@InterLines} \PSvar{X Y ret}
% \end{pssyntax}
%    \begin{macrocode}
/@InterLines {
  tx@EcldDict begin
    EqDr /D1c exch def /D1b exch def /D1a exch def
    EqDr /D2c exch def /D2b exch def /D2a exch def
    D1a D2b mul D1b D2a mul sub dup 
    ZeroEq { % parallel lines
      pop 0 0 missed 
    }{
      /Det exch def
      D1b D2c mul D1c D2b mul sub Det div
      D1a D2c mul D2a D1c mul sub Det div
      ok
    } ifelse  
  end
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{@GetCenter}
%   Shorthand definition for the \PSvar{GetCenter} procedure of the
%   \nxLPack{pst-node} package. Takes either a string or a literal name
%   for the node name \PSvar{name}.
%   \begin{pssyntax}
%     \PSname{name} \PSop{@GetCenter} \PSvar{X Y}
%   \end{pssyntax}
%    \begin{macrocode}
/@GetCenter { 
  tx@NodeDict begin load GetCenter end 
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{@NewNode}
% Shorthand definition for creating a new pnode.
%    \begin{macrocode}
/@NewNode {
  tx@NodeDict begin 
    false exch 10 {InitPnode } NewNode 
  end
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{RefractVec}
%   Calculate the refracted vector, the normal plane vector must be
%   constructed with \PSvar{NormalVec}, see
%   \url{http://en.wikipedia.org/wiki/Snell%27s_law#Vector_form} for the
%     formulas.
%     \begin{pssyntax}
%       \PSvar{Xin Yin Xnorm Ynorm n1 n2} \PSop{RefractVec} \PSvar{Xout Yout}
%     \end{pssyntax}
%  If it would be total internal reflection, the output vector is (0, 0).
%    \begin{macrocode}
/RefractVec {
  (RefractVec) DebugBegin
  TransformRefIndex exch TransformRefIndex exch div /n ED 
  /Ynorm ED /Xnorm ED
  NormalizeVec /Yin ED /Xin ED 
  n abs 1 eq {
    Xin Yin
  }{
    /costheta1 Xnorm Ynorm Xin neg Yin neg DotProd def
    1 n dup mul 1 costheta1 dup mul sub mul sub
    dup 0 lt {
%    \end{macrocode}
% would be total internal reflection, stop
%    \begin{macrocode}
      pop 0 0
    } {
      sqrt /costheta2 ED
      n Xin mul n Yin mul 
      n costheta1 mul costheta2 sub dup 
      Xnorm mul exch Ynorm mul VecAdd
    } ifelse
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{ReflectVec}
%   Calculate the reflected vector, the normal plane vector must have been
%   constructed with \PSvar{NormalVec}.
%   \begin{pssyntax}
%     \PSvar{Xin Yin Xnorm Ynorm} \PSop{ReflectVec} \PSvar{Xout Yout}
%   \end{pssyntax}
%    \begin{macrocode}
/ReflectVec {
  (ReflectVec) DebugBegin
  /Ynorm ED /Xnorm ED NormalizeVec /Yin ED /Xin ED
  /costheta1 Xnorm Ynorm Xin neg Yin neg DotProd def
  Xin Yin 2 costheta1 mul dup Xnorm mul exch Ynorm mul VecAdd
  DebugEnd
} bind def
/ReflectGratVec {
  (ReflectGratVec) DebugBegin
  /Ynorm ED /Xnorm ED NormalizeVec /Yin ED /Xin ED
  /costheta1 Xnorm Ynorm Xin neg Yin neg DotProd def
  Xin Yin -2 costheta1 mul dup Xnorm mul exch Ynorm mul VecAdd
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{CurvedInterface}
%   \begin{pssyntax}
%     \PSvar{Xp Yp Xr Yr} \PSop{CurvedInterface} \PSvar{X0' Y0' Xout Yout status}
%   \end{pssyntax}
%    \begin{macrocode}
/CurvedInterface {
  (CurvedInterface) DebugBegin
  2 copy /Yr ED /Xr ED 
  tx@Dict begin Pyth end /radius ED /Yp ED /Xp ED
  /X0n X0 Xp sub def /Y0n Y0 Yp sub def
  tx@EcldDict begin
    X0n Y0n 2 copy 2 copy Xin 3 -1 roll add Yin 3 -1 roll add
    2 copy 6 2 roll EqDr radius InterLineCircle
  end
  4 copy
  0 eq 3 {exch 0 eq and} repeat {
%    \end{macrocode}
% if all coordinates are zero we missed the circle, stop
%    \begin{macrocode}
    missed
  } {
    4 copy
%    \end{macrocode}
% Chose which of the two intersection points to take.
%    \begin{macrocode}
    Xr neg Yr neg 2 copy
    8 -2 roll @ABDist
    5 1 roll @ABDist
    gt {
%    \end{macrocode}
% «dist from first point» $>$ «dist from second point», take second point.
%    \begin{macrocode}
      4 2 roll
    } if pop pop
    Xp Yp VecAdd
    2 copy Xp Yp 4 2 roll @ABVect exch neg Xin Yin 4 2 roll NormalVec 
    Xin Yin 4 2 roll
%    \end{macrocode}
% on stack: crossing point, in vector, and normal vector
%    \begin{macrocode}
    mode trans eq {
      n1 n2 RefractVec
      2 copy 0 eq exch 0 eq and { tir } { ok } ifelse
    } {
      ReflectVec ok
    } ifelse /n1 n2 def
    5 -2 roll 2 copy 7 2 roll X0 Y0 @ABVect Xin Yin DotProd 0 lt 
    PN 1 gt and {
      pop missed
    } if
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{PlainInterface}
%   \begin{pssyntax}
%     \PSvar{Xp Yp dXp dYp} \PSop{PlainInterface} \PSvar{X0' Y0' Xout Yout status}
%   \end{pssyntax}
%    \begin{macrocode}
/PlainInterface {%
  (PlainInterface) DebugBegin
  /dYp ED /dXp ED /Yp ED /Xp ED
  Xp Yp Xp dXp add Yp dYp add X0 Y0 X0 Xin add Y0 Yin add
  @InterLines missed eq {
    0 0 missed
  } {
    Xin Yin Xin Yin dXp dYp
    mode refltrans eq {
      neg exch NormalVec ReflectVec ok
    } {
      NormalVec
      mode trans eq {
        n1 n2 RefractVec
        2 copy 0 eq exch 0 eq and { tir } { ok } ifelse
      } {
        ReflectVec ok
      } ifelse 
    } ifelse
    /n1 n2 def
    5 -2 roll 2 copy 7 2 roll X0 Y0 @ABVect Xin Yin DotProd 0 lt
    PN 1 gt and {
      pop missed
    } if
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{PathInterface}
%   \begin{pssyntax}
%     \PSarray{path} \PSop{PathInterface} \PSvar{X0' Y0' Xout Yout status}
%   \end{pssyntax}
%    \begin{macrocode}
/PathInterface {
  (PathInterface) DebugBegin
  [ [X0 Y0] [X0 Xin add Y0 Yin add] ] exch 
  tx@IntersectDict begin IntersectLinePath end % [pathseg] t [isect]
  dup length 0 eq {
    pop pop pop 0 0 missed
  } {
    aload pop
    Xin Yin Xin Yin 
    8 -2 roll exch % I.x I.y Xin Yin Xin Yin t [pathseg]
    exch dup 9 1 roll exch % t I.x I.y Xin Yin Xin Yin t [pathseg]
    dup length 2 eq { % a line
      exch pop
      aload pop aload pop 3 -1 roll aload pop VecSub % t I.x I.y Xin Yin Xin Yin dXp dYp
    } {
      exch dup cvi sub DeriveCurve
    } ifelse
    % the following part is copied from /PlainInterface
    NormalVec
    mode trans eq {
      n1 n2 RefractVec
      2 copy 0 eq exch 0 eq and { tir } { ok } ifelse
    } {
      ReflectVec ok
    } ifelse
    /n1 n2 def
    5 -2 roll 2 copy 7 2 roll X0 Y0 @ABVect Xin Yin DotProd 0 lt
    PN 1 gt and {
      pop missed
    } if
    % t X0' Y0' Xout Yout status 
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{TransformRefIndex}
%   If the refractive index on the stack is for the background (has value
%   \opt{bgRefIndex}, which is \opt{0}), we replace it here with its actual
%   value (\opt{1}). This is necessary to distinguish between background index
%   and components having an index of \opt{1}, which can be changed with option
%   \opt{n}.
%   \begin{pssyntax}
%     \PSvar{n} \PSop{TransformRefIndex} \PSvar{n|1}
%   \end{pssyntax}
%    \begin{macrocode}
/TransformRefIndex {
  dup bgRefIndex eq { pop 1 } if
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GetRefIndex}
% Evaluate the refractive index of component \opt{name}.
% \begin{pssyntax}
%   \PSstring{name} \PSop{GetRefIndex} \PSvar{neval}
% \end{pssyntax}
%    \begin{macrocode}
/GetRefIndex {
  cvn load /n get /nbeam load exch
  EvalRefIndex
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{EvalRefIndex}
%   Evaluate the expression in \opt{nbeam} after setting refractive index to
%   \opt{n}.
%   \begin{pssyntax}
%     \PSproc{nbeam} \PSvar{n} \PSop{GetRefIndex} \PSvar{neval}
%   \end{pssyntax}
%    \begin{macrocode}
/EvalRefIndex {
  dup bgRefIndex eq not {
    1 dict begin 
%    \end{macrocode}
% Store \opt{n} locally for evaluation of the mathematical expression in
% \opt{nbeam}.
%    \begin{macrocode}
      /n ED
      exec
    end
  } if
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Sellmaier}
%   Calculate the refractive index for BK7 glass with the Sellmaier
%   equation. The wavelength must be given in nanometre. The coefficients are
%   taken from \href{http://en.wikipedia.org/wiki/Sellmeier_equation}.
%   \begin{pssyntax}
%     \PSvar{lambda} \PSop{Sellmaier} \PSvar{n}
%   \end{pssyntax}
%    \begin{macrocode}
/Sellmaier {
  dup mul
  dup dup 1.03961212 mul exch 6000.69867 sub div
  exch dup dup 0.231792344 mul exch 20017.9144 sub div
  exch dup 1.01046945 mul exch 103.560653e6 sub div
  add add 1 add sqrt
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{TangentCrosspoint}
% Xp Yp Xt1 Yt1 Xt2 Yt2
%    \begin{macrocode}
/TangentCrosspoint {
    4 copy 4 copy 14 -2 roll 2 copy
    6 2 roll @ABVect neg exch
    6 2 roll @ABVect neg exch
    8 -2 roll VecAdd 10 2 roll VecAdd
    @InterLines pop
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{NearestNodeTmp}
% {NodeB} CompA -> shortest distance, planenum
%    \begin{macrocode}
/NearestNodeTmp {
  exch /NodeB ED
  /dist -1 def
  dup cvn load /N get dup 1 eq {
    [ exch (N) ]
  } {
    [ exch 1 1 3 -1 roll { } for ]
  } ifelse
  {
    2 copy pop 
    GetIfcCenterCorr 2 copy
    NodeB @ABDist
    dist 0 lt {
      /dist ED
      ToVec /node ED
    } {
      dup dist lt {
        /dist ED
        ToVec /node ED
      } {
        pop pop pop
      } ifelse
    } ifelse
  } forall
  pop dist /node load
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{NearestNode}
%   Get the coordinates of the node of \PSvar{CompA} which is nearest to
%   \PSvar{CompB}/\PSvar{NodeB}, or push the coordinates of
%   \PSvar{NodeA} on stack if it is already a node.
%   \begin{pssyntax}
%     \PSvar{CompA/NodeA} \PSvar{CompB/NodeB} \PSop{NearestNode} \PSvar{X Y}
%   \end{pssyntax}
%    \begin{macrocode}
/NearestNode {
  (NearestNode) DebugBegin
  dup xcheck not { nametostr } if /CompB ED
  dup xcheck not {
%    \end{macrocode}
% CompA is a component
%    \begin{macrocode}
    nametostr /CompA ED
    /CompB load dup xcheck not {
%    \end{macrocode}
% CompB is a component
%    \begin{macrocode}
      /mindist -1 def
      [ exch false GetInternalNodeNames ]
      { @GetCenter ToVec
        CompA NearestNodeTmp 
        exch dup mindist ge mindist 0 ge and { 
          pop pop 
        }{ 
          /mindist ED /minnodeA ED 
        } ifelse
      } forall
      minnodeA
    } {
      CompA NearestNodeTmp exch pop exec
    } ifelse
  } {
%    \end{macrocode}
% else, it is a node and we already have the appropriate coordinates on the
% stack
%    \begin{macrocode}
    exec
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{RelConnAngle}
% Calculate start angle of \cs{nccurve} from CompA to CompB
%
% \begin{pssyntax}
%   \PSvar{Xb Yb Xa Ya A B} \PSvar{fiberalign} \PSop{RelConnAngle} \PSvar{angle}
% \end{pssyntax}
%    \begin{macrocode}
/RelConnAngle {
  (RelConnAngle) DebugBegin
  /fiberalign ED
  dup xcheck not { nametostr } if /CompB ED
  dup xcheck not { nametostr } if /CompA ED
  /CompA load xcheck {
    /CompB load xcheck {
%    \end{macrocode}
%  both parameters are nodes, so the angle is that of the direct connection line.
%    \begin{macrocode}
      @ABVect exch atan
    } {
%    \end{macrocode}
% B is a component, and A is a node: the angle at node A is calculated through component B
%    \begin{macrocode}
      4 copy @ABVect 6 2 roll pop pop 2 copy
%    \end{macrocode}
% on stack: Xb-Xa Yb-Ya Xb Yb Xb Yb
%    \begin{macrocode}
      CompB (Center) NodeName @GetCenter 
%    \end{macrocode}
% on stack: Xb-Xa Yb-Ya Xb Yb Xb Yb Xbc Ybc
%    \begin{macrocode}
      4 2 roll @ABVect 4 2 roll
      CompB 
      fiberalign center eq {
        RelConnAngle@center
      }{
        3 1 roll pop pop
        RelConnAngle@ref
      } ifelse
      2 copy exch atan
      7 3 roll 2 copy 9 -2 roll
      DotProd 0 gt 5 1 roll DotProd 0 gt xor { 180 add } if
    } ifelse
  } {
%    \end{macrocode}
% A is a component, B is insignificant
%
% discard coordinates of B
%    \begin{macrocode}
    4 2 roll pop pop 2 copy
    CompA (Center) NodeName @GetCenter
    4 2 roll @ABVect 4 2 roll
%    \end{macrocode}
% on stack: Xac-Xa Yac-Xa Xa Ya
%    \begin{macrocode}
    CompA fiberalign center eq {
      RelConnAngle@center
    }{
      3 1 roll pop pop
      RelConnAngle@tref
    } ifelse
    2 copy exch atan
%    \end{macrocode}
% Xac-Xa Yac-Ya XaB-XaA YaB-YaA angleTrefline
%    \begin{macrocode}
    5 1 roll DotProd 0 gt { 180 add } if
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{/RelConnAngle@ref}
% Calculate the vector of the reference line of \PSvar{CompA}.
% \begin{pssyntax}
%   \PSstring{CompA} \PSop{RelConnAngle@ref} \PSvar{dX dY}
% \end{pssyntax}
%    \begin{macrocode}
/RelConnAngle@ref {
  dup (A) NodeName exch (B) NodeName
  @GetCenter 3 -1 roll @GetCenter @ABVect 
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{/RelConnAngle@tref}
% Same as \PSname{RelConnAngle@ref} but uses the transformed reference nodes.
% \begin{pssyntax}
%   \PSvar{CompA} \PSop{RelConnAngle@ref} \PSvar{dX dY}
% \end{pssyntax}
%    \begin{macrocode}
/RelConnAngle@tref {
  dup (TrefA) NodeName exch (TrefB) NodeName
  @GetCenter 3 -1 roll @GetCenter @ABVect 
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{/RelConnAngle@center}
%   Calculate the vector from the center node of \PSvar{CompA} to the
%   node \PSstring{Xa, Ya}.
% \begin{pssyntax}
%   \PSvar{Xa Ya CompA} \PSop{RelConnAngle@center} \PSvar{dX dY}
% \end{pssyntax}
%    \begin{macrocode}
/RelConnAngle@center {
  (Center) NodeName @GetCenter 4 2 roll @ABVect
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GetIfcOrNodeCoord}
%   \begin{pssyntax}
%     \PSstring{IfcNum} \PSstring{CompName}/\PSproc{node} \PSop{GetIfcOrNodeCoord} \PSvar{x y}
%   \end{pssyntax}
%    \begin{macrocode}
/GetIfcOrNodeCoord {
  (GetIfcOrNodeCoord) DebugBegin
  dup xcheck {
    exch pop exec
  } {
    nametostr exch nametostr exch GetIfcCenter
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{connectInterfaces}
%   \begin{pssyntax}
%     \PSproc{vec}
%   \end{pssyntax}
% InVec Center CenterTmp PrevMode relangle
%    \begin{macrocode}
/connectInterfaces {
  /relAngleTmp ED
  PN 2 eq {
%    \end{macrocode}
% initialize relAngle, the angle between plane connection and input vector
%    \begin{macrocode}
    pop @ABVect NormalizeVec 4 2 roll VecAngle /relAngleTmp ED
  } if
  PN 3 ge {
    trans eq {
%    \end{macrocode}
% previous plane was transmittive, recalculate the input vector
%    \begin{macrocode}
      @ABVect NormalizeVec 4 2 roll pop pop % remove Vec from stack
      relAngleTmp matrix rotate dtransform
      4 2 roll pop pop
    } {
%    \end{macrocode}
% else, the previous plane was reflective, recalculate relAngle
%    \begin{macrocode}
      @ABVect NormalizeVec 4 2 roll VecAngle /relAngleTmp ED
    } ifelse
  } if
  relAngleTmp
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GetCompRange}
% \PSstring{basename} \PSvar{start stop} 
% \PSop{GetCompRange} \PSstring{basenamestart} \ldots\ \PSstring{basenamestop}
%    \begin{macrocode}
/GetCompRange {
  2 copy gt { 1 }{ -1 } ifelse 3 -1 roll
  { exch dup 3 -1 roll inttostr strcat exch} for
  pop
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CorrectDipoleIfc}
%   For a dipole which has two interface nodes (1) and (N) which are very close
%   together ($\text{dist} < 10^{-7}$) or which coincide, the automatic angle
%   estimation of the fiber connections does not work properly. So these
%   interfaces are separated as less as possible so that the NearestNode
%   procedure estimates two different distances. The changed nodes are saved
%   only in the interface dictionary as XCorr and YCorr. You must use these for
%   the fiber connections.
%   \begin{pssyntax}
%     \PSstring{node1} \PSstring{node2} \PSstring{basename} \PSop{CorrectDipoleIfc}
%   \end{pssyntax}
%    \begin{macrocode}
/CorrectDipoleIfc {
  (CorrectDipoleIfc) DebugBegin
  dup dup 3 copy
  8 -1 roll dup 9 1 roll NodeName exch 7 -1 roll dup 7 1 roll NodeName
  gsave
    tx@Dict begin 
      STV CP T
      exch @GetCenter 3 -1 roll @GetCenter
    end
  grestore
  4 copy @ABDist 1e-7 lt {
%    \end{macrocode}
% The two nodes are closer together than $10^{-7}$, correct that to avoid
% problems with the angle direction when drawing fibers.
%    \begin{macrocode}
    6 -1 roll
    gsave
      tx@Dict begin 
        STV CP T
        (TrefA) NodeName @GetCenter 7 -1 roll 
        (TrefB) NodeName @GetCenter 
      end
    grestore
    @ABVect NormalizeVec 2 copy
%    \end{macrocode}
% The floating-point precision of the Postscript interpreter is
% approximately 8 digits, so in order to have an effect, the nodes must
% be separated by $10^{-7}$ times the maximum coordinate value.
%    \begin{macrocode}
    8 -2 roll abs exch abs mymax -1e-6 mul VecScale
    8 -2 roll cvn load begin
      IfcName load begin 
        X Y VecAdd /YCorr exch def /XCorr exch def
      end
    end
    4 2 roll abs exch abs mymax 1e-6 mul VecScale
    4 2 roll cvn load begin
      IfcName load begin
        X Y VecAdd /YCorr exch def /XCorr exch def
      end
    end
  } {
    10 { pop } repeat
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{ClipFadeValue}
% Clip a number to the range [0:1].
%   \begin{pssyntax}
%     \PSvar{value} \PSop{ClipFadeValue} \PSvar{clippedvalue}
%   \end{pssyntax}
%    \begin{macrocode}
/ClipFadeValue {
  dup 0 lt { pop 0 }{ dup 1 gt { pop 1 } if } ifelse
} bind def
%    \end{macrocode}
% \end{macro}
% \begin{macro}{fadeto@}
% The different fadeto modes.
%    \begin{macrocode}
/fadeto@white {
  FadeFunc ClipFadeValue @S mul @H exch @B sethsbcolor
} bind def
/fadeto@black {
  FadeFunc ClipFadeValue @B mul @H exch @S exch sethsbcolor
} bind def
/fadeto@transparency {
  FadeFunc ClipFadeValue @T mul .setopacityalpha
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{fadefunc@}
%   The default fade functions, which are selected with the parameter
%   'fadefuncname'. The clipping is done afterwards.
%    \begin{macrocode}
/fadefunc@linear {
  neg 1 add
} bind def
/fadefunc@squared {
  dup mul neg 1 add
} bind def
/fadefunc@gauss {
  0.4 div dup mul neg Euler exch exp
} bind def
/fadefunc@exp {
  -6 mul Euler exch exp
} bind def
%    \end{macrocode}
% \end{macro}
% \begin{macro}{FadeStroke}
% Implement the 'fade' linestyle.
%    \begin{macrocode}
/FadeStroke {
  /FadeFunc ED /FadeToColor ED /@T ED
  PathLength dup /@L ED exch div /@dl ED
  mark
  { false counttomark 3 roll }
  { true counttomark 3 roll }
  {} {} pathforall
  currenthsbcolor /@B ED /@S ED /@H ED
  newpath /currL 0 def
  counttomark 3 idiv 1 1 3 -1 roll {
    pop
    { % lineto 
      /y2 ED /x2 ED  x2 x1 sub y2 y1 sub 2 copy 
      dup mul exch dup mul add sqrt dup  @L div exch
      @dl div 1 add floor dup dup
      4 2 roll div 5 1 roll
      1 1 3 -1 roll {
        5 copy 4 copy 2 copy eq not { fadecorrect add } if exch div VecScale
        6 2 roll 1 sub dup 0 eq not { fadecorrect sub } if exch div VecScale
        x1 y1 VecAdd moveto x1 y1 VecAdd lineto
        mul currL add FadeToColor
        stroke
      } for
      4 1 roll pop pop mul currL add /currL ED
      /y1 y2 def /x1 x2 def
    } { % moveto 
      /y1 ED /x1 ED
    } ifelse
  } for
  pop
} def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{TransformPath}
%   Transforms a path (as defined by \cs{pssavepath} from
%   \nxLPack{pst-intersect}) using the \opt{currentmatrix} and the
%   \opt{CompMtrx} of the component. That is used only by \opt{LoadIfc}.
%   \begin{pssyntax}
%     \PSarray{path} \PSop{TransformPath} \PSarray{path'}
%   \end{pssyntax}
%    \begin{macrocode}
/TransformPath {
  mark [ 3 -1 roll aload pop 
  counttomark 1 add counttomark 1 add exch 1 roll
  {
    counttomark 1 eq { cleartomark exit } if
    dup /curvetype eq {
      7 1 roll
      3 { CompMtrx transform CM itransform 7 2 roll } repeat
      counttomark -1 roll dup counttomark 1 roll
      7 roll
    } {
      3 1 roll CompMtrx transform CM itransform 3 -1 roll
      counttomark -1 roll dup counttomark 1 roll
      3 roll
    } ifelse
  } loop
  ]
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{DeriveCurve}
%   Calculate the derivative of a curve at its parameter \PSvar{t}. This
%   works only for the special case of third-order Bezier curves.
%
%   \begin{align*}
%     B(t)  & = (1-t)^3 P_0 + 3(1-t)^2 t P_1 + 3(1-t)t^2 P_2 + t^3 P_3\\
%     B'(t) & = -3(1-t)^2 P_0 + 3(3t^2–4t+1) P_1 + 3(2t–3t^2) P_2 + 3t^2 P_3
%   \end{align*}
%   \begin{pssyntax}
%     \PSarray{curve} \PSvar{t} \PSop{DeriveCurve} \PSvar{dX dY}
%   \end{pssyntax}
%    \begin{macrocode}
/DeriveCurve {
  (DeriveCurve) DebugBegin
  exch dup length 4 eq not {
    pop pop 0 0
  } {
    aload pop 5 -1 roll
    dup 1 exch sub dup mul -3 mul exch % P0 P1 P2 P3 C0=(-3(1-t)^2) t
    dup dup -4 mul 1 add exch dup mul 3 mul add 3 mul exch % P0 P1 P2 P3 C0 C1=(3(3t^2-4t+1)) t
    dup dup 2 mul exch dup mul -3 mul add 3 mul exch % P0 P1 P2 P3 C0 C1 C2=(3(2t-3t^2)) t
    dup mul 3 mul % P0 P1 P2 P3 C0 C1 C2 C3=3t^2
    8 copy
    0 6 -1 3 { -1 roll 0 get 3 -1 roll mul add } for
    9 1 roll
    0 6 -1 3 { -1 roll 1 get 3 -1 roll mul add } for
  } ifelse
  DebugEnd
} bind def
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{GetBezierDeriv}
%   Calculate the derivative of the bezier curve at the coordinate
%   \PSvar{t}.
%   \begin{equation}
%     C(t) = \sum_{i=0}^n B_{i,n}(t)P_i\quad\text{with}\quad B_{i,n}(t) = (n over i) t^i(1-t)^{n-i}
%   \end{equation}
%   \begin{equation}
%     C'(t) = \sum_{i=0}^n B'_{i,n}(t)P_i\quad\text{with}\quad B'_{i,n}(t) = (n over i)(i t^{i-1}(1-t)^{n-i} - (n-i)t^i(1-t)^{n-i-1})
%   \end{equation}
%   \begin{pssyntax}
%     \PSarray{[P0]\ldots[P\_n]} \PSvar{t} \PSop{DeriveBezier} \PSvar{x y}
%   \end{pssyntax}
%    \begin{macrocode}
/GetBezierDeriv { 				% t on stack
  10 dict begin					% hold all local
  /t ED
  /t1 1 t sub def				% t1=1-t
  dup length /BezierOrder exch def
  /Points exch def
  /Coeff tx@FuncDict begin Pascal end BezierOrder get def		% get the coefficients
    0 0						% initial values for x y
    BezierOrder -1 0 {				% BezierOrder,...,2,1,0
      /I ED					% I=BezierOrder,...,2,1,0
      /J BezierOrder I sub def			% J=0,1,2,...,BezierOrder
      I 0 eq { 
        0 
      }{ 
        I t I 1 sub exp mul t1 J exp mul        %  i*t^{i-1}*(1-t)^{n-i} 
      } ifelse
      J 0 eq {
        0
      } {
        J t I exp mul t1 J 1 sub exp mul    % -(n-i)t^i(1-t)^{n-i-1}
      } ifelse
      sub Coeff J get mul
      Points I get aload pop 3 -1 roll VecScale VecAdd
    } for					% x y on stack
  end
} bind def
%    \end{macrocode}
% \end{macro}
%
% This fixes a problem in pst-intersect.pro v0.4
%    \begin{macrocode}
tx@IntersectDict begin 
/IntersectLinePath {
  3 dict begin
    PreparePath dup length /n exch def
    2 copy ElongateLine exch 3 -1 roll pop
    /isect [] def
    /t -1 def
    {
      /n n 1 sub def
      2 copy IntersectBeziers
      dup 5 1 roll LoadIntersectionPoints
      dup length 0 gt {
        /isect exch def
        0 get dup type /arraytype eq {
          aload pop add 0.5 mul 
        } if n add /t exch def
        exch pop
        exit
      } {
        pop pop pop
      } ifelse
    } forall
    t isect
  end
} bind def
end
%    \end{macrocode}
%
% \begin{macro}{GetCoordinatePair}
%   Get the coordinate pair at position \PSvar{n} (n goes from 1 to N) and remove the other coordinates
%   including mark from stack
%   \begin{pssyntax}
%     [ \PSvar{xN} \PSvar{yN} ... \PSvar{x1} \PSvar{y1} \PSvar{n} \PSop{GetCoordinatePair}
%   \end{pssyntax}
%    \begin{macrocode}
/GetCoordinatePair {%
  2 mul -2 roll counttomark 1 add 2 roll cleartomark
} bind def
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
/GetFirstInputCoordinatePair { 1 GetCoordinatePair } bind def
%    \end{macrocode}
% If a coupler has only a single input node, this must be used for both nodes
%    \begin{macrocode}
/GetLastInputCoordinatePair { counttomark 2 idiv 1 sub GetCoordinatePair } bind def
%    \end{macrocode}
% \begin{macro}{mymax}
%   For some reason Adobe Distiller crashes if 'max' operator is used
%   with two floats which are very close (4e-5 in one case)
%    \begin{macrocode}
/mymax {
  2 copy lt { exch } if pop
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{debug}
%   Print out the last \opt{N} elements from the stack, checks for
%   stackunderflow. I \opt{N} is negative, the complete stack is
%   printed. Compared to the \PSvar{stack} operand, it prints the content of
%   procedures and array, which we use a lot.
%   \begin{pssyntax}
%     \PSvar{N} \PSop{debug}
%   \end{pssyntax}
%    \begin{macrocode}
/debug { 
  /@N ED count dup @N gt @N 0 ge and { pop @N } if 
  copy @N { == } repeat
} bind def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{debugComp}
% Print out all parameters and planes of the component \opt{compname}.
%   \begin{pssyntax}
%     \PSstring{compname} \PSop{debugComp}
%   \end{pssyntax}
%    \begin{macrocode}
/debugComp { 
  dup (debug comp ") exch strcat ("===============) strcat ==
  cvn load { 
    dup type /dicttype eq {
      (plane----------------) == 
      { == == } forall
      (-----------done) ==
      } { == } ifelse
      ==
  } forall
  (================== done) ==
} bind def
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
end % tx@OptexpDict
%    \end{macrocode}
%</prolog> 
% \Finale
% \endinput
%
%<*indexstyle>font-size
headings_flag       1
heading_prefix   "\\textbf{"
heading_suffix   "}\n"
quote		'"'
level		'!'
actual          '='
preamble
  "\\begin{theindex}\n"
item_1
  "\\par\\leavevmode\\hangindent10pt\\makebox[25pt][r]{ -- }"
item_01
  "\\par\\leavevmode\\hangindent10pt\\makebox[25pt][r]{ -- }"
item_x1
  "\\par\\leavevmode\\hangindent10pt\\makebox[25pt][r]{ -- }"
item_2
  "\\par\\leavevmode\\hangindent20pt\\makebox[50pt][r]{ -- -- }"
item_12
  "\\par\\leavevmode\\hangindent20pt\\makebox[50pt][r]{ -- -- }"
item_x2
  "\\par\\leavevmode\\hangindent20pt\\makebox[50pt][r]{ -- -- }"
%</indexstyle>